[Pkg-gs-devel] r26 - in gs-esp/trunk/debian: patches
Kenshi Muto
kmuto at costa.debian.org
Sun Aug 20 08:11:47 UTC 2006
Author: kmuto
Date: Sun Aug 20 08:11:46 2006
New Revision: 26
Added:
gs-esp/trunk/debian/patches/08_revert_cjk.dpatch (contents, props changed)
Modified:
gs-esp/trunk/debian/changelog
gs-esp/trunk/debian/patches/00list
Log:
CJK patch breaks umlaut. removed it.
Modified: gs-esp/trunk/debian/changelog
==============================================================================
--- gs-esp/trunk/debian/changelog (original)
+++ gs-esp/trunk/debian/changelog Sun Aug 20 08:11:46 2006
@@ -1,8 +1,10 @@
-gs-esp (8.15.2.dfsg.1-2) UNRELEASED; urgency=medium
+gs-esp (8.15.2.dfsg.1-2) unstable; urgency=medium
[Kenshi Muto]
* gs-cjk-resource still needs for CJK people.
Revert a dependency.
+ * Apply revert patch 166:164. Upsream CJK patch broke umlaute.
+ (closes: #381386, #382250)
-- Kenshi Muto <kmuto at debian.org> Thu, 10 Aug 2006 18:33:07 +0900
Modified: gs-esp/trunk/debian/patches/00list
==============================================================================
--- gs-esp/trunk/debian/patches/00list (original)
+++ gs-esp/trunk/debian/patches/00list Sun Aug 20 08:11:46 2006
@@ -6,3 +6,4 @@
#05_krgb_1.2
06_kfreebsd_buildfix
07_cmap_post_table
+08_revert_cjk
Added: gs-esp/trunk/debian/patches/08_revert_cjk.dpatch
==============================================================================
--- (empty file)
+++ gs-esp/trunk/debian/patches/08_revert_cjk.dpatch Sun Aug 20 08:11:46 2006
@@ -0,0 +1,572 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 08_revert_cjk.dpatch by Kenshi Muto <kmuto at debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: No description.
+
+ at DPATCH@
+diff -urNad gs-esp-8.15.2.dfsg.1~/src/gdevpdtc.c gs-esp-8.15.2.dfsg.1/src/gdevpdtc.c
+--- gs-esp-8.15.2.dfsg.1~/src/gdevpdtc.c 2006-08-20 13:55:04.000000000 +0900
++++ gs-esp-8.15.2.dfsg.1/src/gdevpdtc.c 2006-08-20 13:55:39.000000000 +0900
+@@ -653,13 +653,23 @@
+ if (pdsubf->u.cidfont.glyphshow_font_id != 0)
+ font0 = (gs_font_type0 *)gs_find_font_by_id(font->dir,
+ pdsubf->u.cidfont.glyphshow_font_id, &scaled_font->FontMatrix);
+- if (font0 == NULL) {
++#if 1 /* XXX */
++ if (font0 == NULL || font0->WMode != scaled_font->WMode) {
++ code = gs_font_type0_from_cidfont(&font0, font, scaled_font->WMode,
++ &scale_matrix, font->memory);
++ if (code < 0)
++ return code;
++ pdsubf->u.cidfont.glyphshow_font_id = font0->id;
++ font0->WMode = scaled_font->WMode; /* should not be here? */
++ }
++#else if (font0 == NULL) {
+ code = gs_font_type0_from_cidfont(&font0, font, font->WMode,
+ &scale_matrix, font->memory);
+ if (code < 0)
+ return code;
+ pdsubf->u.cidfont.glyphshow_font_id = font0->id;
+ }
++#endif
+
+ /* Now handle the glyphshow as a show in the Type 0 font. */
+
+diff -urNad gs-esp-8.15.2.dfsg.1~/src/gdevpdtt.c gs-esp-8.15.2.dfsg.1/src/gdevpdtt.c
+--- gs-esp-8.15.2.dfsg.1~/src/gdevpdtt.c 2006-08-20 13:55:04.000000000 +0900
++++ gs-esp-8.15.2.dfsg.1/src/gdevpdtt.c 2006-08-20 13:55:39.000000000 +0900
+@@ -1802,6 +1802,11 @@
+ pwidths->Width.xy.y;
+ pwidths->Width.v.x = - pwidths->Width.xy.y / 2;
+ pwidths->Width.v.y = - pwidths->Width.xy.y;
++#if 1 /* XXX */
++ /* pwidths->Width.v.y *= 0.84; should use ascent/descent ratio */
++ pwidths->Width.v.y *=
++ cfont->FontBBox.q.y/(-cfont->FontBBox.p.y+cfont->FontBBox.q.y);
++#endif
+ } else {
+ pwidths->Width.xy.x = pwidths->real_width.xy.x =
+ finfo.MissingWidth * scale_c;
+@@ -1880,8 +1885,39 @@
+
+ if (get_missing_width(cfont, 0, scale_c, &widths1) < 0)
+ v.x = 0;
++#if 1 /* XXX */ /* Adobe-Japan specific */
++#define in_cid(s,e,cid,g) \
++ ((gs_min_cid_glyph + cid) <= g && g <= (gs_min_cid_glyph + cid + e - s))
++#define Roman(g) in_cid(0x20, 0x7e, 231, g)
++#define Hankaku(g) \
++ (in_cid(0x20, 0x5f, 231, g) || in_cid(0x60, 0x60, 231, g) || \
++ in_cid(0x61, 0x7e, 296, g) || in_cid(0x81, 0x85, 327, g) || \
++ in_cid(0x86, 0x8f, 516, g) || in_cid(0x90, 0x90, 342, g) || \
++ in_cid(0x91, 0x9f, 526, g) || in_cid(0xa1, 0xdf, 327, g) || \
++ in_cid(0xe0, 0xfd, 541, g) || in_cid(0xfe, 0xff, 388, g))
++#define Hiragana(g) \
++ (in_cid(0x20, 0x20, 515, g) || in_cid(0x21, 0x25, 327, g) || \
++ in_cid(0x26, 0x2f, 516, g) || in_cid(0x30, 0x30, 342, g) || \
++ in_cid(0x31, 0x5d, 526, g) || in_cid(0x5e, 0x5f, 388, g) || \
++ in_cid(0x60, 0x62, 571, g) || in_cid(0x66, 0x7e, 574, g))
++
++#define adobe_japan_ascii(fp, gly) \
++ fp->FontType == ft_CID_TrueType && \
++ ((gs_font_cid2*)fp)->cidata.common.CIDSystemInfo.Registry.size == 5 && \
++ !memcmp(((gs_font_cid2*)fp)->cidata.common.CIDSystemInfo.Registry.data,"Adobe",5) && \
++ ((gs_font_cid2*)fp)->cidata.common.CIDSystemInfo.Ordering.size == 6 && \
++ !memcmp(((gs_font_cid2*)fp)->cidata.common.CIDSystemInfo.Ordering.data,"Japan1",6) && \
++ (Roman(gly) || Hankaku(gly) || Hiragana(gly))
++
++ else {
++ v.x = widths1.Width.w / 2;
++ if (adobe_japan_ascii(ofont,glyph))
++ v.x /= 2;
++ }
++#else
+ else
+ v.x = widths1.Width.w / 2;
++#endif
+ } else
+ v.x = pwidths->Width.v.x;
+ } else if (code < 0)
+@@ -1903,6 +1939,21 @@
+
+ if (get_missing_width(cfont, 0, scale_c, &widths1) < 0)
+ v.x = 0;
++#if 1 /* XXX */ /* Adobe-Japan specific */
++ else {
++ v.x = widths1.Width.w / 2;
++ if (adobe_japan_ascii(ofont,glyph))
++ v.x /= 2;
++ }
++#undef in_cid
++#undef Roman
++#undef Hankaku
++#undef Hiragana
++#undef adobe_japan_ascii
++#else
++ else
++ v.x = widths1.Width.w / 2;
++#endif
+ }
+ } else {
+ if (info.members & (GLYPH_INFO_VVECTOR0 << wmode)) {
+diff -urNad gs-esp-8.15.2.dfsg.1~/src/gstype42.c gs-esp-8.15.2.dfsg.1/src/gstype42.c
+--- gs-esp-8.15.2.dfsg.1~/src/gstype42.c 2006-08-20 13:55:04.000000000 +0900
++++ gs-esp-8.15.2.dfsg.1/src/gstype42.c 2006-08-20 13:55:39.000000000 +0900
+@@ -1,11 +1,3 @@
+-/*
+- * Modified by AXE,Inc., BBR Inc. and Turbolinux Inc.
+- * under the technical advice by suzuki toshiya (Hiroshima University)
+- * For questions, please send mail to espgs8-cjk at printing-japan.org
+- *
+- * (C) Copyright 2006 Center of the International Cooperation for
+- * Computerization
+- */
+ /* Copyright (C) 1996, 2000 Aladdin Enterprises. All rights reserved.
+
+ This software is provided AS-IS with no warranty, either express or
+@@ -154,6 +146,45 @@
+ pfont->data.metrics[1].offset = offset;
+ pfont->data.metrics[1].length = (uint)u32(tab + 12);
+ }
++#if 1 /* XXXX */
++ else if (!memcmp(tab, "mort", 4)) {
++ /* find vertical substitution */
++ byte *mort;
++
++ ACCESS(offset, 20, mort); /* length not accurate */
++ if ((uint)u32(mort) == 0x00010000) {
++ int nChains, i;
++ ulong Chainp = 8;
++
++ nChains = (int)u32(mort+4);
++ for (i=1; i <= nChains; i++) {
++ int nSub, j;
++ ulong Subp;
++
++ nSub = U16(mort+Chainp+10);
++ Subp = Chainp + U16(mort+Chainp+8)*12 + 12;
++ for (j=1; j <= nSub; j++) {
++ if ((U16(mort+Subp+2)&7) == 4) {
++ if ((U16(mort+Subp+8) == 6) &&
++ (U16(mort+Subp+10) == 4)) {
++ byte *ncgsv;
++ int cnt;
++ cnt = U16(mort+Subp+12);
++ ACCESS(offset+Subp+20, cnt*4, ncgsv);
++ if (!pfont->data.mort_ncgsv_off) {
++ pfont->data.mort_ncgsv_off = offset+Subp+20;
++ pfont->data.mort_ncgsv_len = cnt*4;
++ } else
++ dlprintf("multiple ncgsv ignored.\n");
++ }
++ }
++ Subp += U16(mort+Subp);
++ }
++ Chainp += (int)u32(mort+Chainp+4);
++ }
++ }
++ }
++#endif
+ }
+ loca_size >>= pfont->data.indexToLocFormat + 1;
+ pfont->data.numGlyphs = (loca_size == 0 ? 0 : loca_size - 1);
+@@ -175,6 +206,20 @@
+ pfont->FontBBox.q.x = S16(head_box + 4) / upem;
+ pfont->FontBBox.q.y = S16(head_box + 6) / upem;
+ }
++#if 1 /* XXX */
++ if (! pfont->data.metrics[1].offset) {
++ /* no vhea/vmtx
++ * shrink/expand the height to 1.0
++ */
++ float v;
++ v = - pfont->FontBBox.p.y + pfont->FontBBox.q.y;
++ pfont->FontBBox.p.y /= v;
++ pfont->FontBBox.q.y /= v;
++
++ pfont->FontBBox.p.x /= v;
++ pfont->FontBBox.q.x /= v;
++ }
++#endif
+ #if NEW_TT_INTERPRETER
+ pfont->data.warning_patented = false;
+ pfont->data.warning_bad_instruction = false;
+@@ -528,49 +573,6 @@
+ origin.y + float2fixed(info.width[WMode].y));
+ }
+
+-/* Get glyph bounding box from font file */
+-int
+-gs_type42_glyph_fbbox(gs_font *font, uint glyph_index, gs_rect *pbbox)
+-{
+- gs_font_type42 *const pfont = (gs_font_type42 *)font;
+- gs_glyph_data_t glyph_data;
+- double factor = 1.0 / pfont->data.unitsPerEm;
+- int code = 0;
+- const byte *gdata;
+-
+- if ((code = pfont->data.get_outline(pfont, glyph_index, &glyph_data)) < 0) {
+- return code; /* non-existent glyph */
+- }
+- if (glyph_data.bits.size == 0) {
+- return 1; /* notdef */
+- }
+- if (glyph_data.bits.size != 0 && S16(glyph_data.bits.data) == -1) {
+- /* This is a composite glyph. */
+- uint flags;
+- gs_matrix_fixed mat;
+-
+- gdata = glyph_data.bits.data + 10;
+- memset(&mat, 0, sizeof(mat)); /* arbitrary */
+- do {
+- uint comp_index = U16(gdata + 2);
+-
+- parse_component(&gdata, &flags, &mat, NULL, pfont, &mat);
+- if (flags & TT_CG_USE_MY_METRICS) {
+- code = gs_type42_glyph_fbbox(pfont, comp_index,pbbox);
+- goto done;
+- }
+- }
+- while (flags & TT_CG_MORE_COMPONENTS);
+- }
+- gdata = glyph_data.bits.data;
+- pbbox->p.x = S16(gdata+2)*factor;
+- pbbox->p.y = S16(gdata+4)*factor;
+- pbbox->q.x = S16(gdata+6)*factor;
+- pbbox->q.y = S16(gdata+8)*factor;
+-done:
+- gs_glyph_data_free(&glyph_data, "gs_type42_enumerate_glyph");
+- return code;
+-}
+ /* Get glyph info by glyph index. */
+ int
+ gs_type42_glyph_info_by_gid(gs_font *font, gs_glyph glyph, const gs_matrix *pmat,
+diff -urNad gs-esp-8.15.2.dfsg.1~/src/gxfont42.h gs-esp-8.15.2.dfsg.1/src/gxfont42.h
+--- gs-esp-8.15.2.dfsg.1~/src/gxfont42.h 2006-08-20 13:55:04.000000000 +0900
++++ gs-esp-8.15.2.dfsg.1/src/gxfont42.h 2006-08-20 13:55:39.000000000 +0900
+@@ -1,11 +1,3 @@
+-/*
+- * Modified by AXE,Inc., BBR Inc. and Turbolinux Inc.
+- * under the technical advice by suzuki toshiya (Hiroshima University)
+- * For questions, please send mail to espgs8-cjk at printing-japan.org
+- *
+- * (C) Copyright 2006 Center of the International Cooperation for
+- * Computerization
+- */
+ /* Copyright (C) 1996, 2000, 2001 Aladdin Enterprises. All rights reserved.
+
+ This software is provided AS-IS with no warranty, either express or
+@@ -92,6 +84,13 @@
+ bool warning_patented;
+ bool warning_bad_instruction;
+ #endif
++#if 1 /* XXXX */
++ /*
++ * to find out glyph substitution
++ */
++ uint mort_ncgsv_off; /* vertical substition entry offset */
++ uint mort_ncgsv_len; /* total number of bytes (4*#) */
++#endif
+ };
+ #define gs_font_type42_common\
+ gs_font_base_common;\
+@@ -138,9 +137,6 @@
+ int gs_type42_get_outline_from_TT_file(gs_font_type42 * pfont, stream *s, uint glyph_index,
+ gs_glyph_data_t *pgd);
+
+-/* Export the function get glypf bounding box from font data */
+-int gs_type42_glyph_fbbox(gs_font *font, uint glyph_index, gs_rect *pbbox);
+-
+ /* Export the font procedures so they can be called from the interpreter. */
+ font_proc_enumerate_glyph(gs_type42_enumerate_glyph);
+ font_proc_glyph_info(gs_type42_glyph_info);
+diff -urNad gs-esp-8.15.2.dfsg.1~/src/zcfont.c gs-esp-8.15.2.dfsg.1/src/zcfont.c
+--- gs-esp-8.15.2.dfsg.1~/src/zcfont.c 2006-08-20 13:55:04.000000000 +0900
++++ gs-esp-8.15.2.dfsg.1/src/zcfont.c 2006-08-20 13:55:39.000000000 +0900
+@@ -127,6 +127,10 @@
+ if (code < 0)
+ return code;
+ }
++#if 1 /* XXX */
++ if (scaled_font != root_font)
++ scaled_font->WMode = root_font->WMode; /* need for pdfwrite */
++#endif
+ push(3);
+ make_int(op - 2, gs_text_current_char(penum) & 0xff);
+ make_real(op - 1, wpt.x);
+diff -urNad gs-esp-8.15.2.dfsg.1~/src/zchar1.c gs-esp-8.15.2.dfsg.1/src/zchar1.c
+--- gs-esp-8.15.2.dfsg.1~/src/zchar1.c 2006-08-20 13:55:04.000000000 +0900
++++ gs-esp-8.15.2.dfsg.1/src/zchar1.c 2006-08-20 13:55:39.000000000 +0900
+@@ -1,12 +1,3 @@
+-/*
+- * Modified by AXE,Inc., BBR Inc. and Turbolinux Inc.
+- * under the technical advice by suzuki toshiya (Hiroshima University)
+- * Based on bugfix by Hideo Saito, 2001.
+- * For questions, please send mail to espgs8-cjk at printing-japan.org
+- *
+- * (C) Copyright 2006 Center of the International Cooperation for
+- * Computerization
+- */
+ /* Copyright (C) 1993, 2000, 2002 Aladdin Enterprises. All rights reserved.
+
+ This software is provided AS-IS with no warranty, either express or
+@@ -249,7 +240,6 @@
+ cxs.sbw[2] = 0;
+ cxs.sbw[3] = -penum->FontBBox_as_Metrics2.x; /* Sic! */
+ cxs.use_FontBBox_as_Metrics2 = true;
+- cxs.present = metricsSideBearingAndWidth;
+ }
+ /* Establish a current point. */
+ code = gs_moveto(igs, 0.0, 0.0);
+@@ -282,8 +272,7 @@
+ const ref *opstr = op;
+ ref other_subr;
+
+- if (cxs.present == metricsSideBearingAndWidth
+- && !cxs.use_FontBBox_as_Metrics2) {
++ if (cxs.present == metricsSideBearingAndWidth) {
+ gs_point sbpt;
+
+ sbpt.x = cxs.sbw[0], sbpt.y = cxs.sbw[1];
+@@ -360,48 +349,11 @@
+ } else {
+ /* We have the width and bounding box: */
+ /* set up the cache device now. */
+- double w[2];
+- w[0] = pcxs->sbw[2], w[1] = pcxs->sbw[3];
+-
+- if (pcxs->use_FontBBox_as_Metrics2) {
+- /* In this case, we have to calculate width for WMode=0.
+- pcxs->sbw[2, 3] is width for WMode=1.
+- Normally, the width for WMode=0 is not used in WMode=1
+- rendering. However, if CDevProc is defined,
+- the width for WMode=0 is used.
+- Do the same as the case pcxs->present == metricsNone */
+- double sbw[4];
+- ref cnref;
+- ref other_subr;
+- int code;
+-
+- /* Since an OtherSubr callout might change osp, */
+- /* save the character name now. */
+- ref_assign(&cnref, op - 1);
+- code = type1_continue_dispatch(i_ctx_p, pcxs, op, &other_subr, 4);
+- op = osp; /* OtherSubrs might change it */
+- switch (code) {
+- default: /* code < 0 or done, error */
+- return ((code < 0 ? code :
+- gs_note_error(e_invalidfont)));
+- case type1_result_callothersubr: /* unknown OtherSubr */
+- return type1_call_OtherSubr(i_ctx_p, pcxs,
+- bbox_getsbw_continue,
+- &other_subr);
+- case type1_result_sbw: /* [h]sbw, done */
+- break;
+- }
+- type1_cis_get_metrics(pcis, sbw);
+- w[0] = sbw[2], w[1] = sbw[3];
+- /* Now actual width is available, I can calculate much
+- better side bearing for WMode 1 from the width. */
+- pcxs->sbw[0] = w[0] / 2;
+- }
+ return zchar_set_cache(i_ctx_p, pbfont, op - 1,
+ (pcxs->present == metricsSideBearingAndWidth
+ && !pcxs->use_FontBBox_as_Metrics2 ?
+ pcxs->sbw : NULL),
+- w,
++ pcxs->sbw + 2,
+ &pcxs->char_bbox,
+ cont, exec_cont,
+ (pcxs->use_FontBBox_as_Metrics2 ? pcxs->sbw : NULL));
+@@ -629,7 +581,7 @@
+ code = type1_exec_init(&cxs.cis, penum, igs, pfont1);
+ if (code < 0)
+ return code;
+- cxs.char_bbox = bbox;
++ cxs.char_bbox = pfont1->FontBBox;
+ code = type1exec_bbox(i_ctx_p, &cxs, pfont, exec_cont);
+ return code;
+ }
+@@ -843,7 +795,6 @@
+ int code;
+ gs_text_enum_t *penum = op_show_find(i_ctx_p);
+ gs_font *pfont;
+- double w[2];
+
+ if ((code = gs_pathbbox(igs, &pcxs->char_bbox)) < 0 ||
+ (code = font_param(op - 3, &pfont)) < 0
+@@ -856,24 +807,13 @@
+ gs_font_type1 *const pfont1 = (gs_font_type1 *) pfont;
+ op_proc_t cont, exec_cont = 0;
+
+- if (pcxs->present == metricsNone
+- || pcxs->use_FontBBox_as_Metrics2) {
++ if (pcxs->present == metricsNone) {
+ gs_point endpt;
+
+ if ((code = gs_currentpoint(igs, &endpt)) < 0)
+ return code;
+- /* We will not use sbw[3, 4].
+- If pcxs->use_FontBBox_as_Metrics2 is true,
+- sbw[3, 4] are used as arguments(W1x, W1y) of setcachedevice2.
+- We will use w[0, 1] as W0x and W0y of setcachedevice2.
+- W0 and W1 is differrent parameters. Don't confuse. */
+- w[0] = endpt.x, w[1] = endpt.y;
++ pcxs->sbw[2] = endpt.x, pcxs->sbw[3] = endpt.y;
+ pcxs->present = metricsSideBearingAndWidth;
+- if (pcxs->use_FontBBox_as_Metrics2) {
+- /* Now actual width is available, I can calculate much
+- better side bearing for WMode 1 from the width. */
+- pcxs->sbw[0] = w[0] / 2;
+- }
+ }
+ /*
+ * We only need to rebuild the path from scratch if we might
+@@ -890,7 +830,7 @@
+ } else {
+ cont = (pbfont->PaintType == 0 ? nobbox_fill : nobbox_stroke), exec_cont = 0;
+ code = zchar_set_cache(i_ctx_p, pbfont, op - 1, NULL,
+- w,
++ pcxs->sbw + 2,
+ &pcxs->char_bbox,
+ cont, &exec_cont,
+ (pcxs->use_FontBBox_as_Metrics2 ? pcxs->sbw : NULL));
+diff -urNad gs-esp-8.15.2.dfsg.1~/src/zchar42.c gs-esp-8.15.2.dfsg.1/src/zchar42.c
+--- gs-esp-8.15.2.dfsg.1~/src/zchar42.c 2006-08-20 13:55:04.000000000 +0900
++++ gs-esp-8.15.2.dfsg.1/src/zchar42.c 2006-08-20 13:55:39.000000000 +0900
+@@ -1,12 +1,3 @@
+-/*
+- * Modified by AXE,Inc., BBR Inc. and Turbolinux Inc.
+- * under the technical advice by suzuki toshiya (Hiroshima University)
+- * Based on bugfix by Masatake Yamato and Hideo Saito, 2001.
+- * For questions, please send mail to espgs8-cjk at printing-japan.org
+- *
+- * (C) Copyright 2006 Center of the International Cooperation for
+- * Computerization
+- */
+ /* Copyright (C) 1996, 1997, 1998, 1999 Aladdin Enterprises. All rights reserved.
+
+ This software is provided AS-IS with no warranty, either express or
+@@ -53,15 +44,8 @@
+ { double sbw[4];
+ double w[2];
+ int present;
+- gs_rect bbox, *pbbox;
+- int code = gs_type42_glyph_fbbox(pbfont, glyph_index, &bbox);
++ int code = zchar_get_metrics(pbfont, cnref, sbw);
+
+- if (code != 0) {
+- pbbox = &pbfont->FontBBox;
+- } else {
+- pbbox = &bbox;
+- }
+- code = zchar_get_metrics(pbfont, cnref, sbw);
+ if (code < 0)
+ return code;
+ present = code;
+@@ -91,7 +75,7 @@
+ }
+ } else {
+ sbw[0] = sbw[2] / 2;
+- sbw[1] = pbbox->q.y - sbw42[1];
++ sbw[1] = (pbfont->FontBBox.q.y + pbfont->FontBBox.p.y - sbw42[3]) / 2;
+ sbw[2] = sbw42[2];
+ sbw[3] = sbw42[3];
+ }
+@@ -103,7 +87,7 @@
+ return zchar_set_cache(i_ctx_p, pbfont, cnref,
+ (put_lsb && present == metricsSideBearingAndWidth ?
+ sbw : NULL),
+- w, pbbox,
++ w, &pbfont->FontBBox,
+ cont, exec_cont,
+ gs_rootfont(igs)->WMode ? sbw : NULL);
+ }
+diff -urNad gs-esp-8.15.2.dfsg.1~/src/zfcid1.c gs-esp-8.15.2.dfsg.1/src/zfcid1.c
+--- gs-esp-8.15.2.dfsg.1~/src/zfcid1.c 2006-08-20 13:55:04.000000000 +0900
++++ gs-esp-8.15.2.dfsg.1/src/zfcid1.c 2006-08-20 13:55:39.000000000 +0900
+@@ -35,6 +35,10 @@
+ #include "stream.h"
+ #include "files.h"
+
++#if 1 /* XXXX */
++private uint z11_find_repl_glyph(gs_font_cid2 *, uint);
++#endif
++
+ /* ---------------- CIDFontType 1 (FontType 10) ---------------- */
+
+ /* <string|name> <font_dict> .buildfont10 <string|name> <font> */
+@@ -67,6 +71,28 @@
+
+ /* ------ Accessing ------ */
+
++/* Replace a glyph with a vertical substitution */
++private uint
++z11_find_repl_glyph(gs_font_cid2 *pfont, uint glyph)
++{
++ int i;
++ const byte *data;
++
++ if (pfont->data.mort_ncgsv_off == 0)
++ return glyph;
++
++ if ((*pfont->data.string_proc)((gs_font_type42*)pfont,
++ (ulong)pfont->data.mort_ncgsv_off,
++ pfont->data.mort_ncgsv_len, &data) == 0) {
++ for (i=0; i < pfont->data.mort_ncgsv_len; i += 4) {
++ if (((data[i]<<8)+data[i+1]) == glyph) {
++ return (uint)((data[i+2]<<8)+data[i+3]);
++ }
++ }
++ }
++ return glyph;
++}
++
+ /* Map a glyph CID to a TrueType glyph number using the CIDMap. */
+ private int
+ z11_CIDMap_proc(gs_font_cid2 *pfont, gs_glyph glyph)
+@@ -107,6 +133,43 @@
+ }
+ for (i = 0; i < gdbytes; ++i)
+ gnum = (gnum << 8) + data[i];
++#if 1 /* XXXX */
++ if ( gnum != 0 &&
++ pfont->cidata.common.CIDSystemInfo.Registry.size == 5 &&
++ !memcmp(pfont->cidata.common.CIDSystemInfo.Registry.data,"Adobe",5) &&
++ pfont->cidata.common.CIDSystemInfo.Ordering.size == 6 &&
++ !memcmp(pfont->cidata.common.CIDSystemInfo.Ordering.data,"Japan1",6)) {
++ uint gnum0 = gnum;
++
++ /* ps string represented in EUC/ShiftJIS are mapped to CID string,
++ * while certain characters (e.g. 0xa1c4) are mapped to different CID
++ * (668 or 7897) depending on WMode(0 or 1).
++ * But, when CID characters are mapped to ShiftJIS/Unicode to get
++ * corresponding TTF glyphs, certain CID characters are mapped to
++ * glyphs valid for horizonal writing
++ * (there is no choice in ShiftJIS encoded TTF), using Resource/CMap
++ *
++ * Following code maps certain CID (for vertical writing chars)
++ * to glyphs for vertical writing regardless of WMode!
++ * This automatic mapping enables generating PDF of vertical writing.
++ *
++ * fixme: range correct?
++ */
++ if (7887 <= cid && cid <= 7960) {
++ /* substitute a glyph for vertical writing cid character */
++ gnum = z11_find_repl_glyph(pfont, gnum);
++ }
++ if (gnum != gnum0) {
++ if (gs_debug_c('J'))
++ dlprintf3("[J]z11_CIDMap_proc(): cid:%d -> %d -> %d\n",
++ cid, gnum0, gnum);
++ } else if (gs_debug_c('J')) {
++ dlprintf2("[J]z11_CIDMap_proc(): cid:%d -> %d\n", cid, gnum);
++ }
++ } else if (gs_debug_c('J')) {
++ dlprintf2("[J]z11_CIDMap_proc(): cid:%d -> %d\n", cid, gnum);
++ }
++#endif
+ return gnum;
+ }
+
More information about the Pkg-gs-devel
mailing list