Lines 1-200
Link Here
|
1 |
# [psaux] (1/2) Handle fonts that use SEAC for ligatures (#56580). |
|
|
2 |
# http://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=f2b64583cb2587373e126b06d8da9ac97b287681 |
3 |
# [psaux] (2/2) Handle fonts that use SEAC for ligatures (#56580). |
4 |
# http://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=05439f5cc69eaa3deaf3db52a7999af09a2c293a |
5 |
# Properly handle phantom points for variation fonts (#56601). |
6 |
# http://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=12e4307dc7b48c9a4a4fc3ac6c32220874ab18ec |
7 |
# [sfnt, winfonts] Avoid memory leaks in case of error (#56587). |
8 |
# http://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=b110acba9e6f7e40314f0da5d249cb3cb3beeab8 |
9 |
|
10 |
--- src/psaux/psintrp.c.orig 2019-03-05 10:28:19 UTC |
11 |
+++ src/psaux/psintrp.c |
12 |
@@ -1433,6 +1433,13 @@ |
13 |
lastError = error2; /* pass FreeType error through */ |
14 |
goto exit; |
15 |
} |
16 |
+ |
17 |
+ /* save the left bearing and width of the SEAC */ |
18 |
+ /* glyph as they will be erased by the next load */ |
19 |
+ |
20 |
+ left_bearing = *decoder->builder.left_bearing; |
21 |
+ advance = *decoder->builder.advance; |
22 |
+ |
23 |
cf2_interpT2CharString( font, |
24 |
&component, |
25 |
callbacks, |
26 |
@@ -1443,11 +1450,14 @@ |
27 |
&dummyWidth ); |
28 |
cf2_freeT1SeacComponent( decoder, &component ); |
29 |
|
30 |
- /* save the left bearing and width of the base */ |
31 |
- /* character as they will be erased by the next load */ |
32 |
+ /* If the SEAC glyph doesn't have a (H)SBW of its */ |
33 |
+ /* own use the values from the base glyph. */ |
34 |
|
35 |
- left_bearing = *decoder->builder.left_bearing; |
36 |
- advance = *decoder->builder.advance; |
37 |
+ if ( !haveWidth ) |
38 |
+ { |
39 |
+ left_bearing = *decoder->builder.left_bearing; |
40 |
+ advance = *decoder->builder.advance; |
41 |
+ } |
42 |
|
43 |
decoder->builder.left_bearing->x = 0; |
44 |
decoder->builder.left_bearing->y = 0; |
45 |
@@ -1473,8 +1483,8 @@ |
46 |
&dummyWidth ); |
47 |
cf2_freeT1SeacComponent( decoder, &component ); |
48 |
|
49 |
- /* restore the left side bearing and */ |
50 |
- /* advance width of the base character */ |
51 |
+ /* restore the left side bearing and advance width */ |
52 |
+ /* of the SEAC glyph or base character (saved above) */ |
53 |
|
54 |
*decoder->builder.left_bearing = left_bearing; |
55 |
*decoder->builder.advance = advance; |
56 |
--- src/psaux/t1decode.c.orig 2019-02-23 09:06:07 UTC |
57 |
+++ src/psaux/t1decode.c |
58 |
@@ -367,6 +367,12 @@ |
59 |
|
60 |
FT_GlyphLoader_Prepare( decoder->builder.loader ); /* prepare loader */ |
61 |
|
62 |
+ /* save the left bearing and width of the SEAC */ |
63 |
+ /* glyph as they will be erased by the next load */ |
64 |
+ |
65 |
+ left_bearing = decoder->builder.left_bearing; |
66 |
+ advance = decoder->builder.advance; |
67 |
+ |
68 |
/* the seac operator must not be nested */ |
69 |
decoder->seac = TRUE; |
70 |
error = t1_decoder_parse_glyph( decoder, (FT_UInt)bchar_index ); |
71 |
@@ -374,11 +380,14 @@ |
72 |
if ( error ) |
73 |
goto Exit; |
74 |
|
75 |
- /* save the left bearing and width of the base character */ |
76 |
- /* as they will be erased by the next load. */ |
77 |
+ /* If the SEAC glyph doesn't have a (H)SBW of its */ |
78 |
+ /* own use the values from the base glyph. */ |
79 |
|
80 |
- left_bearing = decoder->builder.left_bearing; |
81 |
- advance = decoder->builder.advance; |
82 |
+ if ( decoder->builder.parse_state != T1_Parse_Have_Width ) |
83 |
+ { |
84 |
+ left_bearing = decoder->builder.left_bearing; |
85 |
+ advance = decoder->builder.advance; |
86 |
+ } |
87 |
|
88 |
decoder->builder.left_bearing.x = 0; |
89 |
decoder->builder.left_bearing.y = 0; |
90 |
@@ -396,8 +405,8 @@ |
91 |
if ( error ) |
92 |
goto Exit; |
93 |
|
94 |
- /* restore the left side bearing and */ |
95 |
- /* advance width of the base character */ |
96 |
+ /* restore the left side bearing and advance width */ |
97 |
+ /* of the SEAC glyph or base character (saved above) */ |
98 |
|
99 |
decoder->builder.left_bearing = left_bearing; |
100 |
decoder->builder.advance = advance; |
101 |
--- src/sfnt/sfwoff.c.orig 2019-05-31 05:59:06 UTC |
102 |
+++ src/sfnt/sfwoff.c |
103 |
@@ -371,18 +371,18 @@ |
104 |
sfnt + table->OrigOffset, &output_len, |
105 |
stream->cursor, table->CompLength ); |
106 |
if ( error ) |
107 |
- goto Exit; |
108 |
+ goto Exit1; |
109 |
if ( output_len != table->OrigLength ) |
110 |
{ |
111 |
FT_ERROR(( "woff_font_open: compressed table length mismatch\n" )); |
112 |
error = FT_THROW( Invalid_Table ); |
113 |
- goto Exit; |
114 |
+ goto Exit1; |
115 |
} |
116 |
|
117 |
#else /* !FT_CONFIG_OPTION_USE_ZLIB */ |
118 |
|
119 |
error = FT_THROW( Unimplemented_Feature ); |
120 |
- goto Exit; |
121 |
+ goto Exit1; |
122 |
|
123 |
#endif /* !FT_CONFIG_OPTION_USE_ZLIB */ |
124 |
} |
125 |
@@ -424,6 +424,10 @@ |
126 |
} |
127 |
|
128 |
return error; |
129 |
+ |
130 |
+ Exit1: |
131 |
+ FT_FRAME_EXIT(); |
132 |
+ goto Exit; |
133 |
} |
134 |
|
135 |
|
136 |
--- src/truetype/ttgload.c.orig 2019-05-29 06:13:12 UTC |
137 |
+++ src/truetype/ttgload.c |
138 |
@@ -1102,9 +1102,16 @@ |
139 |
} |
140 |
|
141 |
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT |
142 |
- /* if we have a HVAR table, `pp1' and/or `pp2' are already adjusted */ |
143 |
- if ( !( loader->face->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) || |
144 |
- !IS_HINTED( loader->load_flags ) ) |
145 |
+ /* if we have a HVAR table, `pp1' and/or `pp2' */ |
146 |
+ /* are already adjusted but unscaled */ |
147 |
+ if ( ( loader->face->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) && |
148 |
+ IS_HINTED( loader->load_flags ) ) |
149 |
+ { |
150 |
+ loader->pp1.x = FT_MulFix( loader->pp1.x, x_scale ); |
151 |
+ loader->pp2.x = FT_MulFix( loader->pp2.x, x_scale ); |
152 |
+ /* pp1.y and pp2.y are always zero */ |
153 |
+ } |
154 |
+ else |
155 |
#endif |
156 |
{ |
157 |
loader->pp1 = outline->points[n_points - 4]; |
158 |
@@ -1112,9 +1119,17 @@ |
159 |
} |
160 |
|
161 |
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT |
162 |
- /* if we have a VVAR table, `pp3' and/or `pp4' are already adjusted */ |
163 |
- if ( !( loader->face->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) || |
164 |
- !IS_HINTED( loader->load_flags ) ) |
165 |
+ /* if we have a VVAR table, `pp3' and/or `pp4' */ |
166 |
+ /* are already adjusted but unscaled */ |
167 |
+ if ( ( loader->face->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) && |
168 |
+ IS_HINTED( loader->load_flags ) ) |
169 |
+ { |
170 |
+ loader->pp3.x = FT_MulFix( loader->pp3.x, x_scale ); |
171 |
+ loader->pp3.y = FT_MulFix( loader->pp3.y, y_scale ); |
172 |
+ loader->pp4.x = FT_MulFix( loader->pp4.x, x_scale ); |
173 |
+ loader->pp4.y = FT_MulFix( loader->pp4.y, y_scale ); |
174 |
+ } |
175 |
+ else |
176 |
#endif |
177 |
{ |
178 |
loader->pp3 = outline->points[n_points - 2]; |
179 |
--- src/winfonts/winfnt.c.orig 2019-02-23 09:06:07 UTC |
180 |
+++ src/winfonts/winfnt.c |
181 |
@@ -331,7 +331,7 @@ |
182 |
{ |
183 |
FT_TRACE2(( "invalid alignment shift count for resource data\n" )); |
184 |
error = FT_THROW( Invalid_File_Format ); |
185 |
- goto Exit; |
186 |
+ goto Exit1; |
187 |
} |
188 |
|
189 |
|
190 |
@@ -597,6 +597,10 @@ |
191 |
|
192 |
Exit: |
193 |
return error; |
194 |
+ |
195 |
+ Exit1: |
196 |
+ FT_FRAME_EXIT(); |
197 |
+ goto Exit; |
198 |
} |
199 |
|
200 |
|