[gs-code-review] Fix for 35_all-12, glyphshow errors
Igor V. Melichev
igor.melichev at artifex.com
Fri Feb 16 23:22:34 PST 2007
Does push(1) check stack overflow ?
> There's no raster differences on regression test
Which test exactly ?
I guess you mean 'comparefiles'.
Please specify explicitly.
> CET 35_all-12 tests, among other things, how glyphshow operator handles
> type 32 fonts without glyph 0.
>
> The proposed patch add a check to the BuildGlyph procedure of type 32
> font for the missing 0 glyph that throws /invalidfont error.
> The offending command name is retrieved from the text enumeration
> structure using a new operator - .getshowoperator
Please insert "DETAILS" :
+ Provide the right operator name when error happens due to a missed type 32
glyph.
+
+ DETAILS :
Please commit after fixing.
Igor.
----- Original Message -----
From: "Alex Cherepanov" <alexcher at quadnet.net>
To: "gs-code-review" <gs-code-review at ghostscript.com>
Sent: Saturday, February 17, 2007 7:55 AM
Subject: [gs-code-review] Fix for 35_all-12, glyphshow errors
> CET 35_all-12 tests, among other things, how glyphshow operator handles
> type 32 fonts without glyph 0.
>
> The proposed patch add a check to the BuildGlyph procedure of type 32
> font for the missing 0 glyph that throws /invalidfont error.
> The offending command name is retrieved from the text enumeration
> structure using a new operator - .getshowoperator
>
> DIFFERENCES:
> There's no raster differences on regression test
> but the order of dictionary and resource enumeration is disturbed
> in all possible places.
> 23-32-02 different address of an operator
> 28-06-01 different directory enumeration order
> 23-25-03 different order of resource enumeration
> 09-56-01 different order of resource enumeration
> 409-01.PS different order of resource enumeration
> Type1C fonts in PDF files depend on directory enumeration order.
>
>
--------------------------------------------------------------------------------
> Index: gs/src/zcharx.c
> ===================================================================
> --- gs/src/zcharx.c (revision 7704)
> +++ gs/src/zcharx.c (working copy)
> @@ -19,6 +19,7 @@
> #include "gstext.h"
> #include "gxfixed.h" /* for gxfont.h */
> #include "gxfont.h"
> +#include "gxtext.h"
> #include "ialloc.h"
> #include "ichar.h"
> #include "igstate.h"
> @@ -58,6 +59,7 @@
> if ((code = glyph_show_setup(i_ctx_p, &glyph)) != 0 ||
> (code = gs_glyphshow_begin(igs, glyph, imemory, &penum)) < 0)
> return code;
> + *(op_proc_t *)&penum->enum_client_data = zglyphshow;
> if ((code = op_show_finish_setup(i_ctx_p, penum, 1, NULL)) < 0) {
> ifree_object(penum, "zglyphshow");
> return code;
> Index: gs/src/zfont32.c
> ===================================================================
> --- gs/src/zfont32.c (revision 7704)
> +++ gs/src/zfont32.c (working copy)
> @@ -19,8 +19,10 @@
> #include "gsmatrix.h"
> #include "gsutil.h"
> #include "gxfont.h"
> +#include "gxtext.h"
> #include "bfont.h"
> #include "store.h"
> +#include "ichar.h"
>
> /* The encode_char procedure of a Type 32 font should never be called. */
> private gs_glyph
> @@ -59,10 +61,31 @@
> return define_gs_font((gs_font *) pfont);
> }
>
> +/* - .getshowoperator <oper|null> */
> +/* Get the calling operator for error reporting in %Type32BuildGlyph */
> +private int
> +zgetshowoperator(i_ctx_t *i_ctx_p)
> +{
> + os_ptr op = osp;
> + gs_text_enum_t *osenum = op_show_find(i_ctx_p);
> +
> + push(1);
> + if (osenum == NULL)
> + make_null(op);
> + else {
> + op_proc_t proc;
> + *(void **)&proc = osenum->enum_client_data;
> + make_oper(op, 0, proc);
> + }
> + return 0;
> +}
> +
> +
> /* ------ Initialization procedure ------ */
>
> const op_def zfont32_op_defs[] =
> {
> {"2.buildfont32", zbuildfont32},
> + {"0.getshowoperator", zgetshowoperator},
> op_def_end(0)
> };
> Index: gs/lib/gs_typ32.ps
> ===================================================================
> --- gs/lib/gs_typ32.ps (revision 7704)
> +++ gs/lib/gs_typ32.ps (working copy)
> @@ -95,8 +95,14 @@
> (%Type32BuildGlyph) cvn { % <font> <cid> %Type32BuildGlyph -
> 1 index /CharStrings get
> % Stack: font cid CharStrings
> - dup 2 index .knownget
> - { exch pop } { 0 get } ifelse
> + dup 2 index .knownget {
> + exch pop
> + } {
> + 0 .knownget not {
> + exch pop % Stack: cid
> + .getshowoperator /invalidfont signalerror
> + } if
> + } ifelse
> % Stack: font cid cstr
> dup //.getmetrics32 % use // because of .undef below
> dup 14 gt {
> @@ -116,7 +122,7 @@
> [ 1 0 0 1 11 -2 roll exch neg exch neg ] 5 -1 roll imagemask
> } ifelse
> pop pop pop pop
> -} bind def
> +} .bind def
>
> systemdict /.getmetrics32 .undef
>
> Index: gs/src/int.mak
> ===================================================================
> --- gs/src/int.mak (revision 7704)
> +++ gs/src/int.mak (working copy)
> @@ -777,8 +777,8 @@
> $(PSCC) $(PSO_)zchar32.$(OBJ) $(C_) $(PSSRC)zchar32.c
>
> $(PSOBJ)zfont32.$(OBJ) : $(PSSRC)zfont32.c $(OP)\
> - $(gsccode_h) $(gsmatrix_h) $(gsutil_h) $(gxfont_h)\
> - $(bfont_h) $(store_h)
> + $(gsccode_h) $(gsmatrix_h) $(gsutil_h) $(gxfont_h) $(gxtext_h)\
> + $(bfont_h) $(store_h) $(ichar_h)
> $(PSCC) $(PSO_)zfont32.$(OBJ) $(C_) $(PSSRC)zfont32.c
>
> type32_=$(PSOBJ)zchar32.$(OBJ) $(PSOBJ)zfont32.$(OBJ)
> @@ -1438,7 +1438,7 @@
> $(PSCC) $(PSO_)ibnum.$(OBJ) $(C_) $(PSSRC)ibnum.c
>
> $(PSOBJ)zcharx.$(OBJ) : $(PSSRC)zcharx.c $(OP)\
> - $(gsmatrix_h) $(gstext_h) $(gxfixed_h) $(gxfont_h)\
> + $(gsmatrix_h) $(gstext_h) $(gxfixed_h) $(gxfont_h) $(gxtext_h)\
> $(ialloc_h) $(ibnum_h) $(ichar_h) $(iname_h) $(igstate_h) $(memory__h)
> $(PSCC) $(PSO_)zcharx.$(OBJ) $(C_) $(PSSRC)zcharx.c
>
> Index: gs/doc/pscet_status.txt
> ===================================================================
> --- gs/doc/pscet_status.txt (revision 7709)
> +++ gs/doc/pscet_status.txt (working copy)
> @@ -5523,7 +5523,7 @@
> GS is not removing glyphs from previous page "currentfont removeall".
> Assign: Ray
>
> -35_all-12 DIFF glyphshow : Different error reporting. Analyzed by Igor.
> assign: Alex.
> +35_all-12 OK Fixed by rev. 7710 - Alex.
>
> 35_all-2 OK Fixed as of rev 7583.
>
>
--------------------------------------------------------------------------------
> _______________________________________________
> gs-code-review mailing list
> gs-code-review at ghostscript.com
> http://www.ghostscript.com/mailman/listinfo/gs-code-review
>
More information about the gs-code-review
mailing list