~ubuntu-branches/ubuntu/hardy/ghostscript/hardy

« back to all changes in this revision

Viewing changes to src/zchar.c

  • Committer: Bazaar Package Importer
  • Author(s): Till Kamppeter
  • Date: 2007-11-22 12:17:43 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20071122121743-cd70s3ypq0r243mp
Tags: 8.61.dfsg.1-0ubtuntu1
* New upstream release
  o Final 8.61 release
* debian/patches/09_ijs_krgb_support.dpatch: Adapted to upstream changes.
* debian/rules: Updated CUPS-related variables for "make install" calls.
* debian/rules: Remove /usr/include/ghostscript from the ghostscript
  package, they go into lings-dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
   San Rafael, CA  94903, U.S.A., +1(415)492-9861, for further information.
12
12
*/
13
13
 
14
 
/*$Id: zchar.c 8022 2007-06-05 22:23:38Z giles $ */
 
14
/*$Id: zchar.c 8250 2007-09-25 13:31:24Z giles $ */
15
15
/* Character operators */
16
16
#include "ghost.h"
17
17
#include "oper.h"
42
42
extern bool CPSI_mode;
43
43
 
44
44
/* Forward references */
45
 
private bool map_glyph_to_char(const gs_memory_t *mem, 
 
45
static bool map_glyph_to_char(const gs_memory_t *mem, 
46
46
                               const ref *, const ref *, ref *);
47
 
private int finish_show(i_ctx_t *);
48
 
private int op_show_cleanup(i_ctx_t *);
49
 
private int op_show_return_width(i_ctx_t *, uint, double *);
 
47
static int finish_show(i_ctx_t *);
 
48
static int op_show_cleanup(i_ctx_t *);
 
49
static int op_show_return_width(i_ctx_t *, uint, double *);
50
50
 
51
51
/* <string> show - */
52
 
private int
 
52
static int
53
53
zshow(i_ctx_t *i_ctx_p)
54
54
{
55
55
    os_ptr op = osp;
68
68
}
69
69
 
70
70
/* <ax> <ay> <string> ashow - */
71
 
private int
 
71
static int
72
72
zashow(i_ctx_t *i_ctx_p)
73
73
{
74
74
    os_ptr op = osp;
89
89
}
90
90
 
91
91
/* <cx> <cy> <char> <string> widthshow - */
92
 
private int
 
92
static int
93
93
zwidthshow(i_ctx_t *i_ctx_p)
94
94
{
95
95
    os_ptr op = osp;
123
123
}
124
124
 
125
125
/* <cx> <cy> <char> <ax> <ay> <string> awidthshow - */
126
 
private int
 
126
static int
127
127
zawidthshow(i_ctx_t *i_ctx_p)
128
128
{
129
129
    os_ptr op = osp;
160
160
}
161
161
 
162
162
/* <proc> <string> kshow - */
163
 
private int
 
163
static int
164
164
zkshow(i_ctx_t *i_ctx_p)
165
165
{
166
166
    os_ptr op = osp;
191
191
 
192
192
/* Common finish procedure for all show operations. */
193
193
/* Doesn't have to do anything. */
194
 
private int
 
194
static int
195
195
finish_show(i_ctx_t *i_ctx_p)
196
196
{
197
197
    return 0;
198
198
}
199
199
 
200
200
/* <string> stringwidth <wx> <wy> */
201
 
private int
 
201
static int
202
202
zstringwidth(i_ctx_t *i_ctx_p)
203
203
{
204
204
    os_ptr op = osp;
233
233
}
234
234
 
235
235
/* Common code for charpath and .charboxpath. */
236
 
private int
 
236
static int
237
237
zchar_path(i_ctx_t *i_ctx_p, op_proc_t proc, 
238
238
           int (*begin)(gs_state *, const byte *, uint,
239
239
                        bool, gs_memory_t *, gs_text_enum_t **))
256
256
    return op_show_continue_pop(i_ctx_p, 2);
257
257
}
258
258
/* <string> <outline_bool> charpath - */
259
 
private int
 
259
static int
260
260
zcharpath(i_ctx_t *i_ctx_p)
261
261
{
262
262
    return zchar_path(i_ctx_p, zcharpath, gs_charpath_begin);
263
263
}
264
264
/* <string> <box_bool> .charboxpath - */
265
 
private int
 
265
static int
266
266
zcharboxpath(i_ctx_t *i_ctx_p)
267
267
{
268
268
    return zchar_path(i_ctx_p, zcharboxpath, gs_charboxpath_begin);
319
319
}
320
320
 
321
321
/* <wx> <wy> setcharwidth - */
322
 
private int
 
322
static int
323
323
zsetcharwidth(i_ctx_t *i_ctx_p)
324
324
{
325
325
    os_ptr op = osp;
342
342
 
343
343
/* <dict> .fontbbox <llx> <lly> <urx> <ury> -true- */
344
344
/* <dict> .fontbbox -false- */
345
 
private int
 
345
static int
346
346
zfontbbox(i_ctx_t *i_ctx_p)
347
347
{
348
348
    os_ptr op = osp;
364
364
    return 0;
365
365
}
366
366
 
 
367
/* Export in_cachedevice flag for PDF interpreter, which, unlike
 
368
 * PS unterpreter, ignores color operations in the inappropriate context.
 
369
 */
 
370
/* - .incachedevice <bool> */
 
371
static int
 
372
zincachedevice(i_ctx_t *i_ctx_p)
 
373
{
 
374
    os_ptr op = osp;
 
375
 
 
376
    push(1);
 
377
    make_bool(op, !!igs->in_cachedevice);
 
378
    return 0;
 
379
}
 
380
 
 
381
 
367
382
/* ------ Initialization procedure ------ */
368
383
 
369
 
const op_def zchar_op_defs[] =
 
384
const op_def zchar_a_op_defs[] =
370
385
{
371
386
    {"3ashow", zashow},
372
387
    {"6awidthshow", zawidthshow},
388
403
    op_def_end(0)
389
404
};
390
405
 
 
406
const op_def zchar_b_op_defs[] =
 
407
{
 
408
    {"0.incachedevice", zincachedevice},
 
409
    op_def_end(0)
 
410
};
 
411
 
391
412
/* ------ Subroutines ------ */
392
413
 
393
414
/* Most of these are exported for zchar2.c. */
662
683
    }
663
684
}
664
685
/* Reverse-map a glyph name to a character code for glyphshow. */
665
 
private bool
 
686
static bool
666
687
map_glyph_to_char(const gs_memory_t *mem, const ref * pgref, const ref * pencoding, ref * pch)
667
688
{
668
689
    uint esize = r_size(pencoding);
681
702
 
682
703
/* Find the index of the e-stack mark for the current show enumerator. */
683
704
/* Return 0 if we can't find the mark. */
684
 
private uint
 
705
static uint
685
706
op_show_find_index(i_ctx_t *i_ctx_p)
686
707
{
687
708
    ref_stack_enum_t rsenum;
740
761
/* of the setcharwidth or the setcachedevice[2] if we are in */
741
762
/* a stringwidth or cshow, or if we are only collecting the scalable */
742
763
/* width for an xfont character. */
743
 
private int
 
764
static int
744
765
op_show_return_width(i_ctx_t *i_ctx_p, uint npop, double *pwidth)
745
766
{
746
767
    uint index = op_show_find_index(i_ctx_p);
775
796
 * Restore state after finishing, or unwinding from an error within, a show
776
797
 * operation.  Note that we assume op == osp, and may reset osp.
777
798
 */
778
 
private int
 
799
static int
779
800
op_show_restore(i_ctx_t *i_ctx_p, bool for_error)
780
801
{
781
802
    register es_ptr ep = esp + snumpush;
831
852
    return code;
832
853
}
833
854
/* Clean up after an error. */
834
 
private int
 
855
static int
835
856
op_show_cleanup(i_ctx_t *i_ctx_p)
836
857
{
837
858
    return op_show_restore(i_ctx_p, true);