[gs-commits] ghostpdl branch, master, updated. jbig2dec-0.14-1834-g95151ae
[email protected] (Ken Sharp) Fri, 8 Nov 2019 15:16:34 +0000 (UTC)
| Newsgroups | gmane.comp.printing.ghostscript.cvs |
|---|---|
| Message-ID | <[email protected]> |
The ghostpdl branch, master has been updated
via 95151ae3c3c63100bc7ae958f59b8096e7a0f211 (commit)
from 0f7653fd4f1d1c5bf36719efcd8464eafcd46faf (commit)
----------------------------------------------------------------------
commit 95151ae3c3c63100bc7ae958f59b8096e7a0f211
Author: Ken Sharp <[email protected]>
Date: Fri Nov 8 15:13:50 2019 +0000
Improve handling of microscopic fonts with text rendering mode 3
Bug #701875 "empty TIFF-file is generated when using -r300, correct output with -r72"
In the past we've seen PDF producers set the text rendering mode to 3
and then (goodness knows why) set a CTM where one of the scale factors
is 0. In this case the scale factor isn't 0 but its absolutely minute,
5.3x10-6.
This evades our existing code, so here we improve it; we check to see
if the CTM scales in either direction by a really small amount instead
of 0 (0.000001).
In addition, we previously tried to patch up the CTM and use it anyway
but really this is only going to make sense is one scale factor is
tiny (or 0) and the other is sensible. If that's not the case then
any displacement due to drawing the text will also be tiny. So lets
simply ignore it.
diff --git a/Resource/Init/pdf_ops.ps b/Resource/Init/pdf_ops.ps
index cc25751..28f2b35 100644
--- a/Resource/Init/pdf_ops.ps
+++ b/Resource/Init/pdf_ops.ps
@@ -1678,25 +1678,35 @@ end readonly def
% operations when the CTM is singular.
% Work around this here.
{
- matrix currentmatrix dup dup
- dup 0 get 0 eq 1 index 1 get 0 eq and {
- dup dup 2 get 0 eq { 0 }{ 1 } ifelse 1 put
- } if
- dup 2 get 0 eq 1 index 3 get 0 eq and {
- dup dup 1 get 0 eq { 3 }{ 2 } ifelse 1 put
- } if
- setmatrix
- currentpoint
- % don't worry about transparency for invisible text
- 4 index settextfillstate show % Tr was set to graphic state.
- moveto
- setmatrix
- % now set the currentpoint using the original matrix
- gsave
- setmatrix
- //false charpath currentpoint newpath
- grestore
- moveto
+ matrix currentmatrix
+ % Previously we tested specifically for a scale factor of 0,
+ % but bug #701875 has a CTM which is minute, but not zero. If
+ % we try to use that at anything except low resolution FreeType
+ % ends up trying to deal with glyph metrics where one dimension is 0
+ % and it throws an error. So instead of looking for zero, we'll look
+ % for a really tiny CTM.
+ % We also used to patch up the CTM, and still use it, but frankly
+ % this is too much trouble. If the CTM is tiny then the displacement
+ % due to drawing the text will also be tiny. Negligible in fact.
+ % So if its that small then lets just ignore it.
+ dup 0 get abs 0.00001 lt 1 index 1 get 0.00001 abs lt and not {
+ dup 2 get abs 0.00001 lt 1 index 3 get abs 0.00001 lt and not {
+ pop
+ currentpoint
+ % don't worry about transparency for invisible text
+ 2 index settextfillstate show % Tr was set to graphic state.
+ moveto
+ % now set the currentpoint using the original matrix
+ gsave
+ //false charpath currentpoint newpath
+ grestore
+ moveto
+ } {
+ pop pop
+ }ifelse
+ } {
+ pop pop
+ }ifelse
}
} {
{ //false charpath textrenderingprocs .currenttextrenderingmode get exec }
Summary of changes:
Resource/Init/pdf_ops.ps | 48 +++++++++++++++++++++++++++++-------------------
1 file changed, 29 insertions(+), 19 deletions(-)