|
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)); |