diff options
author | Ken Sharp <ken.sharp@artifex.com> | 2010-08-06 11:15:22 +0000 |
---|---|---|
committer | Ken Sharp <ken.sharp@artifex.com> | 2010-08-06 11:15:22 +0000 |
commit | 961222e514e61e4dee08de1aeb68524733bdbb57 (patch) | |
tree | 7f548688c3260ef758a1706f14c461ec68cabf42 /gs/base/gdevpdtt.c | |
parent | c5448232c9834c4854a05050cfc7bf5ba21f2208 (diff) |
Fix pdfwrite
There is a hack in type 3 font creation in pdfwrite which increases the FontMatrix if
all the elements are very small, apparently Acrobat is unable to cope with very small
FontMatrix entries.
However, if all the entries are 0, it ends up running round a loop multiplying by 10
indefinitely. This change simply avoids the loop if all the matrix elements are 0.
Naturally this isn't a useful font, its a Quality Logic test file.
Expected Differences
File 13-13.ps should no longer hang
git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@11609 a1074d23-0009-0410-80fe-cf8c14f379e6
Diffstat (limited to 'gs/base/gdevpdtt.c')
-rw-r--r-- | gs/base/gdevpdtt.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/gs/base/gdevpdtt.c b/gs/base/gdevpdtt.c index eb4421b1f..1c7515db8 100644 --- a/gs/base/gdevpdtt.c +++ b/gs/base/gdevpdtt.c @@ -1123,14 +1123,20 @@ pdf_make_font3_resource(gx_device_pdf *pdev, gs_font *font, if (pdfont->u.simple.s.type3.Resources == NULL) return_error(gs_error_VMerror); /* Adobe viewers have a precision problem with small font matrices : */ - while (any_abs(pdfont->u.simple.s.type3.FontMatrix.xx) < 0.001 && - any_abs(pdfont->u.simple.s.type3.FontMatrix.xy) < 0.001 && - any_abs(pdfont->u.simple.s.type3.FontMatrix.yx) < 0.001 && - any_abs(pdfont->u.simple.s.type3.FontMatrix.yy) < 0.001) { - pdfont->u.simple.s.type3.FontMatrix.xx *= 10; - pdfont->u.simple.s.type3.FontMatrix.xy *= 10; - pdfont->u.simple.s.type3.FontMatrix.yx *= 10; - pdfont->u.simple.s.type3.FontMatrix.yy *= 10; + /* Don't perform this test if all entries are 0, leads to infinite loop! */ + if (pdfont->u.simple.s.type3.FontMatrix.xx != 0.0 || + pdfont->u.simple.s.type3.FontMatrix.xy != 0.0 || + pdfont->u.simple.s.type3.FontMatrix.yx != 0.0 || + pdfont->u.simple.s.type3.FontMatrix.yy != 0.0) { + while (any_abs(pdfont->u.simple.s.type3.FontMatrix.xx) < 0.001 && + any_abs(pdfont->u.simple.s.type3.FontMatrix.xy) < 0.001 && + any_abs(pdfont->u.simple.s.type3.FontMatrix.yx) < 0.001 && + any_abs(pdfont->u.simple.s.type3.FontMatrix.yy) < 0.001) { + pdfont->u.simple.s.type3.FontMatrix.xx *= 10; + pdfont->u.simple.s.type3.FontMatrix.xy *= 10; + pdfont->u.simple.s.type3.FontMatrix.yx *= 10; + pdfont->u.simple.s.type3.FontMatrix.yy *= 10; + } } *ppdfont = pdfont; return 0; |