[gs-code-review] Fix for 687826, Some glyphs filled in
Alex Cherepanov
alexcher at coscript.com
Sun May 8 08:57:04 PDT 2005
Partially reinstate even-odd filing rule. Identify fonts that need
even-odd rule by the font's UniqueID.
Fix bug 687826.
-------------- next part --------------
Index: gs/src/zchar1.c
===================================================================
RCS file: /cvs/ghostscript/gs/src/zchar1.c,v
retrieving revision 1.44
diff -b -u -r1.44 zchar1.c
--- gs/src/zchar1.c 14 Apr 2005 19:10:14 -0000 1.44
+++ gs/src/zchar1.c 8 May 2005 15:08:05 -0000
@@ -44,33 +44,43 @@
#include "iutil.h"
#include "store.h"
+/* ---------------- Utilities ---------------- */
+
/*
* Properly designed fonts, which have no self-intersecting outlines
* and in which outer and inner outlines are drawn in opposite
* directions, aren't affected by choice of filling rule; but some
* badly designed fonts in the Genoa test suite seem to require
* using the even-odd rule to match Adobe interpreters.
- */
-#define GS_CHAR_FILL gs_eofill /* gs_fill or gs_eofill */
-
-/* ============== PATCH BEG=================== */
-/*
+ *
* On April 4, 2002, we received bug report #539359
* which we interpret as some Genoa test are now obsolete,
* so we need to drop the bad font tolerance feature
- * explained above. This temporary patch changes
+ * explained above. The code was patched to change
* the even-odd rule back to non-zero rule.
- * This patch to be kept until we accumulate
- * enough information from regression testing and
- * from user responses.
+ *
+ * On December 2, 2004, we received bug report #687826
+ * and font files created by TypeSmith Amiga v2.5a, Relog, Inc.
+ * that require even-odd rule. The even-odd rule is reinstated
+ * for the fonts with specific UniqueID.
*/
-
-#undef GS_CHAR_FILL
-#define GS_CHAR_FILL gs_fill /* gs_fill or gs_eofill */
-
-/* ============== PATCH END=================== */
-
-/* ---------------- Utilities ---------------- */
+private int
+fix_fill_op(int (**show)(gs_state *), i_ctx_t *i_ctx_p)
+{
+ os_ptr op = osp;
+ gs_font *pfont;
+ int code = font_param(op - 3, &pfont);
+ if (code < 0)
+ return code;
+ { gs_font_base *const pbfont = (gs_font_base *) pfont;
+ if (uid_is_UniqueID(&pbfont->UID) &&
+ (pbfont->UID.id == 6786868 || pbfont->UID.id == 568589))
+ *show = gs_eofill;
+ else
+ *show = gs_fill;
+ }
+ return code;
+}
/* Test whether a font is a CharString font. */
private bool
@@ -589,10 +599,12 @@
bbox_fill(i_ctx_t *i_ctx_p)
{
op_proc_t exec_cont = 0;
- int code;
+ int (*show)(gs_state *);
+ int code = fix_fill_op(&show, i_ctx_p);
- /* See above re GS_CHAR_FILL. */
- code = bbox_draw(i_ctx_p, GS_CHAR_FILL, &exec_cont);
+ if (code < 0)
+ return code;
+ code = bbox_draw(i_ctx_p, show, &exec_cont);
if (code >= 0 && exec_cont != 0)
code = (*exec_cont)(i_ctx_p);
return code;
@@ -756,6 +768,8 @@
make_empty_const_array(esp, a_readonly + a_executable);
}
+
+
/* -------- no-bbox case -------- */
private int
@@ -844,8 +858,12 @@
private int
nobbox_fill(i_ctx_t *i_ctx_p)
{
- /* See above re GS_CHAR_FILL. */
- return nobbox_draw(i_ctx_p, GS_CHAR_FILL);
+ int (*show)(gs_state *);
+ int code = fix_fill_op(&show, i_ctx_p);
+
+ if (code < 0)
+ return code;
+ return nobbox_draw(i_ctx_p, show);
}
private int
nobbox_stroke(i_ctx_t *i_ctx_p)
More information about the gs-code-review
mailing list