[gs-commits] ghostpdl branch, master, updated. ghostpdl-9.02-687-gcf88158
Chris Liddell
chrisl at ghostscript.com
Wed Oct 26 15:53:23 UTC 2011
The ghostpdl branch, master has been updated
via cf8815855af78ddc9d4d9bebafbb21bff603e71d (commit)
from 8e8f10150dd2404757d648a1568c1002dd5310b4 (commit)
----------------------------------------------------------------------
commit cf8815855af78ddc9d4d9bebafbb21bff603e71d
Author: Chris Liddell <chris.liddell at artifex.com>
Date: Wed Oct 26 16:40:30 2011 +0100
Bug 692605: resolve FAPI/UFST matrix clash
The Microtype fonts require a unit design grid, but many jobs assume that the
standard fonts set have a design grid of 1000x1000. For those two conflicting
requirements to be satisfied, the UFST integration layer has to compensate
for the scaling.
As usual with the UFST code, that exposed a host of other problems, including
failing to produce a bitmap sometimes when one is require for the glyph cache
and failing to handle a glyph too big for UFST to image (i.e. fallback to an
outline) in some cases.
No cluster differences expected.
diff --git a/gs/Resource/Init/gs_fapi.ps b/gs/Resource/Init/gs_fapi.ps
index 5518500..c5e2b34 100644
--- a/gs/Resource/Init/gs_fapi.ps
+++ b/gs/Resource/Init/gs_fapi.ps
@@ -229,7 +229,7 @@ currentdict end def
>>
% although we pretend this is a Type 1, the FAPI interface currently
% needs an identity FontMatrix
- /FontMatrix [1.0 0.0 0.0 1.0 0.0 0.0]
+ /FontMatrix [0.001 0.0 0.0 0.001 0.0 0.0]
% we need a fake CharStrings dictionary to placate certain jobs
% which try to look inside it
/CharStrings
diff --git a/gs/psi/fapiufst.c b/gs/psi/fapiufst.c
index a366a0d..8efb4d7 100644
--- a/gs/psi/fapiufst.c
+++ b/gs/psi/fapiufst.c
@@ -1013,8 +1013,12 @@ static FAPI_retcode get_scaled_font(FAPI_server *server, FAPI_font *ff,
prepare_typeface(r, d);
if (ff->font_file_path != NULL || ff->is_type1) /* such fonts don't use RAW_GLYPH */
choose_decoding(r, d, xlatmap);
- } else
+ }
+ else {
prepare_typeface(r, d);
+ if (ff->font_file_path != NULL || ff->is_type1) /* such fonts don't use RAW_GLYPH */
+ choose_decoding(r, d, xlatmap);
+ }
r->tran_xx = font_scale->matrix[0] / scale, r->tran_xy = font_scale->matrix[1] / scale;
r->tran_yx = font_scale->matrix[2] / scale, r->tran_yy = font_scale->matrix[3] / scale;
@@ -1177,6 +1181,40 @@ static void release_glyphs(fapi_ufst_server *r, ufst_common_font_data *d)
static FAPI_retcode get_fontmatrix(FAPI_server *I, gs_matrix *m)
{
+ fapi_ufst_server *r = If_to_I(I);
+ ufst_common_font_data *d = (ufst_common_font_data *)I->ff.server_font_data;
+ FAPI_retcode code = 0;
+
+ if (d == 0) {
+ if ((code = make_font_data(r, I->ff.font_file_path, &(I->ff), &d)) != 0)
+ return (code);
+ I->ff.server_font_data = d;
+ prepare_typeface(r, d);
+ }
+
+ /* There are PS jobs that rely on the standard fonts having
+ * a FontMatrix of [0.001 0 0 0.001 0 0], but MT fonts actually
+ * have an identity matrix. We need to compensate here. Other
+ * fonts need an identity matrix returned here, as we apply the
+ * font matrix explicitly in the scale calculation in zfapi.c
+ */
+ if (d->font_type & FC_FCO_TYPE) {
+ m->xx = 0.001;
+ m->xy = 0.0;
+ m->yx = 0.0;
+ m->yy = 0.001;
+ m->tx = 0.0;
+ m->ty = 0.0;
+ }
+ else {
+ m->xx = 1.0;
+ m->xy = 0.0;
+ m->yx = 0.0;
+ m->yy = 1.0;
+ m->tx = 0.0;
+ m->ty = 0.0;
+ }
+
#if 0
gs_matrix *base_font_matrix = &I->initial_FontMatrix;
m->xx = I->initial_FontMatrix.xx;
@@ -1185,44 +1223,11 @@ static FAPI_retcode get_fontmatrix(FAPI_server *I, gs_matrix *m)
m->yy = I->initial_FontMatrix.yy;
m->tx = I->initial_FontMatrix.tx;
m->ty = I->initial_FontMatrix.ty;
-#else
- m->xx = 1;
- m->xy = 0;
- m->yx = 0;
- m->yy = 1;
- m->tx = 0;
- m->ty = 0;
#endif
- return 0;
+ return (code);
}
-static FAPI_retcode get_char_width(FAPI_server *server, FAPI_font *ff, FAPI_char_ref *c, FAPI_metrics *metrics)
-{ fapi_ufst_server *r = If_to_I(server);
- UW16 buffer[2];
- UW16 cc = (UW16)c->char_code;
- WIDTH_LIST_INPUT_ENTRY li[1];
- char PSchar_name[MAX_CHAR_NAME_LENGTH];
- int code;
- FSA_FROM_SERVER;
-
-#if !UFST_REENTRANT
- static_server_ptr_for_ufst_callback = r;
-#endif
- make_asciiz_char_name(PSchar_name, sizeof(PSchar_name), c);
- r->ff = ff;
- CGIFchIdptr(FSA &cc, PSchar_name);
- li[0]. CharType.IF_cgnum = cc;
- if ((code = CGIFwidth(FSA li, 1, 4, buffer)) != 0)
- return code;
- r->ff = 0;
-/* CGIFhdr_font_purge (&r->fc);
- release_glyphs(r, (ufst_common_font_data *)ff->server_font_data); */
- metrics->escapement = buffer[0];
- metrics->em_x = metrics->em_y = buffer[1];
- return 0;
-}
-
static int export_outline(fapi_ufst_server *r, PIFOUTLINE pol, FAPI_path *p)
{ POUTLINE_CHAR outchar;
SW16 num_contrs,num_segmts;
@@ -1517,19 +1522,36 @@ static FAPI_retcode get_char_outline(FAPI_server *server, FAPI_path *p)
}
static FAPI_retcode get_char_raster_metrics(FAPI_server *server, FAPI_font *ff, FAPI_char_ref *c, FAPI_metrics *metrics)
-{ fapi_ufst_server *r = If_to_I(server);
+{
+ fapi_ufst_server *r = If_to_I(server);
int code;
release_char_data_inline(r);
code = get_char(r, ff, c, NULL, metrics, FC_BITMAP_TYPE);
if (code == ERR_bm_buff || code == ERR_bm_too_big) /* Too big character ? */
- return e_limitcheck;
+ return (e_VMerror);
return code;
/* UFST cannot render enough metrics information without generating raster or outline.
r->char_data keeps a raster after calling this function.
*/
}
+static FAPI_retcode get_char_width(FAPI_server *server, FAPI_font *ff, FAPI_char_ref *c, FAPI_metrics *metrics)
+{
+ fapi_ufst_server *r = If_to_I(server);
+ int code;
+
+ release_char_data_inline(r);
+ code = get_char(r, ff, c, NULL, metrics, server->use_outline ? FC_CUBIC_TYPE : FC_BITMAP_TYPE);
+ if (code == ERR_bm_buff || code == ERR_bm_too_big) /* Too big character ? */
+ return (e_VMerror);
+ return code;
+ /* UFST cannot render enough metrics information without generating raster or outline.
+ r->char_data keeps a raster after calling this function.
+ */
+}
+
+
static FAPI_retcode get_char_raster(FAPI_server *server, FAPI_raster *rast)
{ fapi_ufst_server *r = If_to_I(server);
diff --git a/gs/psi/zfapi.c b/gs/psi/zfapi.c
index 12c2750..e811ecd 100644
--- a/gs/psi/zfapi.c
+++ b/gs/psi/zfapi.c
@@ -2122,6 +2122,27 @@ retry_oversampling:
FAPI_font_scale font_scale = {{1, 0, 0, 1, 0, 0}, {0, 0}, {1, 1}, true};
gs_matrix scale_mat, scale_ctm;
+ /* Prepare font data
+ * This needs done here (earlier than it used to be) because FAPI/UFST has conflicting
+ * requirements in what I->get_fontmatrix() returns based on font type, so it needs to
+ * find the font type.
+ */
+ if (dict_find_string(pdr, "SubfontId", &SubfontId) > 0 && r_has_type(SubfontId, t_integer))
+ I->ff.subfont = SubfontId->value.intval;
+ else
+ I->ff.subfont = 0;
+ I->ff.memory = pbfont->memory;
+ I->ff.font_file_path = font_file_path;
+ I->ff.client_font_data = pbfont;
+ I->ff.client_font_data2 = pdr;
+ I->ff.server_font_data = pbfont->FAPI_font_data;
+ I->ff.is_type1 = bIsType1GlyphData;
+ I->ff.is_cid = bCID;
+ I->ff.is_outline_font = pbfont->PaintType != 0;
+ I->ff.is_mtx_skipped = (get_MetricsCount(&I->ff) != 0);
+ I->ff.is_vertical = bVertical;
+ I->ff.client_ctx_p = i_ctx_p;
+
I->face.font_id = pbfont->id;
I->face.ctm = *ctm;
I->face.log2_scale = log2_scale;
@@ -2197,22 +2218,6 @@ retry_oversampling:
}
else {
- /* Prepare font data : */
- if (dict_find_string(pdr, "SubfontId", &SubfontId) > 0 && r_has_type(SubfontId, t_integer))
- I->ff.subfont = SubfontId->value.intval;
- else
- I->ff.subfont = 0;
- I->ff.memory = pbfont->memory;
- I->ff.font_file_path = font_file_path;
- I->ff.client_font_data = pbfont;
- I->ff.client_font_data2 = pdr;
- I->ff.server_font_data = pbfont->FAPI_font_data;
- I->ff.is_type1 = bIsType1GlyphData;
- I->ff.is_cid = bCID;
- I->ff.is_outline_font = pbfont->PaintType != 0;
- I->ff.is_mtx_skipped = (get_MetricsCount(&I->ff) != 0);
- I->ff.is_vertical = bVertical;
- I->ff.client_ctx_p = i_ctx_p;
if ((code = renderer_retcode(i_ctx_p, I, I->get_scaled_font(I, &I->ff, &font_scale,
NULL,
(!bCID || (pbfont->FontType != ft_encrypted &&
Summary of changes:
gs/Resource/Init/gs_fapi.ps | 2 +-
gs/psi/fapiufst.c | 96 ++++++++++++++++++++++++++----------------
gs/psi/zfapi.c | 37 +++++++++-------
3 files changed, 81 insertions(+), 54 deletions(-)
More information about the gs-commits
mailing list