diff options
author | Henry Stiles <henry.stiles@artifex.com> | 2009-06-25 19:45:17 +0000 |
---|---|---|
committer | Henry Stiles <henry.stiles@artifex.com> | 2009-06-25 19:45:17 +0000 |
commit | 93ae4b5cdab5f3c6d3cabe62505694fe78df865e (patch) | |
tree | 614230a15d326e5250addeb145ec83d7d1000ea1 /pcl | |
parent | a4d8cf7cb1d8ac44771e25cc39341efb4b122e8a (diff) |
As part of fixing bug #690520 correct the long standing annoyance of
pcl pitch being stored in different units, with this change all font
pitch attributes are stored in centipoints.
git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@9820 a1074d23-0009-0410-80fe-cf8c14f379e6
Diffstat (limited to 'pcl')
-rw-r--r-- | pcl/pcsfont.c | 6 | ||||
-rw-r--r-- | pcl/pctext.c | 2 | ||||
-rw-r--r-- | pcl/pcursor.c | 4 | ||||
-rw-r--r-- | pcl/pglabel.c | 17 |
4 files changed, 15 insertions, 14 deletions
diff --git a/pcl/pcsfont.c b/pcl/pcsfont.c index 922bc8bbd..61975a9bc 100644 --- a/pcl/pcsfont.c +++ b/pcl/pcsfont.c @@ -346,7 +346,7 @@ bitmap: pfont = gs_alloc_struct(mem, gs_font_base, &st_gs_font_base, floatp pitch_cp = (floatp) (pitch_1024th_dots / 1024.0 /* dots */ / plfont->resolution.x /* => inches */ - * 720.0); + * 7200.0); pl_fp_set_pitch_cp(&plfont->params, pitch_cp); } @@ -399,7 +399,7 @@ bitmap: pfont = gs_alloc_struct(mem, gs_font_base, &st_gs_font_base, return code; pl_fill_in_tt_font(pfont, NULL, gs_next_ids(mem, 1)); { uint pitch_cp = - pl_get_uint16(pfh->Pitch) * 100 / pfont->data.unitsPerEm; + pl_get_uint16(pfh->Pitch) * 1000.0 / pfont->data.unitsPerEm; pl_fp_set_pitch_cp(&plfont->params, pitch_cp); } } @@ -418,7 +418,7 @@ bitmap: pfont = gs_alloc_struct(mem, gs_font_base, &st_gs_font_base, return code; pl_fill_in_intelli_font(pfont, gs_next_ids(mem, 1)); { uint pitch_cp = - pl_get_uint16(pfh->Pitch) * 100 / 8782.0; + pl_get_uint16(pfh->Pitch) * 1000.0 / 8782.0; pl_fp_set_pitch_cp(&plfont->params, pitch_cp); } break; diff --git a/pcl/pctext.c b/pcl/pctext.c index 5f2a86024..a50eff10f 100644 --- a/pcl/pctext.c +++ b/pcl/pctext.c @@ -654,7 +654,7 @@ pcl_text( * 0.25 * 7200.0 / ppi; } else { scale.x = scale.y = pl_fp_pitch_cp(&pfp->params) - * (100.0 / pl_fp_pitch_cp(&pfp->font->params)) + * (1000.0 / pl_fp_pitch_cp(&pfp->font->params)) * (7200.0 / (100.0 * ppi)); /* hack for a scalable lineprinter font. If a real diff --git a/pcl/pcursor.c b/pcl/pcursor.c index b0700b7b6..945fe7031 100644 --- a/pcl/pcursor.c +++ b/pcl/pcursor.c @@ -404,11 +404,11 @@ pcl_updated_hmi( if (pl_font_is_scalable(plfont) && plfont->params.typeface_family != 0) { if (plfont->params.proportional_spacing) /* Scale the font's pitch by the requested height. */ - hmi = pl_fp_pitch_cp(&plfont->params) * pfs->params.height_4ths / 4; + hmi = pl_fp_pitch_cp(&plfont->params) / 10.0 * pfs->params.height_4ths / 4; else hmi = pl_fp_pitch_cp(&(pfs->params)); } else - hmi = pl_fp_pitch_cp(&(plfont->params)) * 10.0; + hmi = pl_fp_pitch_cp(&(plfont->params)); /* * Round to a multiple of the unit of measure (see the "PCL 5 Printer diff --git a/pcl/pglabel.c b/pcl/pglabel.c index b7175dec2..a3eebcba5 100644 --- a/pcl/pglabel.c +++ b/pcl/pglabel.c @@ -193,7 +193,7 @@ hpgl_select_stick_font(hpgl_state_t *pgls) * The stick font is defined in a cell that's only 2/3 * the size of the actual character. */ - pl_fp_set_pitch_cp(&font->params, 100.0*2/3); + pl_fp_set_pitch_cp(&font->params, 1000.0*2/3); pfs->font = font; { byte id[2]; @@ -286,14 +286,14 @@ hpgl_get_char_width(const hpgl_state_t *pgls, gs_char ch, hpgl_real_t *width) em-square the space character would occupy... */ if (code == 1) { gs_width.y = 0; - gs_width.x = pl_fp_pitch_cp(&pfs->font->params) / 100.0; + gs_width.x = pl_fp_pitch_cp(&pfs->font->params) / 1000.0; } if ( !pl_font_is_scalable(pfs->font) ) { if ( code == 0 ) *width = gs_width.x * inches_2_plu(1.0 / pfs->font->resolution.x); else - *width = coord_2_plu(pl_fp_pitch_cp(&pfs->font->params) * 10); + *width = coord_2_plu(pl_fp_pitch_cp(&pfs->font->params)); goto add; } else if ( code >= 0 ) { @@ -618,8 +618,8 @@ hpgl_current_char_scale(const hpgl_state_t *pgls) scale.y = -(ratio * inches_2_plu(1.0 / font->resolution.y)); } } else { -#define PERCENT_OF_EM ((pl_fp_pitch_cp(&pfs->font->params) / 100.0)) - scale.x = scale.y = (1.0/PERCENT_OF_EM) * hpgl_points_2_plu(pgls, pl_fp_pitch_cp(&pfs->params) / 100); +#define PERCENT_OF_EM ((pl_fp_pitch_cp(&pfs->font->params) / 1000.0)) + scale.x = scale.y = (1.0/PERCENT_OF_EM) * hpgl_points_2_plu(pgls, pl_fp_pitch_cp(&pfs->params) / 100.0); } } else { /* @@ -821,14 +821,14 @@ hpgl_print_char( if ( pl_font_is_scalable(font) ) { if (pfs->params.proportional_spacing) space_width = - (coord_2_plu(pl_fp_pitch_cp(&pfs->font->params) + (coord_2_plu((pl_fp_pitch_cp(&pfs->font->params) / 10) * pfs->params.height_4ths / 4) ) / scale.x; else space_width = 1.0; /* error! NB scalable fixed pitch space_code == 0 */ } else space_width = - ( coord_2_plu(pl_fp_pitch_cp(&pfs->font->params) * 10.0) ) / scale.x; + coord_2_plu(pl_fp_pitch_cp(&pfs->font->params)) / scale.x; space_width *= (1.0 + hpgl_get_character_extra_space_x(pgls)); } } @@ -1235,8 +1235,9 @@ acc_ht: hpgl_call(hpgl_get_current_cell_height(pgls, &height)); label_advance = ratio * inches_2_plu(1.0 / pfs->font->resolution.x); } } else + /*** WRONG ****/ label_advance = hpgl_points_2_plu(pgls, pl_fp_pitch_cp(&pfs->params) / - pl_fp_pitch_cp(&pfs->font->params) ); + ((pl_fp_pitch_cp(&pfs->font->params)/10.0))); if ( hpgl_get_character_extra_space_x(pgls) != 0 ) label_advance *= 1.0 + hpgl_get_character_extra_space_x(pgls); } else { |