Ticket #11455: patch-file

File patch-file, 2.8 KB (added by mike@…, 18 years ago)

Proposed fix (patch)

Line 
1--- ps/base.ps.org      2007-02-28 11:43:50.000000000 +0000
2+++ ps/base.ps  2007-02-28 11:44:05.000000000 +0000
3@@ -158,48 +158,46 @@
4 
5 % reencode the font
6 % <encoding-vector> <fontdict> -> <newfontdict>
7-/reencode { %def
8-  dup length 5 add dict begin
9-    { %forall
10-      1 index /FID ne
11-      { def }{ pop pop } ifelse
12-    } forall
13-    /Encoding exch def
14-
15-    % Use the font's bounding box to determine the ascent, descent,
16-    % and overall height; don't forget that these values have to be
17-    % transformed using the font's matrix.
18-    % We use `load' because sometimes BBox is executable, sometimes not.
19-    % Since we need 4 numbers an not an array avoid BBox from being executed
20-    /FontBBox load aload pop
21-    FontMatrix transform /Ascent exch def pop
22-    FontMatrix transform /Descent exch def pop
23-    /FontHeight Ascent Descent sub def
24-
25-    % Define these in case they're not in the FontInfo (also, here
26-    % they're easier to get to.
27-    /UnderlinePosition 1 def
28-    /UnderlineThickness 1 def
29-   
30-    % Get the underline position and thickness if they're defined.
31-    currentdict /FontInfo known {
32-      FontInfo
33-     
34-      dup /UnderlinePosition known {
35-       dup /UnderlinePosition get
36-       0 exch FontMatrix transform exch pop
37-       /UnderlinePosition exch def
38-      } if
39-     
40-      dup /UnderlineThickness known {
41-       /UnderlineThickness get
42-       0 exch FontMatrix transform exch pop
43-       /UnderlineThickness exch def
44-      } if
45-     
46-    } if
47-    currentdict
48-  end
49+/reencode
50+{
51+   dup length 5 add dict begin
52+     { % <vector> <key> <val>
53+       1 index /FID ne
54+       { def }{ pop pop } ifelse
55+     } forall
56+     /Encoding exch def % -
57+
58+     % Use the font's bounding box to determine the ascent, descent,
59+     % and overall height; don't forget that these values have to be
60+     % transformed using the font's matrix. We use `load' because sometimes
61+     % BBox is executable, sometimes not. Since we need 4 numbers an not
62+     % an array avoid BBox from being executed
63+     /FontBBox load aload pop
64+     FontMatrix transform /Ascent exch def pop
65+     FontMatrix transform /Descent exch def pop
66+     /FontHeight Ascent Descent sub def
67+
68+     % Get the underline position and thickness if they're defined.
69+     % Use 1 if they are not defined.
70+     currentdict /FontInfo 2 copy known
71+     { get
72+       /UnderlinePosition 2 copy  % <FontInfo> /UP <FontInfo> /UP
73+       2 copy known
74+       { get }{ pop pop 1} ifelse
75+       0 exch FontMatrix transform exch pop
76+       def           % <FontInfo>
77+
78+       /UnderlineThickness 2 copy  % <FontInfo> /UT <FontInfo> /UT
79+       2 copy known
80+       { get }{ pop pop 1} ifelse
81+       0 exch FontMatrix transform exch pop
82+       def           % <FontInfo>
83+       pop           % -
84+     }{ pop pop
85+     } ifelse
86+
87+     currentdict
88+     end
89 } bind def
90 
91 % Function print line number (<string> # -)