Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 144769 | Differences between
and this patch

Collapse All | Expand All

(-)src/gdevpdtc.c (-1 / +11 lines)
Lines 653-665 Link Here
653
    if (pdsubf->u.cidfont.glyphshow_font_id != 0)
653
    if (pdsubf->u.cidfont.glyphshow_font_id != 0)
654
 	font0 = (gs_font_type0 *)gs_find_font_by_id(font->dir, 
654
 	font0 = (gs_font_type0 *)gs_find_font_by_id(font->dir, 
655
 		    pdsubf->u.cidfont.glyphshow_font_id, &scaled_font->FontMatrix);
655
 		    pdsubf->u.cidfont.glyphshow_font_id, &scaled_font->FontMatrix);
656
    if (font0 == NULL) {
656
#if 1 /* XXX */
657
    if (font0 == NULL || font0->WMode != scaled_font->WMode) {
658
  	code = gs_font_type0_from_cidfont(&font0, font, scaled_font->WMode,
659
 					  &scale_matrix, font->memory);
660
	if (code < 0)
661
	    return code;
662
 	pdsubf->u.cidfont.glyphshow_font_id = font0->id;
663
 	font0->WMode = scaled_font->WMode; /* should not be here? */
664
    }
665
#else    if (font0 == NULL) {
657
  	code = gs_font_type0_from_cidfont(&font0, font, font->WMode,
666
  	code = gs_font_type0_from_cidfont(&font0, font, font->WMode,
658
 					  &scale_matrix, font->memory);
667
 					  &scale_matrix, font->memory);
659
	if (code < 0)
668
	if (code < 0)
660
	    return code;
669
	    return code;
661
 	pdsubf->u.cidfont.glyphshow_font_id = font0->id;
670
 	pdsubf->u.cidfont.glyphshow_font_id = font0->id;
662
    }
671
    }
672
#endif
663
673
664
    /* Now handle the glyphshow as a show in the Type 0 font. */
674
    /* Now handle the glyphshow as a show in the Type 0 font. */
665
675
(-)src/gdevpdtt.c (+51 lines)
Lines 1802-1807 Link Here
1802
		pwidths->Width.xy.y;
1802
		pwidths->Width.xy.y;
1803
	pwidths->Width.v.x = - pwidths->Width.xy.y / 2;
1803
	pwidths->Width.v.x = - pwidths->Width.xy.y / 2;
1804
	pwidths->Width.v.y = - pwidths->Width.xy.y;
1804
	pwidths->Width.v.y = - pwidths->Width.xy.y;
1805
#if 1 /* XXX */
1806
	/* pwidths->Width.v.y *= 0.84; should use ascent/descent ratio */
1807
	pwidths->Width.v.y *=
1808
		cfont->FontBBox.q.y/(-cfont->FontBBox.p.y+cfont->FontBBox.q.y);
1809
#endif
1805
    } else {
1810
    } else {
1806
	pwidths->Width.xy.x = pwidths->real_width.xy.x =
1811
	pwidths->Width.xy.x = pwidths->real_width.xy.x =
1807
		finfo.MissingWidth * scale_c;
1812
		finfo.MissingWidth * scale_c;
Lines 1880-1887 Link Here
1880
1885
1881
	    if (get_missing_width(cfont, 0, scale_c, &widths1) < 0)
1886
	    if (get_missing_width(cfont, 0, scale_c, &widths1) < 0)
1882
		v.x = 0;
1887
		v.x = 0;
1888
#if 1 /* XXX */	/* Adobe-Japan specific */
1889
#define in_cid(s,e,cid,g) \
1890
    ((gs_min_cid_glyph + cid) <= g && g <= (gs_min_cid_glyph + cid + e - s))
1891
#define Roman(g) in_cid(0x20, 0x7e, 231, g)
1892
#define Hankaku(g) \
1893
    (in_cid(0x20, 0x5f, 231, g) || in_cid(0x60, 0x60, 231, g) || \
1894
     in_cid(0x61, 0x7e, 296, g) || in_cid(0x81, 0x85, 327, g) || \
1895
     in_cid(0x86, 0x8f, 516, g) || in_cid(0x90, 0x90, 342, g) || \
1896
     in_cid(0x91, 0x9f, 526, g) || in_cid(0xa1, 0xdf, 327, g) || \
1897
     in_cid(0xe0, 0xfd, 541, g) || in_cid(0xfe, 0xff, 388, g))
1898
#define Hiragana(g) \
1899
    (in_cid(0x20, 0x20, 515, g) || in_cid(0x21, 0x25, 327, g) || \
1900
     in_cid(0x26, 0x2f, 516, g) || in_cid(0x30, 0x30, 342, g) || \
1901
     in_cid(0x31, 0x5d, 526, g) || in_cid(0x5e, 0x5f, 388, g) || \
1902
     in_cid(0x60, 0x62, 571, g) || in_cid(0x66, 0x7e, 574, g))
1903
1904
#define adobe_japan_ascii(fp, gly) \
1905
    fp->FontType == ft_CID_TrueType && \
1906
    ((gs_font_cid2*)fp)->cidata.common.CIDSystemInfo.Registry.size == 5 && \
1907
    !memcmp(((gs_font_cid2*)fp)->cidata.common.CIDSystemInfo.Registry.data,"Adobe",5) && \
1908
     ((gs_font_cid2*)fp)->cidata.common.CIDSystemInfo.Ordering.size == 6 && \
1909
    !memcmp(((gs_font_cid2*)fp)->cidata.common.CIDSystemInfo.Ordering.data,"Japan1",6) && \
1910
    (Roman(gly) || Hankaku(gly) || Hiragana(gly))
1911
1912
	    else {
1913
		v.x = widths1.Width.w / 2;
1914
		if (adobe_japan_ascii(ofont,glyph))
1915
		    v.x /= 2;
1916
	    }
1917
#else
1883
	    else
1918
	    else
1884
		v.x = widths1.Width.w / 2;
1919
		v.x = widths1.Width.w / 2;
1920
#endif
1885
	} else
1921
	} else
1886
	    v.x = pwidths->Width.v.x;
1922
	    v.x = pwidths->Width.v.x;
1887
    } else if (code < 0)
1923
    } else if (code < 0)
Lines 1903-1908 Link Here
1903
		
1939
		
1904
		if (get_missing_width(cfont, 0, scale_c, &widths1) < 0)
1940
		if (get_missing_width(cfont, 0, scale_c, &widths1) < 0)
1905
		    v.x = 0;
1941
		    v.x = 0;
1942
#if 1 /* XXX */	/* Adobe-Japan specific */
1943
		else {
1944
		    v.x = widths1.Width.w / 2;
1945
		    if (adobe_japan_ascii(ofont,glyph))
1946
			v.x /= 2;
1947
		}
1948
#undef in_cid
1949
#undef Roman
1950
#undef Hankaku
1951
#undef Hiragana
1952
#undef adobe_japan_ascii
1953
#else
1954
		else
1955
		    v.x = widths1.Width.w / 2;
1956
#endif
1906
	    }
1957
	    }
1907
	} else {
1958
	} else {
1908
	    if (info.members  & (GLYPH_INFO_VVECTOR0 << wmode)) {
1959
	    if (info.members  & (GLYPH_INFO_VVECTOR0 << wmode)) {
(-)src/gstype42.c (-51 / +53 lines)
Lines 1-11 Link Here
1
/*
2
 * Modified by AXE,Inc., BBR Inc. and Turbolinux Inc.
3
 *   under the technical advice by suzuki toshiya (Hiroshima University)
4
 * For questions, please send mail to espgs8-cjk@printing-japan.org
5
 *
6
 * (C) Copyright 2006 Center of the International Cooperation for
7
 *     Computerization
8
 */
9
/* Copyright (C) 1996, 2000 Aladdin Enterprises.  All rights reserved.
1
/* Copyright (C) 1996, 2000 Aladdin Enterprises.  All rights reserved.
10
  
2
  
11
  This software is provided AS-IS with no warranty, either express or
3
  This software is provided AS-IS with no warranty, either express or
Lines 154-159 Link Here
154
	    pfont->data.metrics[1].offset = offset;
146
	    pfont->data.metrics[1].offset = offset;
155
	    pfont->data.metrics[1].length = (uint)u32(tab + 12);
147
	    pfont->data.metrics[1].length = (uint)u32(tab + 12);
156
	}
148
	}
149
#if 1 /* XXXX */
150
	else if (!memcmp(tab, "mort", 4)) {
151
	    /* find vertical substitution */
152
	    byte *mort;
153
154
	    ACCESS(offset, 20, mort);	/* length not accurate */
155
	    if ((uint)u32(mort) == 0x00010000) {
156
		int nChains, i;
157
		ulong Chainp = 8;
158
159
		nChains = (int)u32(mort+4);
160
		for (i=1; i <= nChains; i++) {
161
		  int nSub, j;
162
		  ulong Subp;
163
164
		  nSub = U16(mort+Chainp+10);
165
		  Subp = Chainp + U16(mort+Chainp+8)*12 + 12;
166
		  for (j=1; j <= nSub; j++) {
167
		     if ((U16(mort+Subp+2)&7) == 4) {
168
			if ((U16(mort+Subp+8) == 6) &&
169
			    (U16(mort+Subp+10) == 4)) {
170
			  byte *ncgsv;
171
			  int  cnt;
172
			  cnt = U16(mort+Subp+12);
173
			  ACCESS(offset+Subp+20, cnt*4, ncgsv);
174
			  if (!pfont->data.mort_ncgsv_off) {
175
			    pfont->data.mort_ncgsv_off = offset+Subp+20;
176
			    pfont->data.mort_ncgsv_len = cnt*4;
177
			  } else
178
			    dlprintf("multiple ncgsv ignored.\n");
179
			}
180
		     }
181
		     Subp += U16(mort+Subp);
182
		  }
183
		  Chainp += (int)u32(mort+Chainp+4);
184
		}
185
	    }
186
	}
187
#endif
157
    }
188
    }
158
    loca_size >>= pfont->data.indexToLocFormat + 1;
189
    loca_size >>= pfont->data.indexToLocFormat + 1;
159
    pfont->data.numGlyphs = (loca_size == 0 ? 0 : loca_size - 1);
190
    pfont->data.numGlyphs = (loca_size == 0 ? 0 : loca_size - 1);
Lines 175-180 Link Here
175
	pfont->FontBBox.q.x = S16(head_box + 4) / upem;
206
	pfont->FontBBox.q.x = S16(head_box + 4) / upem;
176
	pfont->FontBBox.q.y = S16(head_box + 6) / upem;
207
	pfont->FontBBox.q.y = S16(head_box + 6) / upem;
177
    }
208
    }
209
#if 1 /* XXX */
210
    if (! pfont->data.metrics[1].offset) {
211
	/* no vhea/vmtx
212
	 * shrink/expand the height to 1.0
213
 	 */
214
	float v;
215
	v = - pfont->FontBBox.p.y + pfont->FontBBox.q.y;
216
	    pfont->FontBBox.p.y /= v;
217
	    pfont->FontBBox.q.y /= v;
218
219
	    pfont->FontBBox.p.x /= v;
220
	    pfont->FontBBox.q.x /= v;
221
    }
222
#endif
178
#if NEW_TT_INTERPRETER
223
#if NEW_TT_INTERPRETER
179
    pfont->data.warning_patented = false;
224
    pfont->data.warning_patented = false;
180
    pfont->data.warning_bad_instruction = false;
225
    pfont->data.warning_bad_instruction = false;
Lines 528-576 Link Here
528
			     origin.y + float2fixed(info.width[WMode].y));
573
			     origin.y + float2fixed(info.width[WMode].y));
529
}
574
}
530
575
531
/* Get glyph bounding box from font file */
532
int
533
gs_type42_glyph_fbbox(gs_font *font, uint glyph_index, gs_rect *pbbox)
534
{
535
    gs_font_type42 *const pfont = (gs_font_type42 *)font;
536
    gs_glyph_data_t glyph_data;
537
    double factor = 1.0 / pfont->data.unitsPerEm;
538
    int code = 0;
539
    const byte *gdata;
540
541
    if ((code = pfont->data.get_outline(pfont, glyph_index, &glyph_data)) < 0) {
542
	return code;		/* non-existent glyph */
543
    }
544
    if (glyph_data.bits.size == 0) {
545
	return 1; /* notdef */
546
    }
547
    if (glyph_data.bits.size != 0 && S16(glyph_data.bits.data) == -1) {
548
	/* This is a composite glyph. */
549
	uint flags;
550
	gs_matrix_fixed mat;
551
552
	gdata = glyph_data.bits.data + 10;
553
	memset(&mat, 0, sizeof(mat)); /* arbitrary */
554
	do {
555
	    uint comp_index = U16(gdata + 2);
556
557
	    parse_component(&gdata, &flags, &mat, NULL, pfont, &mat);
558
	    if (flags & TT_CG_USE_MY_METRICS) {
559
		code = gs_type42_glyph_fbbox(pfont, comp_index,pbbox);
560
		goto done;
561
	    }
562
	}
563
	while (flags & TT_CG_MORE_COMPONENTS);
564
    }
565
    gdata = glyph_data.bits.data;
566
    pbbox->p.x = S16(gdata+2)*factor;
567
    pbbox->p.y = S16(gdata+4)*factor;
568
    pbbox->q.x = S16(gdata+6)*factor;
569
    pbbox->q.y = S16(gdata+8)*factor;
570
done:
571
    gs_glyph_data_free(&glyph_data, "gs_type42_enumerate_glyph");
572
    return code;
573
}
574
/* Get glyph info by glyph index. */
576
/* Get glyph info by glyph index. */
575
int
577
int
576
gs_type42_glyph_info_by_gid(gs_font *font, gs_glyph glyph, const gs_matrix *pmat,
578
gs_type42_glyph_info_by_gid(gs_font *font, gs_glyph glyph, const gs_matrix *pmat,
(-)src/gxfont42.h (-11 / +7 lines)
Lines 1-11 Link Here
1
/*
2
 * Modified by AXE,Inc., BBR Inc. and Turbolinux Inc.
3
 *   under the technical advice by suzuki toshiya (Hiroshima University)
4
 * For questions, please send mail to espgs8-cjk@printing-japan.org
5
 *
6
 * (C) Copyright 2006 Center of the International Cooperation for
7
 *     Computerization
8
 */
9
/* Copyright (C) 1996, 2000, 2001 Aladdin Enterprises.  All rights reserved.
1
/* Copyright (C) 1996, 2000, 2001 Aladdin Enterprises.  All rights reserved.
10
  
2
  
11
  This software is provided AS-IS with no warranty, either express or
3
  This software is provided AS-IS with no warranty, either express or
Lines 92-97 Link Here
92
    bool warning_patented;
84
    bool warning_patented;
93
    bool warning_bad_instruction;
85
    bool warning_bad_instruction;
94
#endif
86
#endif
87
#if 1 /* XXXX */
88
    /*
89
     * to find out glyph substitution
90
     */
91
    uint mort_ncgsv_off;	/* vertical substition entry offset */
92
    uint mort_ncgsv_len;	/* total number of bytes (4*#) */
93
#endif
95
};
94
};
96
#define gs_font_type42_common\
95
#define gs_font_type42_common\
97
    gs_font_base_common;\
96
    gs_font_base_common;\
Lines 138-146 Link Here
138
int gs_type42_get_outline_from_TT_file(gs_font_type42 * pfont, stream *s, uint glyph_index,
137
int gs_type42_get_outline_from_TT_file(gs_font_type42 * pfont, stream *s, uint glyph_index,
139
		gs_glyph_data_t *pgd);
138
		gs_glyph_data_t *pgd);
140
139
141
/* Export the function get glypf bounding box from font data */
142
int gs_type42_glyph_fbbox(gs_font *font, uint glyph_index, gs_rect *pbbox);
143
144
/* Export the font procedures so they can be called from the interpreter. */
140
/* Export the font procedures so they can be called from the interpreter. */
145
font_proc_enumerate_glyph(gs_type42_enumerate_glyph);
141
font_proc_enumerate_glyph(gs_type42_enumerate_glyph);
146
font_proc_glyph_info(gs_type42_glyph_info);
142
font_proc_glyph_info(gs_type42_glyph_info);
(-)src/zcfont.c (+4 lines)
Lines 127-132 Link Here
127
	    if (code < 0)
127
	    if (code < 0)
128
		return code;
128
		return code;
129
	}
129
	}
130
#if 1 /* XXX */
131
	if (scaled_font != root_font)
132
	    scaled_font->WMode = root_font->WMode;	/* need for pdfwrite */
133
#endif
130
	push(3);
134
	push(3);
131
	make_int(op - 2, gs_text_current_char(penum) & 0xff);
135
	make_int(op - 2, gs_text_current_char(penum) & 0xff);
132
	make_real(op - 1, wpt.x);
136
	make_real(op - 1, wpt.x);
(-)src/zchar1.c (-66 / +6 lines)
Lines 1-12 Link Here
1
/*
2
 * Modified by AXE,Inc., BBR Inc. and Turbolinux Inc.
3
 *   under the technical advice by suzuki toshiya (Hiroshima University)
4
 * Based on bugfix by Hideo Saito, 2001.
5
 * For questions, please send mail to espgs8-cjk@printing-japan.org
6
 *
7
 * (C) Copyright 2006 Center of the International Cooperation for
8
 *     Computerization
9
 */
10
/* Copyright (C) 1993, 2000, 2002 Aladdin Enterprises.  All rights reserved.
1
/* Copyright (C) 1993, 2000, 2002 Aladdin Enterprises.  All rights reserved.
11
  
2
  
12
  This software is provided AS-IS with no warranty, either express or
3
  This software is provided AS-IS with no warranty, either express or
Lines 249-255 Link Here
249
	cxs.sbw[2] = 0;
240
	cxs.sbw[2] = 0;
250
	cxs.sbw[3] = -penum->FontBBox_as_Metrics2.x; /* Sic! */
241
	cxs.sbw[3] = -penum->FontBBox_as_Metrics2.x; /* Sic! */
251
	cxs.use_FontBBox_as_Metrics2 = true;
242
	cxs.use_FontBBox_as_Metrics2 = true;
252
	cxs.present = metricsSideBearingAndWidth;
253
    }
243
    }
254
    /* Establish a current point. */
244
    /* Establish a current point. */
255
    code = gs_moveto(igs, 0.0, 0.0);
245
    code = gs_moveto(igs, 0.0, 0.0);
Lines 282-289 Link Here
282
	const ref *opstr = op;
272
	const ref *opstr = op;
283
	ref other_subr;
273
	ref other_subr;
284
274
285
	if (cxs.present == metricsSideBearingAndWidth
275
	if (cxs.present == metricsSideBearingAndWidth) {
286
	    && !cxs.use_FontBBox_as_Metrics2) {
287
	    gs_point sbpt;
276
	    gs_point sbpt;
288
277
289
	    sbpt.x = cxs.sbw[0], sbpt.y = cxs.sbw[1];
278
	    sbpt.x = cxs.sbw[0], sbpt.y = cxs.sbw[1];
Lines 360-407 Link Here
360
    } else {
349
    } else {
361
	/* We have the width and bounding box: */
350
	/* We have the width and bounding box: */
362
	/* set up the cache device now. */
351
	/* set up the cache device now. */
363
        double w[2];
364
        w[0] = pcxs->sbw[2], w[1] = pcxs->sbw[3];
365
      
366
	if (pcxs->use_FontBBox_as_Metrics2) {
367
	   /* In this case, we have to calculate width for WMode=0. 
368
	      pcxs->sbw[2, 3] is width for WMode=1.
369
	      Normally, the width for WMode=0 is not used in WMode=1 
370
	      rendering. However, if CDevProc is defined, 
371
	      the width for WMode=0 is used. 
372
	      Do the same as the case pcxs->present == metricsNone */
373
	     double sbw[4];
374
	     ref cnref;
375
	     ref other_subr;
376
	     int code;
377
	     
378
	    /* Since an OtherSubr callout might change osp, */
379
	    /* save the character name now. */
380
	    ref_assign(&cnref, op - 1);
381
	    code = type1_continue_dispatch(i_ctx_p, pcxs, op, &other_subr, 4);
382
	    op = osp;		/* OtherSubrs might change it */
383
	    switch (code) {
384
 	     default:		/* code < 0 or done, error */
385
		 return ((code < 0 ? code :
386
			 gs_note_error(e_invalidfont)));
387
	    case type1_result_callothersubr:	/* unknown OtherSubr */
388
		return type1_call_OtherSubr(i_ctx_p, pcxs,
389
					    bbox_getsbw_continue,
390
					    &other_subr);
391
	    case type1_result_sbw:	/* [h]sbw, done */
392
		break;
393
	    }
394
	    type1_cis_get_metrics(pcis, sbw);
395
	    w[0] = sbw[2], w[1] = sbw[3];
396
	    /* Now actual width is available, I can calculate much 
397
	       better side bearing for WMode 1 from the width. */
398
	    pcxs->sbw[0] = w[0] / 2;
399
	}
400
 	return zchar_set_cache(i_ctx_p, pbfont, op - 1,
352
 	return zchar_set_cache(i_ctx_p, pbfont, op - 1,
401
			       (pcxs->present == metricsSideBearingAndWidth
353
			       (pcxs->present == metricsSideBearingAndWidth
402
			        && !pcxs->use_FontBBox_as_Metrics2 ?
354
			        && !pcxs->use_FontBBox_as_Metrics2 ?
403
			        pcxs->sbw : NULL),
355
			        pcxs->sbw : NULL),
404
			       w,
356
			       pcxs->sbw + 2,
405
			       &pcxs->char_bbox,
357
			       &pcxs->char_bbox,
406
			       cont, exec_cont, 
358
			       cont, exec_cont, 
407
			       (pcxs->use_FontBBox_as_Metrics2 ? pcxs->sbw : NULL));
359
			       (pcxs->use_FontBBox_as_Metrics2 ? pcxs->sbw : NULL));
Lines 629-635 Link Here
629
    code = type1_exec_init(&cxs.cis, penum, igs, pfont1);
581
    code = type1_exec_init(&cxs.cis, penum, igs, pfont1);
630
    if (code < 0)
582
    if (code < 0)
631
	return code;
583
	return code;
632
    cxs.char_bbox = bbox;
584
    cxs.char_bbox = pfont1->FontBBox;
633
    code = type1exec_bbox(i_ctx_p, &cxs, pfont, exec_cont);
585
    code = type1exec_bbox(i_ctx_p, &cxs, pfont, exec_cont);
634
    return code;
586
    return code;
635
}
587
}
Lines 843-849 Link Here
843
    int code;
795
    int code;
844
    gs_text_enum_t *penum = op_show_find(i_ctx_p);
796
    gs_text_enum_t *penum = op_show_find(i_ctx_p);
845
    gs_font *pfont;
797
    gs_font *pfont;
846
    double w[2];
847
798
848
    if ((code = gs_pathbbox(igs, &pcxs->char_bbox)) < 0 ||
799
    if ((code = gs_pathbbox(igs, &pcxs->char_bbox)) < 0 ||
849
	(code = font_param(op - 3, &pfont)) < 0
800
	(code = font_param(op - 3, &pfont)) < 0
Lines 856-879 Link Here
856
	gs_font_type1 *const pfont1 = (gs_font_type1 *) pfont;
807
	gs_font_type1 *const pfont1 = (gs_font_type1 *) pfont;
857
	op_proc_t cont, exec_cont = 0;
808
	op_proc_t cont, exec_cont = 0;
858
809
859
	if (pcxs->present == metricsNone
810
	if (pcxs->present == metricsNone) {
860
	    || pcxs->use_FontBBox_as_Metrics2) {
861
	    gs_point endpt;
811
	    gs_point endpt;
862
812
863
	    if ((code = gs_currentpoint(igs, &endpt)) < 0)
813
	    if ((code = gs_currentpoint(igs, &endpt)) < 0)
864
		return code;
814
		return code;
865
	    /* We will not use sbw[3, 4]. 
815
	    pcxs->sbw[2] = endpt.x, pcxs->sbw[3] = endpt.y;
866
	       If pcxs->use_FontBBox_as_Metrics2 is true,
867
	       sbw[3, 4] are used as arguments(W1x, W1y) of setcachedevice2. 
868
	       We will use w[0, 1] as W0x and W0y of setcachedevice2.
869
	       W0 and W1 is differrent parameters. Don't confuse. */
870
	    w[0] = endpt.x, w[1] = endpt.y;
871
	    pcxs->present = metricsSideBearingAndWidth;
816
	    pcxs->present = metricsSideBearingAndWidth;
872
	    if (pcxs->use_FontBBox_as_Metrics2) {
873
	      /* Now actual width is available, I can calculate much 
874
		 better side bearing for WMode 1 from the width. */
875
	      pcxs->sbw[0] = w[0] / 2;
876
	    }
877
	}
817
	}
878
	/*
818
	/*
879
	 * We only need to rebuild the path from scratch if we might
819
	 * We only need to rebuild the path from scratch if we might
Lines 890-896 Link Here
890
	} else {
830
	} else {
891
	    cont = (pbfont->PaintType == 0 ? nobbox_fill : nobbox_stroke), exec_cont = 0;
831
	    cont = (pbfont->PaintType == 0 ? nobbox_fill : nobbox_stroke), exec_cont = 0;
892
	    code = zchar_set_cache(i_ctx_p, pbfont, op - 1, NULL,
832
	    code = zchar_set_cache(i_ctx_p, pbfont, op - 1, NULL,
893
				    w,
833
				   pcxs->sbw + 2,
894
				   &pcxs->char_bbox,
834
				   &pcxs->char_bbox,
895
				   cont, &exec_cont,
835
				   cont, &exec_cont,
896
				   (pcxs->use_FontBBox_as_Metrics2 ? pcxs->sbw : NULL));
836
				   (pcxs->use_FontBBox_as_Metrics2 ? pcxs->sbw : NULL));
(-)src/zchar42.c (-19 / +3 lines)
Lines 1-12 Link Here
1
/*
2
 * Modified by AXE,Inc., BBR Inc. and Turbolinux Inc.
3
 *   under the technical advice by suzuki toshiya (Hiroshima University)
4
 * Based on bugfix by Masatake Yamato and Hideo Saito, 2001.
5
 * For questions, please send mail to espgs8-cjk@printing-japan.org
6
 *
7
 * (C) Copyright 2006 Center of the International Cooperation for
8
 *     Computerization
9
 */
10
/* Copyright (C) 1996, 1997, 1998, 1999 Aladdin Enterprises.  All rights reserved.
1
/* Copyright (C) 1996, 1997, 1998, 1999 Aladdin Enterprises.  All rights reserved.
11
  
2
  
12
  This software is provided AS-IS with no warranty, either express or
3
  This software is provided AS-IS with no warranty, either express or
Lines 53-67 Link Here
53
{   double sbw[4];
44
{   double sbw[4];
54
    double w[2];
45
    double w[2];
55
    int present;
46
    int present;
56
    gs_rect bbox, *pbbox;
47
    int code = zchar_get_metrics(pbfont, cnref, sbw);
57
    int code = gs_type42_glyph_fbbox(pbfont, glyph_index, &bbox);
58
48
59
    if (code != 0) {
60
	pbbox = &pbfont->FontBBox;
61
    } else {
62
	pbbox = &bbox;
63
    }
64
    code = zchar_get_metrics(pbfont, cnref, sbw);
65
    if (code < 0)
49
    if (code < 0)
66
	return code;
50
	return code;
67
    present = code;
51
    present = code;
Lines 91-97 Link Here
91
		}
75
		}
92
	    } else {
76
	    } else {
93
		sbw[0] = sbw[2] / 2;
77
		sbw[0] = sbw[2] / 2;
94
		sbw[1] = pbbox->q.y - sbw42[1];
78
		sbw[1] = (pbfont->FontBBox.q.y + pbfont->FontBBox.p.y - sbw42[3]) / 2;
95
		sbw[2] = sbw42[2];
79
		sbw[2] = sbw42[2];
96
		sbw[3] = sbw42[3];
80
		sbw[3] = sbw42[3];
97
	    }
81
	    }
Lines 103-109 Link Here
103
    return zchar_set_cache(i_ctx_p, pbfont, cnref,
87
    return zchar_set_cache(i_ctx_p, pbfont, cnref,
104
			   (put_lsb && present == metricsSideBearingAndWidth ?
88
			   (put_lsb && present == metricsSideBearingAndWidth ?
105
			    sbw : NULL),
89
			    sbw : NULL),
106
			   w, pbbox,
90
			   w, &pbfont->FontBBox,
107
			   cont, exec_cont,
91
			   cont, exec_cont,
108
			   gs_rootfont(igs)->WMode ? sbw : NULL);
92
			   gs_rootfont(igs)->WMode ? sbw : NULL);
109
}
93
}
(-)src/zfcid1.c (+63 lines)
Lines 35-40 Link Here
35
#include "stream.h"
35
#include "stream.h"
36
#include "files.h"
36
#include "files.h"
37
37
38
#if 1 /* XXXX */
39
private uint z11_find_repl_glyph(gs_font_cid2 *, uint);
40
#endif
41
38
/* ---------------- CIDFontType 1 (FontType 10) ---------------- */
42
/* ---------------- CIDFontType 1 (FontType 10) ---------------- */
39
43
40
/* <string|name> <font_dict> .buildfont10 <string|name> <font> */
44
/* <string|name> <font_dict> .buildfont10 <string|name> <font> */
Lines 67-72 Link Here
67
71
68
/* ------ Accessing ------ */
72
/* ------ Accessing ------ */
69
73
74
/* Replace a glyph with a vertical substitution */
75
private uint
76
z11_find_repl_glyph(gs_font_cid2 *pfont, uint glyph)
77
{
78
    int i;
79
    const byte *data;
80
81
    if (pfont->data.mort_ncgsv_off == 0)
82
	return glyph;
83
84
    if ((*pfont->data.string_proc)((gs_font_type42*)pfont,
85
		(ulong)pfont->data.mort_ncgsv_off,
86
		pfont->data.mort_ncgsv_len, &data) == 0) {
87
	for (i=0; i < pfont->data.mort_ncgsv_len; i += 4) {
88
	    if (((data[i]<<8)+data[i+1]) == glyph) {
89
		return (uint)((data[i+2]<<8)+data[i+3]);
90
	    }
91
	}
92
    }
93
    return glyph;
94
}
95
70
/* Map a glyph CID to a TrueType glyph number using the CIDMap. */
96
/* Map a glyph CID to a TrueType glyph number using the CIDMap. */
71
private int
97
private int
72
z11_CIDMap_proc(gs_font_cid2 *pfont, gs_glyph glyph)
98
z11_CIDMap_proc(gs_font_cid2 *pfont, gs_glyph glyph)
Lines 107-112 Link Here
107
    }
133
    }
108
    for (i = 0; i < gdbytes; ++i)
134
    for (i = 0; i < gdbytes; ++i)
109
	gnum = (gnum << 8) + data[i];
135
	gnum = (gnum << 8) + data[i];
136
#if 1 /* XXXX */
137
    if ( gnum != 0 &&
138
	 pfont->cidata.common.CIDSystemInfo.Registry.size == 5 &&
139
	!memcmp(pfont->cidata.common.CIDSystemInfo.Registry.data,"Adobe",5) &&
140
	 pfont->cidata.common.CIDSystemInfo.Ordering.size == 6 &&
141
	!memcmp(pfont->cidata.common.CIDSystemInfo.Ordering.data,"Japan1",6)) {
142
	uint gnum0 = gnum;
143
	  
144
	/* ps string represented in EUC/ShiftJIS are mapped to CID string,
145
	 * while certain characters (e.g. 0xa1c4) are mapped to different CID
146
	 * (668 or 7897) depending on WMode(0 or 1).
147
	 * But, when CID characters are mapped to ShiftJIS/Unicode to get
148
	 * corresponding TTF glyphs, certain CID characters are mapped to
149
	 * glyphs valid for horizonal writing
150
	 * (there is no choice in ShiftJIS encoded TTF), using Resource/CMap
151
	 *
152
	 * Following code maps certain CID (for vertical writing chars)
153
	 * to glyphs for vertical writing regardless of WMode!
154
	 * This automatic mapping enables generating PDF of vertical writing.
155
	 *
156
	 * fixme: range correct?
157
	 */
158
	if (7887 <= cid && cid <= 7960) {
159
	    /* substitute a glyph for vertical writing cid character */
160
	    gnum = z11_find_repl_glyph(pfont, gnum);
161
	}
162
	if (gnum != gnum0) {
163
	    if (gs_debug_c('J'))
164
		dlprintf3("[J]z11_CIDMap_proc(): cid:%d -> %d -> %d\n",
165
				cid, gnum0, gnum);
166
	} else if (gs_debug_c('J')) {
167
	    dlprintf2("[J]z11_CIDMap_proc(): cid:%d -> %d\n", cid, gnum);
168
	}
169
    } else if (gs_debug_c('J')) {
170
	dlprintf2("[J]z11_CIDMap_proc(): cid:%d -> %d\n", cid, gnum);
171
    }
172
#endif
110
    return gnum;
173
    return gnum;
111
}
174
}
112
175

Return to bug 144769