summaryrefslogtreecommitdiff
path: root/pl
diff options
context:
space:
mode:
authorHenry Stiles <henry.stiles@artifex.com>2007-06-25 03:50:49 +0000
committerHenry Stiles <henry.stiles@artifex.com>2007-06-25 03:50:49 +0000
commit88f09c7b78213f47c8992065c5962af7294b78d6 (patch)
tree8c0c4cdbb8e0f6ee112d436d1deb0ea7a6939c07 /pl
parentc46f6128d0c3ddcbf9bf8f27f1506f6362774a76 (diff)
It was convenient to address two issues at the same time: (1) a fix
for bug #689216. Bitmap fonts with orientation 180 and 270 were not properly supported. And (2) we use setcachedevice for portrait bitmap fonts to improve performance. This avoids the overhead of creating a new image for each bitmap font. Trivial pixel differences noted in: pcl5ccet/30-03.BIN xl/pxlfts2.0/t202.bin xl/pxlfts3.0/T202.BIN xl/pcl6cet/c313.bin xl/pxlfts/t202.bin xl/pcl6cet3.0/C313.bin git-svn-id: http://svn.ghostscript.com/ghostpcl/trunk/ghostpcl@2856 06663e23-700e-0410-b217-a244a6096597
Diffstat (limited to 'pl')
-rw-r--r--pl/plchar.c36
-rw-r--r--pl/plfont.c4
-rw-r--r--pl/plfont.h2
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_ {