diff options
Diffstat (limited to 'pl')
-rw-r--r-- | pl/plchar.c | 36 | ||||
-rw-r--r-- | pl/plfont.c | 4 | ||||
-rw-r--r-- | pl/plfont.h | 2 |
3 files changed, 19 insertions, 23 deletions
diff --git a/pl/plchar.c b/pl/plchar.c index 6f720bfad..92a7e2c1a 100644 --- a/pl/plchar.c +++ b/pl/plchar.c @@ -368,7 +368,7 @@ pl_bitmap_build_char(gs_show_enum *penum, gs_state *pgs, gs_font *pfont, gs_char chr, gs_glyph glyph) { pl_font_t *plfont = (pl_font_t *)pfont->client_data; const byte *cdata = pl_font_lookup_glyph(plfont, glyph)->data; - bool landscape = plfont->landscape; + bool orient = plfont->orient; if ( cdata == 0 ) return 0; @@ -421,28 +421,24 @@ pl_bitmap_build_char(gs_show_enum *penum, gs_state *pgs, gs_font *pfont, } else bold = 0; + gs_make_identity(&image.ImageMatrix); - if ( landscape ) { - /* note that we don't even use the font metrics for lsb. - It appears in landscape mode the bitmaps account for - this, very peculiar */ - gs_matrix_rotate(&image.ImageMatrix, -90, &image.ImageMatrix); - gs_matrix_translate(&image.ImageMatrix, - -image.Height, image.Width, &image.ImageMatrix); - /* for the landscape case apparently we adjust by the - width + left offset and height - top offset. Note - the landscape left offset is always negative in pcl's - coordinate system. */ - image.ImageMatrix.tx -= (image.Width + pl_get_int16(params)) /* left offset */; - image.ImageMatrix.ty += (pl_get_int16(params+2) - image.Height); - } + gs_matrix_rotate(&image.ImageMatrix, orient * -90, &image.ImageMatrix); + image.ImageMatrix.tx -= lsb; + image.ImageMatrix.ty += ascent; + image.adjust = true; + if (bold || orient != 0) + code = gs_setcharwidth(penum, pgs, delta_x, 0); else { - image.ImageMatrix.tx -= lsb; - image.ImageMatrix.ty += ascent; + /* we use cache device for portrait bitmap fonts to + avoid image setup overhead. */ + float m[6]; + m[0] = delta_x; m[1] = 0; + m[2] = lsb; m[3] = image.Height - ascent; + m[4] = image.Width + m[2]; + m[5] = -ascent; + code = gs_setcachedevice(penum, pgs, m); } - - image.adjust = true; - code = gs_setcharwidth(penum, pgs, delta_x, 0); if ( code < 0 ) return code; #ifdef DEBUG diff --git a/pl/plfont.c b/pl/plfont.c index 5df0bc51a..3f6053e7f 100644 --- a/pl/plfont.c +++ b/pl/plfont.c @@ -472,7 +472,7 @@ pl_alloc_font(gs_memory_t *mem, client_name_t cname) plfont->glyphs.table = 0; plfont->char_glyphs.table = 0; /* Initialize other defaults. */ - plfont->landscape = false; + plfont->orient = 0; plfont->bold_fraction = 0; plfont->font_file = 0; plfont->resolution.x = plfont->resolution.y = 0; @@ -515,7 +515,7 @@ pl_clone_font(const pl_font_t *src, gs_memory_t *mem, client_name_t cname) plfont->params = src->params; plfont->pts_per_inch = src->pts_per_inch; plfont->font_file_loaded = src->font_file_loaded; - plfont->landscape = src->landscape; + plfont->orient = src->orient; plfont->bold_fraction = src->bold_fraction; { int i; diff --git a/pl/plfont.h b/pl/plfont.h index 460e086c9..f43186b0a 100644 --- a/pl/plfont.h +++ b/pl/plfont.h @@ -167,7 +167,7 @@ struct pl_font_s { /* (for segmented fonts only) */ struct { uint x, y; } resolution; /* resolution (for bitmap fonts) */ float bold_fraction; /* for PXL algorithmic bolding */ - bool landscape; /* true if pcl bitmap font designed in landscape */ + int orient; /* true if pcl bitmap font designed in landscape */ pl_font_params_t params; byte character_complement[8]; /* character complement (for unbound fonts) */ struct o_ { |