diff options
author | Ken Sharp <ken.sharp@artifex.com> | 2021-03-18 15:39:30 +0000 |
---|---|---|
committer | Ken Sharp <ken.sharp@artifex.com> | 2021-03-18 15:43:33 +0000 |
commit | c4c15576f4e81449a9253d15d5f46b5b39a11b07 (patch) | |
tree | 814e944e63049a228e42f433a7b0eede1899d8d5 | |
parent | 951639fbe0e9b7216e3e027ccdc471a11db1e50f (diff) | |
download | ghostpdl-c4c15576f4e81449a9253d15d5f46b5b39a11b07.tar.gz |
Drop DynaLab special bbox stretching of metrics
For historical reasons relating to glyph caching the zchar42_set_cache
code used the minimum and maximum of the glyph bounding box and font
bounding box when setting the metrics of a glyph.
This was done for DynaLab (one of the FreeType 'tricky' font types),
because these fonts abuse the TrueType 'hinting' mechanism.
Unfortunately this results in the wrong origin 1 being sent to
setcachedevice2, and hence CDevProc when the font is vertically
oriented.
We no longer use this function for clipping, and the remaining client
pdfwrite doesn't use it for clipping but very much does use it for
gathering font metrics, so it is vital that these be correct.
Since it's only used by pdfwrite, and testing suggests that DynaLab
fonts are not a problem for this, the code has been removed here. If
it should ever prove to be required then we should check the Font to
see if it is a DynaLab font. MuPDF has a function is_dynalab() for this
and we should use that if we prove to need it.
-rw-r--r-- | psi/zchar42.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/psi/zchar42.c b/psi/zchar42.c index e8bbf4c53..5e4cf4d5c 100644 --- a/psi/zchar42.c +++ b/psi/zchar42.c @@ -144,10 +144,18 @@ zchar42_set_cache(i_ctx_t *i_ctx_p, gs_font_base *pbfont, ref *cnref, which stretch subglyphs. Uniting with FontBBox helps. In same time, FontBBox with no glyph bbox doesn't work for 34_all.PS page 4. */ - bbox.p.x = min(sbw_bbox[4], pbfont->FontBBox.p.y); - bbox.p.y = min(sbw_bbox[5], pbfont->FontBBox.p.y); - bbox.q.x = max(sbw_bbox[6], pbfont->FontBBox.q.x); - bbox.q.y = max(sbw_bbox[7], pbfont->FontBBox.q.y); + /* Previously we used to expand the bbox to the maximum/minimum + * of the glyph and font bounding boxes combined, as noted above. + * However this causes incorrect output (bug #703697) for vertical + * writing fonts with pdfwrite. Since we no longer use this code + * for rendering, and pdfwrite doesn't use the metrics for clipping, + * but does for positioning, we've removed this code. + */ + + bbox.p.x = sbw_bbox[4]; + bbox.p.y = sbw_bbox[5]; + bbox.q.x = sbw_bbox[6]; + bbox.q.y = sbw_bbox[7]; return zchar_set_cache(i_ctx_p, pbfont, cnref, NULL, w, &bbox, |