Merge lp:~3v1n0/ubuntu/trusty/freetype/multithread-safe into lp:ubuntu/trusty-updates/freetype
- Trusty (14.04)
- multithread-safe
- Merge into trusty-updates
Status: | Approved | ||||
---|---|---|---|---|---|
Approved by: | Brian Murray | ||||
Approved revision: | 62 | ||||
Proposed branch: | lp:~3v1n0/ubuntu/trusty/freetype/multithread-safe | ||||
Merge into: | lp:ubuntu/trusty-updates/freetype | ||||
Diff against target: |
2133 lines (+2113/-0) 3 files modified
debian/changelog (+7/-0) debian/patches-freetype/multi-thread-violations.patch (+2105/-0) debian/patches-freetype/series (+1/-0) |
||||
To merge this branch: | bzr merge lp:~3v1n0/ubuntu/trusty/freetype/multithread-safe | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Brian Murray | Approve | ||
Review via email: mp+247375@code.launchpad.net |
Commit message
Description of the change
Proposing fixes included in lp:~3v1n0/ubuntu/vivid/freetype/multithread-safe to trusty.
---
Backported patches coming from this patchset [1] that has been just merged upstream [2] and that fixes huge multithread violations that are causing crashes in a lot of places in the upper stack.
Here [3] you can read more details about this patch.
[1] https:/
[2] http://<email address hidden>
[3] http://<email address hidden>
For being precise, this patch includes the changes merged in commits:
http://
http://
http://
http://
http://
http://
http://
http://
http://
http://
http://
http://
http://
http://
http://
http://
http://
- 61. By Marco Trevisan (Treviño)
-
debian/
patches- freetype/ multi-thread- violations. patch: include commit 264b5e46 Fixes chrome rendering issues
- 62. By Marco Trevisan (Treviño)
-
Add back ft_raster5_
renderer_ class symbol
Unmerged revisions
- 62. By Marco Trevisan (Treviño)
-
Add back ft_raster5_
renderer_ class symbol - 61. By Marco Trevisan (Treviño)
-
debian/
patches- freetype/ multi-thread- violations. patch: include commit 264b5e46 Fixes chrome rendering issues
- 60. By Marco Trevisan (Treviño)
-
Merging with lp:ubuntu/trusty-updates/freetype
- 59. By Marco Trevisan (Treviño)
-
Added patchset to fix multithread violations, LP: #1199571
- debian/patches- freetype/ multi-thread- violations. patch
Preview Diff
1 | === modified file 'debian/changelog' | |||
2 | --- debian/changelog 2014-04-27 22:05:39 +0000 | |||
3 | +++ debian/changelog 2015-01-26 16:10:26 +0000 | |||
4 | @@ -1,3 +1,10 @@ | |||
5 | 1 | freetype (2.5.2-1ubuntu2.3) trusty; urgency=medium | ||
6 | 2 | |||
7 | 3 | * Added patchset to fix multithread violations, LP: #1199571 | ||
8 | 4 | - debian/patches-freetype/multi-thread-violations.patch | ||
9 | 5 | |||
10 | 6 | -- Marco Trevisan (Treviño) <marco@ubuntu.com> Fri, 23 Jan 2015 03:38:04 +0100 | ||
11 | 7 | |||
12 | 1 | freetype (2.5.2-1ubuntu2.2) trusty; urgency=medium | 8 | freetype (2.5.2-1ubuntu2.2) trusty; urgency=medium |
13 | 2 | 9 | ||
14 | 3 | * Fix incorrect Korean Fonts rendering. (LP: #1310017) | 10 | * Fix incorrect Korean Fonts rendering. (LP: #1310017) |
15 | 4 | 11 | ||
16 | === added file 'debian/patches-freetype/multi-thread-violations.patch' | |||
17 | --- debian/patches-freetype/multi-thread-violations.patch 1970-01-01 00:00:00 +0000 | |||
18 | +++ debian/patches-freetype/multi-thread-violations.patch 2015-01-26 16:10:26 +0000 | |||
19 | @@ -0,0 +1,2105 @@ | |||
20 | 1 | Author: Behdad Esfahbod <behdad@behdad.org> | ||
21 | 2 | Description: Multithread-safe FreeType | ||
22 | 3 | Forwarded: http://www.mail-archive.com/freetype-devel@nongnu.org/msg06758.html | ||
23 | 4 | Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69034 | ||
24 | 5 | Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/freetype/+bug/1199571 | ||
25 | 6 | Origin: upstream, https://github.com/behdad/freetype/commits/ftthread | ||
26 | 7 | Applied-Upstream: 2.5.6, git commits 89bc8d4d, 531d463a, 747ae2c8, 8dc86358, | ||
27 | 8 | a773c304, 6dfdaf4d, 51634253, 603292d7, b2ba6866, c242fe41, ae6699f8, a4117fbd, | ||
28 | 9 | c2733656, 6f16b100, 56ddafa0, 48c86628, 4eff854c, 264b5e46 | ||
29 | 10 | |||
30 | 11 | |||
31 | 12 | Index: freetype-2.5.2/devel/ftoption.h | ||
32 | 13 | =================================================================== | ||
33 | 14 | --- freetype-2.5.2.orig/devel/ftoption.h 2015-01-26 16:49:42.692849510 +0100 | ||
34 | 15 | +++ freetype-2.5.2/devel/ftoption.h 2015-01-26 16:49:42.668849502 +0100 | ||
35 | 16 | @@ -365,10 +365,6 @@ | ||
36 | 17 | /* The size in bytes of the render pool used by the scan-line converter */ | ||
37 | 18 | /* to do all of its work. */ | ||
38 | 19 | /* */ | ||
39 | 20 | - /* This must be greater than 4KByte if you use FreeType to rasterize */ | ||
40 | 21 | - /* glyphs; otherwise, you may set it to zero to avoid unnecessary */ | ||
41 | 22 | - /* allocation of the render pool. */ | ||
42 | 23 | - /* */ | ||
43 | 24 | #define FT_RENDER_POOL_SIZE 16384L | ||
44 | 25 | |||
45 | 26 | |||
46 | 27 | Index: freetype-2.5.2/include/config/ftoption.h | ||
47 | 28 | =================================================================== | ||
48 | 29 | --- freetype-2.5.2.orig/include/config/ftoption.h 2015-01-26 16:49:42.692849510 +0100 | ||
49 | 30 | +++ freetype-2.5.2/include/config/ftoption.h 2015-01-26 16:49:42.668849502 +0100 | ||
50 | 31 | @@ -365,10 +365,6 @@ | ||
51 | 32 | /* The size in bytes of the render pool used by the scan-line converter */ | ||
52 | 33 | /* to do all of its work. */ | ||
53 | 34 | /* */ | ||
54 | 35 | - /* This must be greater than 4KByte if you use FreeType to rasterize */ | ||
55 | 36 | - /* glyphs; otherwise, you may set it to zero to avoid unnecessary */ | ||
56 | 37 | - /* allocation of the render pool. */ | ||
57 | 38 | - /* */ | ||
58 | 39 | #define FT_RENDER_POOL_SIZE 16384L | ||
59 | 40 | |||
60 | 41 | |||
61 | 42 | Index: freetype-2.5.2/include/freetype.h | ||
62 | 43 | =================================================================== | ||
63 | 44 | --- freetype-2.5.2.orig/include/freetype.h 2015-01-26 16:49:42.692849510 +0100 | ||
64 | 45 | +++ freetype-2.5.2/include/freetype.h 2015-01-26 16:49:42.672849504 +0100 | ||
65 | 46 | @@ -332,8 +332,11 @@ | ||
66 | 47 | /* It also embeds a memory manager (see @FT_Memory), as well as a */ | ||
67 | 48 | /* scan-line converter object (see @FT_Raster). */ | ||
68 | 49 | /* */ | ||
69 | 50 | - /* In multi-threaded applications, make sure that the same FT_Library */ | ||
70 | 51 | - /* object or any of its children doesn't get accessed in parallel. */ | ||
71 | 52 | + /* In multi-threaded applications it is easiest to use one */ | ||
72 | 53 | + /* `FT_Library' object per thread. In case this is too cumbersome, */ | ||
73 | 54 | + /* a single `FT_Library' object across threads is possible also */ | ||
74 | 55 | + /* (since FreeType version 2.5.6), as long as a mutex lock is used */ | ||
75 | 56 | + /* around @FT_New_Face and @FT_Done_Face. */ | ||
76 | 57 | /* */ | ||
77 | 58 | /* <Note> */ | ||
78 | 59 | /* Library objects are normally created by @FT_Init_FreeType, and */ | ||
79 | 60 | @@ -401,6 +404,14 @@ | ||
80 | 61 | /* */ | ||
81 | 62 | /* Use @FT_Done_Face to destroy it (along with its slot and sizes). */ | ||
82 | 63 | /* */ | ||
83 | 64 | + /* An `FT_Face' object can only be safely used from one thread at a */ | ||
84 | 65 | + /* time. Similarly, creation and destruction of `FT_Face' with the */ | ||
85 | 66 | + /* same @FT_Library object can only be done from one thread at a */ | ||
86 | 67 | + /* time. On the other hand, functions like @FT_Load_Glyph and its */ | ||
87 | 68 | + /* siblings are thread-safe and do not need the lock to be held as */ | ||
88 | 69 | + /* long as the same `FT_Face' object is not used from multiple */ | ||
89 | 70 | + /* threads at the same time. */ | ||
90 | 71 | + /* */ | ||
91 | 72 | /* <Also> */ | ||
92 | 73 | /* See @FT_FaceRec for the publicly accessible fields of a given face */ | ||
93 | 74 | /* object. */ | ||
94 | 75 | @@ -1701,8 +1712,8 @@ | ||
95 | 76 | /* use @FT_New_Library instead, followed by a call to */ | ||
96 | 77 | /* @FT_Add_Default_Modules (or a series of calls to @FT_Add_Module). */ | ||
97 | 78 | /* */ | ||
98 | 79 | - /* For multi-threading applications each thread should have its own */ | ||
99 | 80 | - /* FT_Library object. */ | ||
100 | 81 | + /* See the documentation of @FT_Library and @FT_Face for */ | ||
101 | 82 | + /* multi-threading issues. */ | ||
102 | 83 | /* */ | ||
103 | 84 | /* If you need reference-counting (cf. @FT_Reference_Library), use */ | ||
104 | 85 | /* @FT_New_Library and @FT_Done_Library. */ | ||
105 | 86 | Index: freetype-2.5.2/include/ftimage.h | ||
106 | 87 | =================================================================== | ||
107 | 88 | --- freetype-2.5.2.orig/include/ftimage.h 2015-01-26 16:49:42.692849510 +0100 | ||
108 | 89 | +++ freetype-2.5.2/include/ftimage.h 2015-01-26 16:49:42.672849504 +0100 | ||
109 | 90 | @@ -1179,10 +1179,10 @@ | ||
110 | 91 | /* FT_Raster_ResetFunc */ | ||
111 | 92 | /* */ | ||
112 | 93 | /* <Description> */ | ||
113 | 94 | - /* FreeType provides an area of memory called the `render pool', */ | ||
114 | 95 | - /* available to all registered rasters. This pool can be freely used */ | ||
115 | 96 | - /* during a given scan-conversion but is shared by all rasters. Its */ | ||
116 | 97 | - /* content is thus transient. */ | ||
117 | 98 | + /* FreeType used to provide an area of memory called the `render */ | ||
118 | 99 | + /* pool' available to all registered rasters. This was not thread */ | ||
119 | 100 | + /* safe however and now FreeType never allocates this pool. NULL */ | ||
120 | 101 | + /* is always passed in as pool_base. */ | ||
121 | 102 | /* */ | ||
122 | 103 | /* This function is called each time the render pool changes, or just */ | ||
123 | 104 | /* after a new raster object is created. */ | ||
124 | 105 | @@ -1195,10 +1195,9 @@ | ||
125 | 106 | /* pool_size :: The size in bytes of the render pool. */ | ||
126 | 107 | /* */ | ||
127 | 108 | /* <Note> */ | ||
128 | 109 | - /* Rasters can ignore the render pool and rely on dynamic memory */ | ||
129 | 110 | + /* Rasters should ignore the render pool and rely on dynamic or stack */ | ||
130 | 111 | /* allocation if they want to (a handle to the memory allocator is */ | ||
131 | 112 | - /* passed to the raster constructor). However, this is not */ | ||
132 | 113 | - /* recommended for efficiency purposes. */ | ||
133 | 114 | + /* passed to the raster constructor). */ | ||
134 | 115 | /* */ | ||
135 | 116 | typedef void | ||
136 | 117 | (*FT_Raster_ResetFunc)( FT_Raster raster, | ||
137 | 118 | Index: freetype-2.5.2/include/ftrender.h | ||
138 | 119 | =================================================================== | ||
139 | 120 | --- freetype-2.5.2.orig/include/ftrender.h 2015-01-26 16:49:42.692849510 +0100 | ||
140 | 121 | +++ freetype-2.5.2/include/ftrender.h 2015-01-26 16:49:42.672849504 +0100 | ||
141 | 122 | @@ -212,13 +212,8 @@ | ||
142 | 123 | /* */ | ||
143 | 124 | /* This doesn't change the current renderer for other formats. */ | ||
144 | 125 | /* */ | ||
145 | 126 | - /* Currently, only the B/W renderer, if compiled with */ | ||
146 | 127 | - /* FT_RASTER_OPTION_ANTI_ALIASING (providing a 5-levels */ | ||
147 | 128 | - /* anti-aliasing mode; this option must be set directly in */ | ||
148 | 129 | - /* `ftraster.c' and is undefined by default) accepts a single tag */ | ||
149 | 130 | - /* `pal5' to set its gray palette as a character string with */ | ||
150 | 131 | - /* 5~elements. Consequently, the third and fourth argument are zero */ | ||
151 | 132 | - /* normally. */ | ||
152 | 133 | + /* Currently, no FreeType renderer module uses `parameters'; you */ | ||
153 | 134 | + /* should thus always pass NULL as the value. */ | ||
154 | 135 | /* */ | ||
155 | 136 | FT_EXPORT( FT_Error ) | ||
156 | 137 | FT_Set_Renderer( FT_Library library, | ||
157 | 138 | Index: freetype-2.5.2/include/internal/ftobjs.h | ||
158 | 139 | =================================================================== | ||
159 | 140 | --- freetype-2.5.2.orig/include/internal/ftobjs.h 2015-01-26 16:49:42.692849510 +0100 | ||
160 | 141 | +++ freetype-2.5.2/include/internal/ftobjs.h 2015-01-26 16:49:42.672849504 +0100 | ||
161 | 142 | @@ -738,9 +738,8 @@ | ||
162 | 143 | /* faces_list :: The list of faces currently opened by this */ | ||
163 | 144 | /* driver. */ | ||
164 | 145 | /* */ | ||
165 | 146 | - /* glyph_loader :: The glyph loader for all faces managed by this */ | ||
166 | 147 | - /* driver. This object isn't defined for unscalable */ | ||
167 | 148 | - /* formats. */ | ||
168 | 149 | + /* glyph_loader :: Unused. Used to be glyph loader for all faces */ | ||
169 | 150 | + /* managed by this driver. */ | ||
170 | 151 | /* */ | ||
171 | 152 | typedef struct FT_DriverRec_ | ||
172 | 153 | { | ||
173 | 154 | Index: freetype-2.5.2/src/autofit/afhints.c | ||
174 | 155 | =================================================================== | ||
175 | 156 | --- freetype-2.5.2.orig/src/autofit/afhints.c 2015-01-26 16:49:42.692849510 +0100 | ||
176 | 157 | +++ freetype-2.5.2/src/autofit/afhints.c 2015-01-26 16:49:42.672849504 +0100 | ||
177 | 158 | @@ -43,7 +43,15 @@ | ||
178 | 159 | AF_Segment segment = NULL; | ||
179 | 160 | |||
180 | 161 | |||
181 | 162 | - if ( axis->num_segments >= axis->max_segments ) | ||
182 | 163 | + if ( axis->num_segments < AF_SEGMENTS_EMBEDDED ) | ||
183 | 164 | + { | ||
184 | 165 | + if ( axis->segments == NULL ) | ||
185 | 166 | + { | ||
186 | 167 | + axis->segments = axis->embedded.segments; | ||
187 | 168 | + axis->max_segments = AF_SEGMENTS_EMBEDDED; | ||
188 | 169 | + } | ||
189 | 170 | + } | ||
190 | 171 | + else if ( axis->num_segments >= axis->max_segments ) | ||
191 | 172 | { | ||
192 | 173 | FT_Int old_max = axis->max_segments; | ||
193 | 174 | FT_Int new_max = old_max; | ||
194 | 175 | @@ -60,8 +68,18 @@ | ||
195 | 176 | if ( new_max < old_max || new_max > big_max ) | ||
196 | 177 | new_max = big_max; | ||
197 | 178 | |||
198 | 179 | - if ( FT_RENEW_ARRAY( axis->segments, old_max, new_max ) ) | ||
199 | 180 | - goto Exit; | ||
200 | 181 | + if ( axis->segments == axis->embedded.segments ) | ||
201 | 182 | + { | ||
202 | 183 | + if ( FT_NEW_ARRAY( axis->segments, new_max ) ) | ||
203 | 184 | + goto Exit; | ||
204 | 185 | + ft_memcpy( axis->segments, axis->embedded.segments, | ||
205 | 186 | + sizeof ( axis->embedded.segments ) ); | ||
206 | 187 | + } | ||
207 | 188 | + else | ||
208 | 189 | + { | ||
209 | 190 | + if ( FT_RENEW_ARRAY( axis->segments, old_max, new_max ) ) | ||
210 | 191 | + goto Exit; | ||
211 | 192 | + } | ||
212 | 193 | |||
213 | 194 | axis->max_segments = new_max; | ||
214 | 195 | } | ||
215 | 196 | @@ -88,7 +106,15 @@ | ||
216 | 197 | AF_Edge edges; | ||
217 | 198 | |||
218 | 199 | |||
219 | 200 | - if ( axis->num_edges >= axis->max_edges ) | ||
220 | 201 | + if ( axis->num_edges < AF_EDGES_EMBEDDED ) | ||
221 | 202 | + { | ||
222 | 203 | + if ( axis->edges == NULL ) | ||
223 | 204 | + { | ||
224 | 205 | + axis->edges = axis->embedded.edges; | ||
225 | 206 | + axis->max_edges = AF_EDGES_EMBEDDED; | ||
226 | 207 | + } | ||
227 | 208 | + } | ||
228 | 209 | + else if ( axis->num_edges >= axis->max_edges ) | ||
229 | 210 | { | ||
230 | 211 | FT_Int old_max = axis->max_edges; | ||
231 | 212 | FT_Int new_max = old_max; | ||
232 | 213 | @@ -105,8 +131,18 @@ | ||
233 | 214 | if ( new_max < old_max || new_max > big_max ) | ||
234 | 215 | new_max = big_max; | ||
235 | 216 | |||
236 | 217 | - if ( FT_RENEW_ARRAY( axis->edges, old_max, new_max ) ) | ||
237 | 218 | - goto Exit; | ||
238 | 219 | + if ( axis->edges == axis->embedded.edges ) | ||
239 | 220 | + { | ||
240 | 221 | + if ( FT_NEW_ARRAY( axis->edges, new_max ) ) | ||
241 | 222 | + goto Exit; | ||
242 | 223 | + ft_memcpy( axis->edges, axis->embedded.edges, | ||
243 | 224 | + sizeof ( axis->embedded.edges ) ); | ||
244 | 225 | + } | ||
245 | 226 | + else | ||
246 | 227 | + { | ||
247 | 228 | + if ( FT_RENEW_ARRAY( axis->edges, old_max, new_max ) ) | ||
248 | 229 | + goto Exit; | ||
249 | 230 | + } | ||
250 | 231 | |||
251 | 232 | axis->max_edges = new_max; | ||
252 | 233 | } | ||
253 | 234 | @@ -485,7 +521,8 @@ | ||
254 | 235 | af_glyph_hints_init( AF_GlyphHints hints, | ||
255 | 236 | FT_Memory memory ) | ||
256 | 237 | { | ||
257 | 238 | - FT_ZERO( hints ); | ||
258 | 239 | + /* no need to initialize the embedded items */ | ||
259 | 240 | + FT_MEM_ZERO( hints, sizeof ( *hints ) - sizeof ( hints->embedded ) ); | ||
260 | 241 | hints->memory = memory; | ||
261 | 242 | } | ||
262 | 243 | |||
263 | 244 | @@ -511,20 +548,24 @@ | ||
264 | 245 | |||
265 | 246 | axis->num_segments = 0; | ||
266 | 247 | axis->max_segments = 0; | ||
267 | 248 | - FT_FREE( axis->segments ); | ||
268 | 249 | + if ( axis->segments != axis->embedded.segments ) | ||
269 | 250 | + FT_FREE( axis->segments ); | ||
270 | 251 | |||
271 | 252 | axis->num_edges = 0; | ||
272 | 253 | axis->max_edges = 0; | ||
273 | 254 | - FT_FREE( axis->edges ); | ||
274 | 255 | + if ( axis->edges != axis->embedded.edges ) | ||
275 | 256 | + FT_FREE( axis->edges ); | ||
276 | 257 | } | ||
277 | 258 | |||
278 | 259 | - FT_FREE( hints->contours ); | ||
279 | 260 | + if ( hints->contours != hints->embedded.contours ) | ||
280 | 261 | + FT_FREE( hints->contours ); | ||
281 | 262 | hints->max_contours = 0; | ||
282 | 263 | hints->num_contours = 0; | ||
283 | 264 | |||
284 | 265 | - FT_FREE( hints->points ); | ||
285 | 266 | - hints->num_points = 0; | ||
286 | 267 | + if ( hints->points != hints->embedded.points ) | ||
287 | 268 | + FT_FREE( hints->points ); | ||
288 | 269 | hints->max_points = 0; | ||
289 | 270 | + hints->num_points = 0; | ||
290 | 271 | |||
291 | 272 | hints->memory = NULL; | ||
292 | 273 | } | ||
293 | 274 | @@ -569,8 +610,14 @@ | ||
294 | 275 | /* first of all, reallocate the contours array if necessary */ | ||
295 | 276 | new_max = (FT_UInt)outline->n_contours; | ||
296 | 277 | old_max = hints->max_contours; | ||
297 | 278 | - if ( new_max > old_max ) | ||
298 | 279 | + | ||
299 | 280 | + if ( new_max <= AF_CONTOURS_EMBEDDED ) | ||
300 | 281 | + hints->contours = hints->embedded.contours; | ||
301 | 282 | + else if ( new_max > old_max ) | ||
302 | 283 | { | ||
303 | 284 | + if ( hints->contours == hints->embedded.contours ) | ||
304 | 285 | + hints->contours = NULL; | ||
305 | 286 | + | ||
306 | 287 | new_max = ( new_max + 3 ) & ~3; /* round up to a multiple of 4 */ | ||
307 | 288 | |||
308 | 289 | if ( FT_RENEW_ARRAY( hints->contours, old_max, new_max ) ) | ||
309 | 290 | @@ -586,8 +633,14 @@ | ||
310 | 291 | */ | ||
311 | 292 | new_max = (FT_UInt)( outline->n_points + 2 ); | ||
312 | 293 | old_max = hints->max_points; | ||
313 | 294 | - if ( new_max > old_max ) | ||
314 | 295 | + | ||
315 | 296 | + if ( new_max <= AF_POINTS_EMBEDDED ) | ||
316 | 297 | + hints->points = hints->embedded.points; | ||
317 | 298 | + else if ( new_max > old_max ) | ||
318 | 299 | { | ||
319 | 300 | + if ( hints->points == hints->embedded.points ) | ||
320 | 301 | + hints->points = NULL; | ||
321 | 302 | + | ||
322 | 303 | new_max = ( new_max + 2 + 7 ) & ~7; /* round up to a multiple of 8 */ | ||
323 | 304 | |||
324 | 305 | if ( FT_RENEW_ARRAY( hints->points, old_max, new_max ) ) | ||
325 | 306 | Index: freetype-2.5.2/src/autofit/afhints.h | ||
326 | 307 | =================================================================== | ||
327 | 308 | --- freetype-2.5.2.orig/src/autofit/afhints.h 2015-01-26 16:49:42.692849510 +0100 | ||
328 | 309 | +++ freetype-2.5.2/src/autofit/afhints.h 2015-01-26 16:49:42.672849504 +0100 | ||
329 | 310 | @@ -322,6 +322,8 @@ | ||
330 | 311 | |||
331 | 312 | } AF_EdgeRec; | ||
332 | 313 | |||
333 | 314 | +#define AF_SEGMENTS_EMBEDDED 18 /* number of embedded segments */ | ||
334 | 315 | +#define AF_EDGES_EMBEDDED 12 /* number of embedded edges */ | ||
335 | 316 | |||
336 | 317 | typedef struct AF_AxisHintsRec_ | ||
337 | 318 | { | ||
338 | 319 | @@ -338,9 +340,20 @@ | ||
339 | 320 | |||
340 | 321 | AF_Direction major_dir; /* either vertical or horizontal */ | ||
341 | 322 | |||
342 | 323 | + /* two arrays to avoid allocation penalty */ | ||
343 | 324 | + struct | ||
344 | 325 | + { | ||
345 | 326 | + AF_SegmentRec segments[AF_SEGMENTS_EMBEDDED]; | ||
346 | 327 | + AF_EdgeRec edges[AF_EDGES_EMBEDDED]; | ||
347 | 328 | + } embedded; | ||
348 | 329 | + | ||
349 | 330 | + | ||
350 | 331 | } AF_AxisHintsRec, *AF_AxisHints; | ||
351 | 332 | |||
352 | 333 | |||
353 | 334 | +#define AF_POINTS_EMBEDDED 96 /* number of embedded points */ | ||
354 | 335 | +#define AF_CONTOURS_EMBEDDED 8 /* number of embedded contours */ | ||
355 | 336 | + | ||
356 | 337 | typedef struct AF_GlyphHintsRec_ | ||
357 | 338 | { | ||
358 | 339 | FT_Memory memory; | ||
359 | 340 | @@ -369,6 +382,14 @@ | ||
360 | 341 | FT_Pos xmin_delta; /* used for warping */ | ||
361 | 342 | FT_Pos xmax_delta; | ||
362 | 343 | |||
363 | 344 | + /* Two arrays to avoid allocation penalty. */ | ||
364 | 345 | + /* The `embedded' structure must be the last element! */ | ||
365 | 346 | + struct | ||
366 | 347 | + { | ||
367 | 348 | + AF_Point contours[AF_CONTOURS_EMBEDDED]; | ||
368 | 349 | + AF_PointRec points[AF_POINTS_EMBEDDED]; | ||
369 | 350 | + } embedded; | ||
370 | 351 | + | ||
371 | 352 | } AF_GlyphHintsRec; | ||
372 | 353 | |||
373 | 354 | |||
374 | 355 | Index: freetype-2.5.2/src/autofit/afloader.c | ||
375 | 356 | =================================================================== | ||
376 | 357 | --- freetype-2.5.2.orig/src/autofit/afloader.c 2015-01-26 16:49:42.692849510 +0100 | ||
377 | 358 | +++ freetype-2.5.2/src/autofit/afloader.c 2015-01-26 16:49:42.676849505 +0100 | ||
378 | 359 | @@ -26,38 +26,32 @@ | ||
379 | 360 | |||
380 | 361 | /* Initialize glyph loader. */ | ||
381 | 362 | |||
382 | 363 | - FT_LOCAL_DEF( FT_Error ) | ||
383 | 364 | - af_loader_init( AF_Module module ) | ||
384 | 365 | + FT_LOCAL_DEF( void ) | ||
385 | 366 | + af_loader_init( AF_Loader loader, | ||
386 | 367 | + AF_GlyphHints hints ) | ||
387 | 368 | { | ||
388 | 369 | - AF_Loader loader = module->loader; | ||
389 | 370 | - FT_Memory memory = module->root.library->memory; | ||
390 | 371 | - | ||
391 | 372 | - | ||
392 | 373 | FT_ZERO( loader ); | ||
393 | 374 | |||
394 | 375 | - af_glyph_hints_init( &loader->hints, memory ); | ||
395 | 376 | + loader->hints = hints; | ||
396 | 377 | #ifdef FT_DEBUG_AUTOFIT | ||
397 | 378 | - _af_debug_hints = &loader->hints; | ||
398 | 379 | + _af_debug_hints = loader->hints; | ||
399 | 380 | #endif | ||
400 | 381 | - return FT_GlyphLoader_New( memory, &loader->gloader ); | ||
401 | 382 | } | ||
402 | 383 | |||
403 | 384 | |||
404 | 385 | /* Reset glyph loader and compute globals if necessary. */ | ||
405 | 386 | |||
406 | 387 | FT_LOCAL_DEF( FT_Error ) | ||
407 | 388 | - af_loader_reset( AF_Module module, | ||
408 | 389 | + af_loader_reset( AF_Loader loader, | ||
409 | 390 | + AF_Module module, | ||
410 | 391 | FT_Face face ) | ||
411 | 392 | { | ||
412 | 393 | - FT_Error error = FT_Err_Ok; | ||
413 | 394 | - AF_Loader loader = module->loader; | ||
414 | 395 | + FT_Error error = FT_Err_Ok; | ||
415 | 396 | |||
416 | 397 | |||
417 | 398 | loader->face = face; | ||
418 | 399 | loader->globals = (AF_FaceGlobals)face->autohint.data; | ||
419 | 400 | |||
420 | 401 | - FT_GlyphLoader_Rewind( loader->gloader ); | ||
421 | 402 | - | ||
422 | 403 | if ( loader->globals == NULL ) | ||
423 | 404 | { | ||
424 | 405 | error = af_face_globals_new( face, &loader->globals, module ); | ||
425 | 406 | @@ -77,42 +71,37 @@ | ||
426 | 407 | /* Finalize glyph loader. */ | ||
427 | 408 | |||
428 | 409 | FT_LOCAL_DEF( void ) | ||
429 | 410 | - af_loader_done( AF_Module module ) | ||
430 | 411 | + af_loader_done( AF_Loader loader ) | ||
431 | 412 | { | ||
432 | 413 | - AF_Loader loader = module->loader; | ||
433 | 414 | - | ||
434 | 415 | - | ||
435 | 416 | - af_glyph_hints_done( &loader->hints ); | ||
436 | 417 | - | ||
437 | 418 | loader->face = NULL; | ||
438 | 419 | loader->globals = NULL; | ||
439 | 420 | + loader->hints = NULL; | ||
440 | 421 | |||
441 | 422 | #ifdef FT_DEBUG_AUTOFIT | ||
442 | 423 | _af_debug_hints = NULL; | ||
443 | 424 | #endif | ||
444 | 425 | - FT_GlyphLoader_Done( loader->gloader ); | ||
445 | 426 | - loader->gloader = NULL; | ||
446 | 427 | } | ||
447 | 428 | |||
448 | 429 | |||
449 | 430 | - /* Load a single glyph component. This routine calls itself */ | ||
450 | 431 | - /* recursively, if necessary, and does the main work of */ | ||
451 | 432 | - /* `af_loader_load_glyph.' */ | ||
452 | 433 | + /* Do the main work of `af_loader_load_glyph'. Note that we never */ | ||
453 | 434 | + /* have to deal with composite glyphs as those get loaded into */ | ||
454 | 435 | + /* FT_GLYPH_FORMAT_OUTLINE by the recursed `FT_Load_Glyph' function. */ | ||
455 | 436 | + /* In the rare cases where FT_LOAD_NO_RECURSE is set, it implies */ | ||
456 | 437 | + /* FT_LOAD_NO_SCALE and as such the auto-hinter is never called. */ | ||
457 | 438 | |||
458 | 439 | static FT_Error | ||
459 | 440 | af_loader_load_g( AF_Loader loader, | ||
460 | 441 | AF_Scaler scaler, | ||
461 | 442 | FT_UInt glyph_index, | ||
462 | 443 | - FT_Int32 load_flags, | ||
463 | 444 | - FT_UInt depth ) | ||
464 | 445 | + FT_Int32 load_flags ) | ||
465 | 446 | { | ||
466 | 447 | FT_Error error; | ||
467 | 448 | FT_Face face = loader->face; | ||
468 | 449 | - FT_GlyphLoader gloader = loader->gloader; | ||
469 | 450 | AF_ScriptMetrics metrics = loader->metrics; | ||
470 | 451 | - AF_GlyphHints hints = &loader->hints; | ||
471 | 452 | + AF_GlyphHints hints = loader->hints; | ||
472 | 453 | FT_GlyphSlot slot = face->glyph; | ||
473 | 454 | FT_Slot_Internal internal = slot->internal; | ||
474 | 455 | + FT_GlyphLoader gloader = internal->loader; | ||
475 | 456 | FT_Int32 flags; | ||
476 | 457 | |||
477 | 458 | |||
478 | 459 | @@ -144,29 +133,6 @@ | ||
479 | 460 | loader->trans_delta.x, | ||
480 | 461 | loader->trans_delta.y ); | ||
481 | 462 | |||
482 | 463 | - /* copy the outline points in the loader's current */ | ||
483 | 464 | - /* extra points which are used to keep original glyph coordinates */ | ||
484 | 465 | - error = FT_GLYPHLOADER_CHECK_POINTS( gloader, | ||
485 | 466 | - slot->outline.n_points + 4, | ||
486 | 467 | - slot->outline.n_contours ); | ||
487 | 468 | - if ( error ) | ||
488 | 469 | - goto Exit; | ||
489 | 470 | - | ||
490 | 471 | - FT_ARRAY_COPY( gloader->current.outline.points, | ||
491 | 472 | - slot->outline.points, | ||
492 | 473 | - slot->outline.n_points ); | ||
493 | 474 | - | ||
494 | 475 | - FT_ARRAY_COPY( gloader->current.outline.contours, | ||
495 | 476 | - slot->outline.contours, | ||
496 | 477 | - slot->outline.n_contours ); | ||
497 | 478 | - | ||
498 | 479 | - FT_ARRAY_COPY( gloader->current.outline.tags, | ||
499 | 480 | - slot->outline.tags, | ||
500 | 481 | - slot->outline.n_points ); | ||
501 | 482 | - | ||
502 | 483 | - gloader->current.outline.n_points = slot->outline.n_points; | ||
503 | 484 | - gloader->current.outline.n_contours = slot->outline.n_contours; | ||
504 | 485 | - | ||
505 | 486 | /* compute original horizontal phantom points (and ignore */ | ||
506 | 487 | /* vertical ones) */ | ||
507 | 488 | loader->pp1.x = hints->x_delta; | ||
508 | 489 | @@ -192,7 +158,7 @@ | ||
509 | 490 | |||
510 | 491 | if ( writing_system_class->script_hints_apply ) | ||
511 | 492 | writing_system_class->script_hints_apply( hints, | ||
512 | 493 | - &gloader->current.outline, | ||
513 | 494 | + &gloader->base.outline, | ||
514 | 495 | metrics ); | ||
515 | 496 | } | ||
516 | 497 | |||
517 | 498 | @@ -267,133 +233,6 @@ | ||
518 | 499 | slot->rsb_delta = loader->pp2.x - pp2x; | ||
519 | 500 | } | ||
520 | 501 | |||
521 | 502 | - /* good, we simply add the glyph to our loader's base */ | ||
522 | 503 | - FT_GlyphLoader_Add( gloader ); | ||
523 | 504 | - break; | ||
524 | 505 | - | ||
525 | 506 | - case FT_GLYPH_FORMAT_COMPOSITE: | ||
526 | 507 | - { | ||
527 | 508 | - FT_UInt nn, num_subglyphs = slot->num_subglyphs; | ||
528 | 509 | - FT_UInt num_base_subgs, start_point; | ||
529 | 510 | - FT_SubGlyph subglyph; | ||
530 | 511 | - | ||
531 | 512 | - | ||
532 | 513 | - start_point = gloader->base.outline.n_points; | ||
533 | 514 | - | ||
534 | 515 | - /* first of all, copy the subglyph descriptors in the glyph loader */ | ||
535 | 516 | - error = FT_GlyphLoader_CheckSubGlyphs( gloader, num_subglyphs ); | ||
536 | 517 | - if ( error ) | ||
537 | 518 | - goto Exit; | ||
538 | 519 | - | ||
539 | 520 | - FT_ARRAY_COPY( gloader->current.subglyphs, | ||
540 | 521 | - slot->subglyphs, | ||
541 | 522 | - num_subglyphs ); | ||
542 | 523 | - | ||
543 | 524 | - gloader->current.num_subglyphs = num_subglyphs; | ||
544 | 525 | - num_base_subgs = gloader->base.num_subglyphs; | ||
545 | 526 | - | ||
546 | 527 | - /* now read each subglyph independently */ | ||
547 | 528 | - for ( nn = 0; nn < num_subglyphs; nn++ ) | ||
548 | 529 | - { | ||
549 | 530 | - FT_Vector pp1, pp2; | ||
550 | 531 | - FT_Pos x, y; | ||
551 | 532 | - FT_UInt num_points, num_new_points, num_base_points; | ||
552 | 533 | - | ||
553 | 534 | - | ||
554 | 535 | - /* gloader.current.subglyphs can change during glyph loading due */ | ||
555 | 536 | - /* to re-allocation -- we must recompute the current subglyph on */ | ||
556 | 537 | - /* each iteration */ | ||
557 | 538 | - subglyph = gloader->base.subglyphs + num_base_subgs + nn; | ||
558 | 539 | - | ||
559 | 540 | - pp1 = loader->pp1; | ||
560 | 541 | - pp2 = loader->pp2; | ||
561 | 542 | - | ||
562 | 543 | - num_base_points = gloader->base.outline.n_points; | ||
563 | 544 | - | ||
564 | 545 | - error = af_loader_load_g( loader, scaler, subglyph->index, | ||
565 | 546 | - load_flags, depth + 1 ); | ||
566 | 547 | - if ( error ) | ||
567 | 548 | - goto Exit; | ||
568 | 549 | - | ||
569 | 550 | - /* recompute subglyph pointer */ | ||
570 | 551 | - subglyph = gloader->base.subglyphs + num_base_subgs + nn; | ||
571 | 552 | - | ||
572 | 553 | - if ( subglyph->flags & FT_SUBGLYPH_FLAG_USE_MY_METRICS ) | ||
573 | 554 | - { | ||
574 | 555 | - pp1 = loader->pp1; | ||
575 | 556 | - pp2 = loader->pp2; | ||
576 | 557 | - } | ||
577 | 558 | - else | ||
578 | 559 | - { | ||
579 | 560 | - loader->pp1 = pp1; | ||
580 | 561 | - loader->pp2 = pp2; | ||
581 | 562 | - } | ||
582 | 563 | - | ||
583 | 564 | - num_points = gloader->base.outline.n_points; | ||
584 | 565 | - num_new_points = num_points - num_base_points; | ||
585 | 566 | - | ||
586 | 567 | - /* now perform the transformation required for this subglyph */ | ||
587 | 568 | - | ||
588 | 569 | - if ( subglyph->flags & ( FT_SUBGLYPH_FLAG_SCALE | | ||
589 | 570 | - FT_SUBGLYPH_FLAG_XY_SCALE | | ||
590 | 571 | - FT_SUBGLYPH_FLAG_2X2 ) ) | ||
591 | 572 | - { | ||
592 | 573 | - FT_Vector* cur = gloader->base.outline.points + | ||
593 | 574 | - num_base_points; | ||
594 | 575 | - FT_Vector* limit = cur + num_new_points; | ||
595 | 576 | - | ||
596 | 577 | - | ||
597 | 578 | - for ( ; cur < limit; cur++ ) | ||
598 | 579 | - FT_Vector_Transform( cur, &subglyph->transform ); | ||
599 | 580 | - } | ||
600 | 581 | - | ||
601 | 582 | - /* apply offset */ | ||
602 | 583 | - | ||
603 | 584 | - if ( !( subglyph->flags & FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES ) ) | ||
604 | 585 | - { | ||
605 | 586 | - FT_Int k = subglyph->arg1; | ||
606 | 587 | - FT_UInt l = subglyph->arg2; | ||
607 | 588 | - FT_Vector* p1; | ||
608 | 589 | - FT_Vector* p2; | ||
609 | 590 | - | ||
610 | 591 | - | ||
611 | 592 | - if ( start_point + k >= num_base_points || | ||
612 | 593 | - l >= (FT_UInt)num_new_points ) | ||
613 | 594 | - { | ||
614 | 595 | - error = FT_THROW( Invalid_Composite ); | ||
615 | 596 | - goto Exit; | ||
616 | 597 | - } | ||
617 | 598 | - | ||
618 | 599 | - l += num_base_points; | ||
619 | 600 | - | ||
620 | 601 | - /* for now, only use the current point coordinates; */ | ||
621 | 602 | - /* we eventually may consider another approach */ | ||
622 | 603 | - p1 = gloader->base.outline.points + start_point + k; | ||
623 | 604 | - p2 = gloader->base.outline.points + start_point + l; | ||
624 | 605 | - | ||
625 | 606 | - x = p1->x - p2->x; | ||
626 | 607 | - y = p1->y - p2->y; | ||
627 | 608 | - } | ||
628 | 609 | - else | ||
629 | 610 | - { | ||
630 | 611 | - x = FT_MulFix( subglyph->arg1, hints->x_scale ) + hints->x_delta; | ||
631 | 612 | - y = FT_MulFix( subglyph->arg2, hints->y_scale ) + hints->y_delta; | ||
632 | 613 | - | ||
633 | 614 | - x = FT_PIX_ROUND( x ); | ||
634 | 615 | - y = FT_PIX_ROUND( y ); | ||
635 | 616 | - } | ||
636 | 617 | - | ||
637 | 618 | - { | ||
638 | 619 | - FT_Outline dummy = gloader->base.outline; | ||
639 | 620 | - | ||
640 | 621 | - | ||
641 | 622 | - dummy.points += num_base_points; | ||
642 | 623 | - dummy.n_points = (short)num_new_points; | ||
643 | 624 | - | ||
644 | 625 | - FT_Outline_Translate( &dummy, x, y ); | ||
645 | 626 | - } | ||
646 | 627 | - } | ||
647 | 628 | - } | ||
648 | 629 | break; | ||
649 | 630 | |||
650 | 631 | default: | ||
651 | 632 | @@ -402,7 +241,6 @@ | ||
652 | 633 | } | ||
653 | 634 | |||
654 | 635 | Hint_Metrics: | ||
655 | 636 | - if ( depth == 0 ) | ||
656 | 637 | { | ||
657 | 638 | FT_BBox bbox; | ||
658 | 639 | FT_Vector vvector; | ||
659 | 640 | @@ -477,18 +315,14 @@ | ||
660 | 641 | slot->metrics.horiAdvance = FT_PIX_ROUND( slot->metrics.horiAdvance ); | ||
661 | 642 | slot->metrics.vertAdvance = FT_PIX_ROUND( slot->metrics.vertAdvance ); | ||
662 | 643 | |||
663 | 644 | - /* now copy outline into glyph slot */ | ||
664 | 645 | - FT_GlyphLoader_Rewind( internal->loader ); | ||
665 | 646 | - error = FT_GlyphLoader_CopyPoints( internal->loader, gloader ); | ||
666 | 647 | - if ( error ) | ||
667 | 648 | - goto Exit; | ||
668 | 649 | - | ||
669 | 650 | +#if 0 | ||
670 | 651 | /* reassign all outline fields except flags to protect them */ | ||
671 | 652 | slot->outline.n_contours = internal->loader->base.outline.n_contours; | ||
672 | 653 | slot->outline.n_points = internal->loader->base.outline.n_points; | ||
673 | 654 | slot->outline.points = internal->loader->base.outline.points; | ||
674 | 655 | slot->outline.tags = internal->loader->base.outline.tags; | ||
675 | 656 | slot->outline.contours = internal->loader->base.outline.contours; | ||
676 | 657 | +#endif | ||
677 | 658 | |||
678 | 659 | slot->format = FT_GLYPH_FORMAT_OUTLINE; | ||
679 | 660 | } | ||
680 | 661 | @@ -501,14 +335,14 @@ | ||
681 | 662 | /* Load a glyph. */ | ||
682 | 663 | |||
683 | 664 | FT_LOCAL_DEF( FT_Error ) | ||
684 | 665 | - af_loader_load_glyph( AF_Module module, | ||
685 | 666 | + af_loader_load_glyph( AF_Loader loader, | ||
686 | 667 | + AF_Module module, | ||
687 | 668 | FT_Face face, | ||
688 | 669 | FT_UInt gindex, | ||
689 | 670 | FT_Int32 load_flags ) | ||
690 | 671 | { | ||
691 | 672 | FT_Error error; | ||
692 | 673 | FT_Size size = face->size; | ||
693 | 674 | - AF_Loader loader = module->loader; | ||
694 | 675 | AF_ScalerRec scaler; | ||
695 | 676 | |||
696 | 677 | |||
697 | 678 | @@ -526,7 +360,7 @@ | ||
698 | 679 | scaler.render_mode = FT_LOAD_TARGET_MODE( load_flags ); | ||
699 | 680 | scaler.flags = 0; /* XXX: fix this */ | ||
700 | 681 | |||
701 | 682 | - error = af_loader_reset( module, face ); | ||
702 | 683 | + error = af_loader_reset( loader, module, face ); | ||
703 | 684 | if ( !error ) | ||
704 | 685 | { | ||
705 | 686 | AF_ScriptMetrics metrics; | ||
706 | 687 | @@ -563,13 +397,13 @@ | ||
707 | 688 | |||
708 | 689 | if ( writing_system_class->script_hints_init ) | ||
709 | 690 | { | ||
710 | 691 | - error = writing_system_class->script_hints_init( &loader->hints, | ||
711 | 692 | + error = writing_system_class->script_hints_init( loader->hints, | ||
712 | 693 | metrics ); | ||
713 | 694 | if ( error ) | ||
714 | 695 | goto Exit; | ||
715 | 696 | } | ||
716 | 697 | |||
717 | 698 | - error = af_loader_load_g( loader, &scaler, gindex, load_flags, 0 ); | ||
718 | 699 | + error = af_loader_load_g( loader, &scaler, gindex, load_flags ); | ||
719 | 700 | } | ||
720 | 701 | } | ||
721 | 702 | Exit: | ||
722 | 703 | Index: freetype-2.5.2/src/autofit/afloader.h | ||
723 | 704 | =================================================================== | ||
724 | 705 | --- freetype-2.5.2.orig/src/autofit/afloader.h 2015-01-26 16:49:42.692849510 +0100 | ||
725 | 706 | +++ freetype-2.5.2/src/autofit/afloader.h 2015-01-26 16:49:42.676849505 +0100 | ||
726 | 707 | @@ -20,13 +20,12 @@ | ||
727 | 708 | #define __AFLOADER_H__ | ||
728 | 709 | |||
729 | 710 | #include "afhints.h" | ||
730 | 711 | +#include "afmodule.h" | ||
731 | 712 | #include "afglobal.h" | ||
732 | 713 | |||
733 | 714 | |||
734 | 715 | FT_BEGIN_HEADER | ||
735 | 716 | |||
736 | 717 | - typedef struct AF_ModuleRec_* AF_Module; | ||
737 | 718 | - | ||
738 | 719 | /* | ||
739 | 720 | * The autofitter module's (global) data structure to communicate with | ||
740 | 721 | * actual fonts. If necessary, `local' data like the current face, the | ||
741 | 722 | @@ -42,8 +41,7 @@ | ||
742 | 723 | AF_FaceGlobals globals; | ||
743 | 724 | |||
744 | 725 | /* current glyph data */ | ||
745 | 726 | - FT_GlyphLoader gloader; | ||
746 | 727 | - AF_GlyphHintsRec hints; | ||
747 | 728 | + AF_GlyphHints hints; | ||
748 | 729 | AF_ScriptMetrics metrics; | ||
749 | 730 | FT_Bool transformed; | ||
750 | 731 | FT_Matrix trans_matrix; | ||
751 | 732 | @@ -55,21 +53,24 @@ | ||
752 | 733 | } AF_LoaderRec, *AF_Loader; | ||
753 | 734 | |||
754 | 735 | |||
755 | 736 | - FT_LOCAL( FT_Error ) | ||
756 | 737 | - af_loader_init( AF_Module module ); | ||
757 | 738 | + FT_LOCAL( void ) | ||
758 | 739 | + af_loader_init( AF_Loader loader, | ||
759 | 740 | + AF_GlyphHints hints ); | ||
760 | 741 | |||
761 | 742 | |||
762 | 743 | FT_LOCAL( FT_Error ) | ||
763 | 744 | - af_loader_reset( AF_Module module, | ||
764 | 745 | + af_loader_reset( AF_Loader loader, | ||
765 | 746 | + AF_Module module, | ||
766 | 747 | FT_Face face ); | ||
767 | 748 | |||
768 | 749 | |||
769 | 750 | FT_LOCAL( void ) | ||
770 | 751 | - af_loader_done( AF_Module module ); | ||
771 | 752 | + af_loader_done( AF_Loader loader ); | ||
772 | 753 | |||
773 | 754 | |||
774 | 755 | FT_LOCAL( FT_Error ) | ||
775 | 756 | - af_loader_load_glyph( AF_Module module, | ||
776 | 757 | + af_loader_load_glyph( AF_Loader loader, | ||
777 | 758 | + AF_Module module, | ||
778 | 759 | FT_Face face, | ||
779 | 760 | FT_UInt gindex, | ||
780 | 761 | FT_Int32 load_flags ); | ||
781 | 762 | Index: freetype-2.5.2/src/autofit/afmodule.c | ||
782 | 763 | =================================================================== | ||
783 | 764 | --- freetype-2.5.2.orig/src/autofit/afmodule.c 2015-01-26 16:49:42.692849510 +0100 | ||
784 | 765 | +++ freetype-2.5.2/src/autofit/afmodule.c 2015-01-26 16:49:42.676849505 +0100 | ||
785 | 766 | @@ -208,17 +208,14 @@ | ||
786 | 767 | |||
787 | 768 | module->fallback_script = AF_SCRIPT_FALLBACK; | ||
788 | 769 | |||
789 | 770 | - return af_loader_init( module ); | ||
790 | 771 | + return FT_Err_Ok; | ||
791 | 772 | } | ||
792 | 773 | |||
793 | 774 | |||
794 | 775 | FT_CALLBACK_DEF( void ) | ||
795 | 776 | af_autofitter_done( FT_Module ft_module ) /* AF_Module */ | ||
796 | 777 | { | ||
797 | 778 | - AF_Module module = (AF_Module)ft_module; | ||
798 | 779 | - | ||
799 | 780 | - | ||
800 | 781 | - af_loader_done( module ); | ||
801 | 782 | + FT_UNUSED( ft_module ); | ||
802 | 783 | } | ||
803 | 784 | |||
804 | 785 | |||
805 | 786 | @@ -229,10 +226,25 @@ | ||
806 | 787 | FT_UInt glyph_index, | ||
807 | 788 | FT_Int32 load_flags ) | ||
808 | 789 | { | ||
809 | 790 | + FT_Error error = FT_Err_Ok; | ||
810 | 791 | + FT_Memory memory = module->root.library->memory; | ||
811 | 792 | + | ||
812 | 793 | + AF_GlyphHintsRec hints[1]; | ||
813 | 794 | + AF_LoaderRec loader[1]; | ||
814 | 795 | + | ||
815 | 796 | FT_UNUSED( size ); | ||
816 | 797 | |||
817 | 798 | - return af_loader_load_glyph( module, slot->face, | ||
818 | 799 | - glyph_index, load_flags ); | ||
819 | 800 | + | ||
820 | 801 | + af_glyph_hints_init( hints, memory ); | ||
821 | 802 | + af_loader_init( loader, hints ); | ||
822 | 803 | + | ||
823 | 804 | + error = af_loader_load_glyph( loader, module, slot->face, | ||
824 | 805 | + glyph_index, load_flags ); | ||
825 | 806 | + | ||
826 | 807 | + af_loader_done( loader ); | ||
827 | 808 | + af_glyph_hints_done( hints ); | ||
828 | 809 | + | ||
829 | 810 | + return error; | ||
830 | 811 | } | ||
831 | 812 | |||
832 | 813 | |||
833 | 814 | Index: freetype-2.5.2/src/autofit/afmodule.h | ||
834 | 815 | =================================================================== | ||
835 | 816 | --- freetype-2.5.2.orig/src/autofit/afmodule.h 2015-01-26 16:49:42.692849510 +0100 | ||
836 | 817 | +++ freetype-2.5.2/src/autofit/afmodule.h 2015-01-26 16:49:42.676849505 +0100 | ||
837 | 818 | @@ -23,17 +23,13 @@ | ||
838 | 819 | #include FT_INTERNAL_OBJECTS_H | ||
839 | 820 | #include FT_MODULE_H | ||
840 | 821 | |||
841 | 822 | -#include "afloader.h" | ||
842 | 823 | - | ||
843 | 824 | |||
844 | 825 | FT_BEGIN_HEADER | ||
845 | 826 | |||
846 | 827 | |||
847 | 828 | /* | ||
848 | 829 | * This is the `extended' FT_Module structure which holds the | ||
849 | 830 | - * autofitter's global data. Right before hinting a glyph, the data | ||
850 | 831 | - * specific to the glyph's face (blue zones, stem widths, etc.) are | ||
851 | 832 | - * loaded into `loader' (see function `af_loader_reset'). | ||
852 | 833 | + * autofitter's global data. | ||
853 | 834 | */ | ||
854 | 835 | |||
855 | 836 | typedef struct AF_ModuleRec_ | ||
856 | 837 | @@ -42,9 +38,7 @@ | ||
857 | 838 | |||
858 | 839 | FT_UInt fallback_script; | ||
859 | 840 | |||
860 | 841 | - AF_LoaderRec loader[1]; | ||
861 | 842 | - | ||
862 | 843 | - } AF_ModuleRec; | ||
863 | 844 | + } AF_ModuleRec, *AF_Module; | ||
864 | 845 | |||
865 | 846 | |||
866 | 847 | FT_DECLARE_MODULE(autofit_module_class) | ||
867 | 848 | Index: freetype-2.5.2/src/base/ftobjs.c | ||
868 | 849 | =================================================================== | ||
869 | 850 | --- freetype-2.5.2.orig/src/base/ftobjs.c 2015-01-26 16:49:42.692849510 +0100 | ||
870 | 851 | +++ freetype-2.5.2/src/base/ftobjs.c 2015-01-26 16:49:42.676849505 +0100 | ||
871 | 852 | @@ -963,10 +963,6 @@ | ||
872 | 853 | (FT_List_Destructor)destroy_face, | ||
873 | 854 | driver->root.memory, | ||
874 | 855 | driver ); | ||
875 | 856 | - | ||
876 | 857 | - /* check whether we need to drop the driver's glyph loader */ | ||
877 | 858 | - if ( FT_DRIVER_USES_OUTLINES( driver ) ) | ||
878 | 859 | - FT_GlyphLoader_Done( driver->glyph_loader ); | ||
879 | 860 | } | ||
880 | 861 | |||
881 | 862 | |||
882 | 863 | @@ -4046,8 +4042,7 @@ | ||
883 | 864 | |||
884 | 865 | default: | ||
885 | 866 | { | ||
886 | 867 | - FT_ListNode node = 0; | ||
887 | 868 | - FT_Bool update = 0; | ||
888 | 869 | + FT_ListNode node = 0; | ||
889 | 870 | |||
890 | 871 | |||
891 | 872 | /* small shortcut for the very common case */ | ||
892 | 873 | @@ -4074,13 +4069,7 @@ | ||
893 | 874 | /* now, look for another renderer that supports the same */ | ||
894 | 875 | /* format. */ | ||
895 | 876 | renderer = FT_Lookup_Renderer( library, slot->format, &node ); | ||
896 | 877 | - update = 1; | ||
897 | 878 | } | ||
898 | 879 | - | ||
899 | 880 | - /* if we changed the current renderer for the glyph image format */ | ||
900 | 881 | - /* we need to select it as the next current one */ | ||
901 | 882 | - if ( !error && update && renderer ) | ||
902 | 883 | - FT_Set_Renderer( library, renderer, 0, 0 ); | ||
903 | 884 | } | ||
904 | 885 | } | ||
905 | 886 | |||
906 | 887 | @@ -4280,17 +4269,10 @@ | ||
907 | 888 | /* if the module is a font driver */ | ||
908 | 889 | if ( FT_MODULE_IS_DRIVER( module ) ) | ||
909 | 890 | { | ||
910 | 891 | - /* allocate glyph loader if needed */ | ||
911 | 892 | FT_Driver driver = FT_DRIVER( module ); | ||
912 | 893 | |||
913 | 894 | |||
914 | 895 | driver->clazz = (FT_Driver_Class)module->clazz; | ||
915 | 896 | - if ( FT_DRIVER_USES_OUTLINES( driver ) ) | ||
916 | 897 | - { | ||
917 | 898 | - error = FT_GlyphLoader_New( memory, &driver->glyph_loader ); | ||
918 | 899 | - if ( error ) | ||
919 | 900 | - goto Fail; | ||
920 | 901 | - } | ||
921 | 902 | } | ||
922 | 903 | |||
923 | 904 | if ( clazz->module_init ) | ||
924 | 905 | @@ -4307,15 +4289,6 @@ | ||
925 | 906 | return error; | ||
926 | 907 | |||
927 | 908 | Fail: | ||
928 | 909 | - if ( FT_MODULE_IS_DRIVER( module ) ) | ||
929 | 910 | - { | ||
930 | 911 | - FT_Driver driver = FT_DRIVER( module ); | ||
931 | 912 | - | ||
932 | 913 | - | ||
933 | 914 | - if ( FT_DRIVER_USES_OUTLINES( driver ) ) | ||
934 | 915 | - FT_GlyphLoader_Done( driver->glyph_loader ); | ||
935 | 916 | - } | ||
936 | 917 | - | ||
937 | 918 | if ( FT_MODULE_IS_RENDERER( module ) ) | ||
938 | 919 | { | ||
939 | 920 | FT_Renderer renderer = FT_RENDERER( module ); | ||
940 | 921 | @@ -4630,12 +4603,9 @@ | ||
941 | 922 | goto Fail; | ||
942 | 923 | #endif | ||
943 | 924 | |||
944 | 925 | - /* allocate the render pool */ | ||
945 | 926 | - library->raster_pool_size = FT_RENDER_POOL_SIZE; | ||
946 | 927 | -#if FT_RENDER_POOL_SIZE > 0 | ||
947 | 928 | - if ( FT_ALLOC( library->raster_pool, FT_RENDER_POOL_SIZE ) ) | ||
948 | 929 | - goto Fail; | ||
949 | 930 | -#endif | ||
950 | 931 | + /* we don't use raster_pool anymore. */ | ||
951 | 932 | + library->raster_pool_size = 0; | ||
952 | 933 | + library->raster_pool = NULL; | ||
953 | 934 | |||
954 | 935 | library->version_major = FREETYPE_MAJOR; | ||
955 | 936 | library->version_minor = FREETYPE_MINOR; | ||
956 | 937 | @@ -4648,6 +4618,8 @@ | ||
957 | 938 | |||
958 | 939 | return FT_Err_Ok; | ||
959 | 940 | |||
960 | 941 | + /* Fix compilation warning */ | ||
961 | 942 | + goto Fail; | ||
962 | 943 | Fail: | ||
963 | 944 | #ifdef FT_CONFIG_OPTION_PIC | ||
964 | 945 | ft_pic_container_destroy( library ); | ||
965 | 946 | @@ -4784,10 +4756,6 @@ | ||
966 | 947 | } | ||
967 | 948 | #endif | ||
968 | 949 | |||
969 | 950 | - /* Destroy raster objects */ | ||
970 | 951 | - FT_FREE( library->raster_pool ); | ||
971 | 952 | - library->raster_pool_size = 0; | ||
972 | 953 | - | ||
973 | 954 | #ifdef FT_CONFIG_OPTION_PIC | ||
974 | 955 | /* Destroy pic container contents */ | ||
975 | 956 | ft_pic_container_destroy( library ); | ||
976 | 957 | Index: freetype-2.5.2/src/base/ftoutln.c | ||
977 | 958 | =================================================================== | ||
978 | 959 | --- freetype-2.5.2.orig/src/base/ftoutln.c 2015-01-26 16:49:42.692849510 +0100 | ||
979 | 960 | +++ freetype-2.5.2/src/base/ftoutln.c 2015-01-26 16:49:42.676849505 +0100 | ||
980 | 961 | @@ -606,7 +606,6 @@ | ||
981 | 962 | FT_Raster_Params* params ) | ||
982 | 963 | { | ||
983 | 964 | FT_Error error; | ||
984 | 965 | - FT_Bool update = FALSE; | ||
985 | 966 | FT_Renderer renderer; | ||
986 | 967 | FT_ListNode node; | ||
987 | 968 | |||
988 | 969 | @@ -637,14 +636,8 @@ | ||
989 | 970 | /* format */ | ||
990 | 971 | renderer = FT_Lookup_Renderer( library, FT_GLYPH_FORMAT_OUTLINE, | ||
991 | 972 | &node ); | ||
992 | 973 | - update = TRUE; | ||
993 | 974 | } | ||
994 | 975 | |||
995 | 976 | - /* if we changed the current renderer for the glyph image format */ | ||
996 | 977 | - /* we need to select it as the next current one */ | ||
997 | 978 | - if ( !error && update && renderer ) | ||
998 | 979 | - FT_Set_Renderer( library, renderer, 0, 0 ); | ||
999 | 980 | - | ||
1000 | 981 | return error; | ||
1001 | 982 | } | ||
1002 | 983 | |||
1003 | 984 | Index: freetype-2.5.2/src/raster/ftraster.c | ||
1004 | 985 | =================================================================== | ||
1005 | 986 | --- freetype-2.5.2.orig/src/raster/ftraster.c 2015-01-26 16:49:42.692849510 +0100 | ||
1006 | 987 | +++ freetype-2.5.2/src/raster/ftraster.c 2015-01-26 16:49:42.680849506 +0100 | ||
1007 | 988 | @@ -150,14 +150,6 @@ | ||
1008 | 989 | /* define DEBUG_RASTER if you want to compile a debugging version */ | ||
1009 | 990 | /* #define DEBUG_RASTER */ | ||
1010 | 991 | |||
1011 | 992 | - /* define FT_RASTER_OPTION_ANTI_ALIASING if you want to support */ | ||
1012 | 993 | - /* 5-levels anti-aliasing */ | ||
1013 | 994 | -/* #define FT_RASTER_OPTION_ANTI_ALIASING */ | ||
1014 | 995 | - | ||
1015 | 996 | - /* The size of the two-lines intermediate bitmap used */ | ||
1016 | 997 | - /* for anti-aliasing, in bytes. */ | ||
1017 | 998 | -#define RASTER_GRAY_LINES 2048 | ||
1018 | 999 | - | ||
1019 | 1000 | |||
1020 | 1001 | /*************************************************************************/ | ||
1021 | 1002 | /*************************************************************************/ | ||
1022 | 1003 | @@ -514,9 +506,6 @@ | ||
1023 | 1004 | |||
1024 | 1005 | Short traceIncr; /* sweep's increment in target bitmap */ | ||
1025 | 1006 | |||
1026 | 1007 | - Short gray_min_x; /* current min x during gray rendering */ | ||
1027 | 1008 | - Short gray_max_x; /* current max x during gray rendering */ | ||
1028 | 1009 | - | ||
1029 | 1010 | /* dispatch variables */ | ||
1030 | 1011 | |||
1031 | 1012 | Function_Sweep_Init* Proc_Sweep_Init; | ||
1032 | 1013 | @@ -529,45 +518,19 @@ | ||
1033 | 1014 | Bool second_pass; /* indicates whether a horizontal pass */ | ||
1034 | 1015 | /* should be performed to control */ | ||
1035 | 1016 | /* drop-out accurately when calling */ | ||
1036 | 1017 | - /* Render_Glyph. Note that there is */ | ||
1037 | 1018 | - /* no horizontal pass during gray */ | ||
1038 | 1019 | - /* rendering. */ | ||
1039 | 1020 | + /* Render_Glyph. */ | ||
1040 | 1021 | |||
1041 | 1022 | TPoint arcs[3 * MaxBezier + 1]; /* The Bezier stack */ | ||
1042 | 1023 | |||
1043 | 1024 | black_TBand band_stack[16]; /* band stack used for sub-banding */ | ||
1044 | 1025 | Int band_top; /* band stack top */ | ||
1045 | 1026 | |||
1046 | 1027 | -#ifdef FT_RASTER_OPTION_ANTI_ALIASING | ||
1047 | 1028 | - | ||
1048 | 1029 | - Byte* grays; | ||
1049 | 1030 | - | ||
1050 | 1031 | - Byte gray_lines[RASTER_GRAY_LINES]; | ||
1051 | 1032 | - /* Intermediate table used to render the */ | ||
1052 | 1033 | - /* graylevels pixmaps. */ | ||
1053 | 1034 | - /* gray_lines is a buffer holding two */ | ||
1054 | 1035 | - /* monochrome scanlines */ | ||
1055 | 1036 | - | ||
1056 | 1037 | - Short gray_width; /* width in bytes of one monochrome */ | ||
1057 | 1038 | - /* intermediate scanline of gray_lines. */ | ||
1058 | 1039 | - /* Each gray pixel takes 2 bits long there */ | ||
1059 | 1040 | - | ||
1060 | 1041 | - /* The gray_lines must hold 2 lines, thus with size */ | ||
1061 | 1042 | - /* in bytes of at least `gray_width*2'. */ | ||
1062 | 1043 | - | ||
1063 | 1044 | -#endif /* FT_RASTER_ANTI_ALIASING */ | ||
1064 | 1045 | - | ||
1065 | 1046 | }; | ||
1066 | 1047 | |||
1067 | 1048 | |||
1068 | 1049 | typedef struct black_TRaster_ | ||
1069 | 1050 | { | ||
1070 | 1051 | - char* buffer; | ||
1071 | 1052 | - long buffer_size; | ||
1072 | 1053 | void* memory; | ||
1073 | 1054 | - black_PWorker worker; | ||
1074 | 1055 | - Byte grays[5]; | ||
1075 | 1056 | - Short gray_width; | ||
1076 | 1057 | |||
1077 | 1058 | } black_TRaster, *black_PRaster; | ||
1078 | 1059 | |||
1079 | 1060 | @@ -583,70 +546,6 @@ | ||
1080 | 1061 | #endif /* !FT_STATIC_RASTER */ | ||
1081 | 1062 | |||
1082 | 1063 | |||
1083 | 1064 | -#ifdef FT_RASTER_OPTION_ANTI_ALIASING | ||
1084 | 1065 | - | ||
1085 | 1066 | - /* A lookup table used to quickly count set bits in four gray 2x2 */ | ||
1086 | 1067 | - /* cells. The values of the table have been produced with the */ | ||
1087 | 1068 | - /* following code: */ | ||
1088 | 1069 | - /* */ | ||
1089 | 1070 | - /* for ( i = 0; i < 256; i++ ) */ | ||
1090 | 1071 | - /* { */ | ||
1091 | 1072 | - /* l = 0; */ | ||
1092 | 1073 | - /* j = i; */ | ||
1093 | 1074 | - /* */ | ||
1094 | 1075 | - /* for ( c = 0; c < 4; c++ ) */ | ||
1095 | 1076 | - /* { */ | ||
1096 | 1077 | - /* l <<= 4; */ | ||
1097 | 1078 | - /* */ | ||
1098 | 1079 | - /* if ( j & 0x80 ) l++; */ | ||
1099 | 1080 | - /* if ( j & 0x40 ) l++; */ | ||
1100 | 1081 | - /* */ | ||
1101 | 1082 | - /* j = ( j << 2 ) & 0xFF; */ | ||
1102 | 1083 | - /* } */ | ||
1103 | 1084 | - /* printf( "0x%04X", l ); */ | ||
1104 | 1085 | - /* } */ | ||
1105 | 1086 | - /* */ | ||
1106 | 1087 | - | ||
1107 | 1088 | - static const short count_table[256] = | ||
1108 | 1089 | - { | ||
1109 | 1090 | - 0x0000, 0x0001, 0x0001, 0x0002, 0x0010, 0x0011, 0x0011, 0x0012, | ||
1110 | 1091 | - 0x0010, 0x0011, 0x0011, 0x0012, 0x0020, 0x0021, 0x0021, 0x0022, | ||
1111 | 1092 | - 0x0100, 0x0101, 0x0101, 0x0102, 0x0110, 0x0111, 0x0111, 0x0112, | ||
1112 | 1093 | - 0x0110, 0x0111, 0x0111, 0x0112, 0x0120, 0x0121, 0x0121, 0x0122, | ||
1113 | 1094 | - 0x0100, 0x0101, 0x0101, 0x0102, 0x0110, 0x0111, 0x0111, 0x0112, | ||
1114 | 1095 | - 0x0110, 0x0111, 0x0111, 0x0112, 0x0120, 0x0121, 0x0121, 0x0122, | ||
1115 | 1096 | - 0x0200, 0x0201, 0x0201, 0x0202, 0x0210, 0x0211, 0x0211, 0x0212, | ||
1116 | 1097 | - 0x0210, 0x0211, 0x0211, 0x0212, 0x0220, 0x0221, 0x0221, 0x0222, | ||
1117 | 1098 | - 0x1000, 0x1001, 0x1001, 0x1002, 0x1010, 0x1011, 0x1011, 0x1012, | ||
1118 | 1099 | - 0x1010, 0x1011, 0x1011, 0x1012, 0x1020, 0x1021, 0x1021, 0x1022, | ||
1119 | 1100 | - 0x1100, 0x1101, 0x1101, 0x1102, 0x1110, 0x1111, 0x1111, 0x1112, | ||
1120 | 1101 | - 0x1110, 0x1111, 0x1111, 0x1112, 0x1120, 0x1121, 0x1121, 0x1122, | ||
1121 | 1102 | - 0x1100, 0x1101, 0x1101, 0x1102, 0x1110, 0x1111, 0x1111, 0x1112, | ||
1122 | 1103 | - 0x1110, 0x1111, 0x1111, 0x1112, 0x1120, 0x1121, 0x1121, 0x1122, | ||
1123 | 1104 | - 0x1200, 0x1201, 0x1201, 0x1202, 0x1210, 0x1211, 0x1211, 0x1212, | ||
1124 | 1105 | - 0x1210, 0x1211, 0x1211, 0x1212, 0x1220, 0x1221, 0x1221, 0x1222, | ||
1125 | 1106 | - 0x1000, 0x1001, 0x1001, 0x1002, 0x1010, 0x1011, 0x1011, 0x1012, | ||
1126 | 1107 | - 0x1010, 0x1011, 0x1011, 0x1012, 0x1020, 0x1021, 0x1021, 0x1022, | ||
1127 | 1108 | - 0x1100, 0x1101, 0x1101, 0x1102, 0x1110, 0x1111, 0x1111, 0x1112, | ||
1128 | 1109 | - 0x1110, 0x1111, 0x1111, 0x1112, 0x1120, 0x1121, 0x1121, 0x1122, | ||
1129 | 1110 | - 0x1100, 0x1101, 0x1101, 0x1102, 0x1110, 0x1111, 0x1111, 0x1112, | ||
1130 | 1111 | - 0x1110, 0x1111, 0x1111, 0x1112, 0x1120, 0x1121, 0x1121, 0x1122, | ||
1131 | 1112 | - 0x1200, 0x1201, 0x1201, 0x1202, 0x1210, 0x1211, 0x1211, 0x1212, | ||
1132 | 1113 | - 0x1210, 0x1211, 0x1211, 0x1212, 0x1220, 0x1221, 0x1221, 0x1222, | ||
1133 | 1114 | - 0x2000, 0x2001, 0x2001, 0x2002, 0x2010, 0x2011, 0x2011, 0x2012, | ||
1134 | 1115 | - 0x2010, 0x2011, 0x2011, 0x2012, 0x2020, 0x2021, 0x2021, 0x2022, | ||
1135 | 1116 | - 0x2100, 0x2101, 0x2101, 0x2102, 0x2110, 0x2111, 0x2111, 0x2112, | ||
1136 | 1117 | - 0x2110, 0x2111, 0x2111, 0x2112, 0x2120, 0x2121, 0x2121, 0x2122, | ||
1137 | 1118 | - 0x2100, 0x2101, 0x2101, 0x2102, 0x2110, 0x2111, 0x2111, 0x2112, | ||
1138 | 1119 | - 0x2110, 0x2111, 0x2111, 0x2112, 0x2120, 0x2121, 0x2121, 0x2122, | ||
1139 | 1120 | - 0x2200, 0x2201, 0x2201, 0x2202, 0x2210, 0x2211, 0x2211, 0x2212, | ||
1140 | 1121 | - 0x2210, 0x2211, 0x2211, 0x2212, 0x2220, 0x2221, 0x2221, 0x2222 | ||
1141 | 1122 | - }; | ||
1142 | 1123 | - | ||
1143 | 1124 | -#endif /* FT_RASTER_OPTION_ANTI_ALIASING */ | ||
1144 | 1125 | - | ||
1145 | 1126 | - | ||
1146 | 1127 | - | ||
1147 | 1128 | /*************************************************************************/ | ||
1148 | 1129 | /*************************************************************************/ | ||
1149 | 1130 | /** **/ | ||
1150 | 1131 | @@ -2083,7 +1982,8 @@ | ||
1151 | 1132 | /* to be drawn. */ | ||
1152 | 1133 | |||
1153 | 1134 | lastProfile = ras.cProfile; | ||
1154 | 1135 | - if ( ras.cProfile->flags & Flow_Up ) | ||
1155 | 1136 | + if ( ras.top != ras.cProfile->offset && | ||
1156 | 1137 | + ( ras.cProfile->flags & Flow_Up ) ) | ||
1157 | 1138 | o = IS_TOP_OVERSHOOT( ras.lastY ); | ||
1158 | 1139 | else | ||
1159 | 1140 | o = IS_BOTTOM_OVERSHOOT( ras.lastY ); | ||
1160 | 1141 | @@ -2268,9 +2168,6 @@ | ||
1161 | 1142 | ras.traceOfs = -*min * pitch; | ||
1162 | 1143 | if ( pitch > 0 ) | ||
1163 | 1144 | ras.traceOfs += ( ras.target.rows - 1 ) * pitch; | ||
1164 | 1145 | - | ||
1165 | 1146 | - ras.gray_min_x = 0; | ||
1166 | 1147 | - ras.gray_max_x = 0; | ||
1167 | 1148 | } | ||
1168 | 1149 | |||
1169 | 1150 | |||
1170 | 1151 | @@ -2315,11 +2212,6 @@ | ||
1171 | 1152 | f1 = (Byte) ( 0xFF >> ( e1 & 7 ) ); | ||
1172 | 1153 | f2 = (Byte) ~( 0x7F >> ( e2 & 7 ) ); | ||
1173 | 1154 | |||
1174 | 1155 | - if ( ras.gray_min_x > c1 ) | ||
1175 | 1156 | - ras.gray_min_x = (short)c1; | ||
1176 | 1157 | - if ( ras.gray_max_x < c2 ) | ||
1177 | 1158 | - ras.gray_max_x = (short)c2; | ||
1178 | 1159 | - | ||
1179 | 1160 | target = ras.bTarget + ras.traceOfs + c1; | ||
1180 | 1161 | c2 -= c1; | ||
1181 | 1162 | |||
1182 | 1163 | @@ -2483,11 +2375,6 @@ | ||
1183 | 1164 | c1 = (Short)( e1 >> 3 ); | ||
1184 | 1165 | f1 = (Short)( e1 & 7 ); | ||
1185 | 1166 | |||
1186 | 1167 | - if ( ras.gray_min_x > c1 ) | ||
1187 | 1168 | - ras.gray_min_x = c1; | ||
1188 | 1169 | - if ( ras.gray_max_x < c1 ) | ||
1189 | 1170 | - ras.gray_max_x = c1; | ||
1190 | 1171 | - | ||
1191 | 1172 | ras.bTarget[ras.traceOfs + c1] |= (char)( 0x80 >> f1 ); | ||
1192 | 1173 | } | ||
1193 | 1174 | } | ||
1194 | 1175 | @@ -2692,249 +2579,6 @@ | ||
1195 | 1176 | } | ||
1196 | 1177 | |||
1197 | 1178 | |||
1198 | 1179 | -#ifdef FT_RASTER_OPTION_ANTI_ALIASING | ||
1199 | 1180 | - | ||
1200 | 1181 | - | ||
1201 | 1182 | - /*************************************************************************/ | ||
1202 | 1183 | - /* */ | ||
1203 | 1184 | - /* Vertical Gray Sweep Procedure Set */ | ||
1204 | 1185 | - /* */ | ||
1205 | 1186 | - /* These two routines are used during the vertical gray-levels sweep */ | ||
1206 | 1187 | - /* phase by the generic Draw_Sweep() function. */ | ||
1207 | 1188 | - /* */ | ||
1208 | 1189 | - /* NOTES */ | ||
1209 | 1190 | - /* */ | ||
1210 | 1191 | - /* - The target pixmap's width *must* be a multiple of 4. */ | ||
1211 | 1192 | - /* */ | ||
1212 | 1193 | - /* - You have to use the function Vertical_Sweep_Span() for the gray */ | ||
1213 | 1194 | - /* span call. */ | ||
1214 | 1195 | - /* */ | ||
1215 | 1196 | - /*************************************************************************/ | ||
1216 | 1197 | - | ||
1217 | 1198 | - static void | ||
1218 | 1199 | - Vertical_Gray_Sweep_Init( RAS_ARGS Short* min, | ||
1219 | 1200 | - Short* max ) | ||
1220 | 1201 | - { | ||
1221 | 1202 | - Long pitch, byte_len; | ||
1222 | 1203 | - | ||
1223 | 1204 | - | ||
1224 | 1205 | - *min = *min & -2; | ||
1225 | 1206 | - *max = ( *max + 3 ) & -2; | ||
1226 | 1207 | - | ||
1227 | 1208 | - ras.traceOfs = 0; | ||
1228 | 1209 | - pitch = ras.target.pitch; | ||
1229 | 1210 | - byte_len = -pitch; | ||
1230 | 1211 | - ras.traceIncr = (Short)byte_len; | ||
1231 | 1212 | - ras.traceG = ( *min / 2 ) * byte_len; | ||
1232 | 1213 | - | ||
1233 | 1214 | - if ( pitch > 0 ) | ||
1234 | 1215 | - { | ||
1235 | 1216 | - ras.traceG += ( ras.target.rows - 1 ) * pitch; | ||
1236 | 1217 | - byte_len = -byte_len; | ||
1237 | 1218 | - } | ||
1238 | 1219 | - | ||
1239 | 1220 | - ras.gray_min_x = (Short)byte_len; | ||
1240 | 1221 | - ras.gray_max_x = -(Short)byte_len; | ||
1241 | 1222 | - } | ||
1242 | 1223 | - | ||
1243 | 1224 | - | ||
1244 | 1225 | - static void | ||
1245 | 1226 | - Vertical_Gray_Sweep_Step( RAS_ARG ) | ||
1246 | 1227 | - { | ||
1247 | 1228 | - short* count = (short*)count_table; | ||
1248 | 1229 | - Byte* grays; | ||
1249 | 1230 | - | ||
1250 | 1231 | - | ||
1251 | 1232 | - ras.traceOfs += ras.gray_width; | ||
1252 | 1233 | - | ||
1253 | 1234 | - if ( ras.traceOfs > ras.gray_width ) | ||
1254 | 1235 | - { | ||
1255 | 1236 | - PByte pix; | ||
1256 | 1237 | - | ||
1257 | 1238 | - | ||
1258 | 1239 | - pix = ras.gTarget + ras.traceG + ras.gray_min_x * 4; | ||
1259 | 1240 | - grays = ras.grays; | ||
1260 | 1241 | - | ||
1261 | 1242 | - if ( ras.gray_max_x >= 0 ) | ||
1262 | 1243 | - { | ||
1263 | 1244 | - Long last_pixel = ras.target.width - 1; | ||
1264 | 1245 | - Int last_cell = last_pixel >> 2; | ||
1265 | 1246 | - Int last_bit = last_pixel & 3; | ||
1266 | 1247 | - Bool over = 0; | ||
1267 | 1248 | - | ||
1268 | 1249 | - Int c1, c2; | ||
1269 | 1250 | - PByte bit, bit2; | ||
1270 | 1251 | - | ||
1271 | 1252 | - | ||
1272 | 1253 | - if ( ras.gray_max_x >= last_cell && last_bit != 3 ) | ||
1273 | 1254 | - { | ||
1274 | 1255 | - ras.gray_max_x = last_cell - 1; | ||
1275 | 1256 | - over = 1; | ||
1276 | 1257 | - } | ||
1277 | 1258 | - | ||
1278 | 1259 | - if ( ras.gray_min_x < 0 ) | ||
1279 | 1260 | - ras.gray_min_x = 0; | ||
1280 | 1261 | - | ||
1281 | 1262 | - bit = ras.bTarget + ras.gray_min_x; | ||
1282 | 1263 | - bit2 = bit + ras.gray_width; | ||
1283 | 1264 | - | ||
1284 | 1265 | - c1 = ras.gray_max_x - ras.gray_min_x; | ||
1285 | 1266 | - | ||
1286 | 1267 | - while ( c1 >= 0 ) | ||
1287 | 1268 | - { | ||
1288 | 1269 | - c2 = count[*bit] + count[*bit2]; | ||
1289 | 1270 | - | ||
1290 | 1271 | - if ( c2 ) | ||
1291 | 1272 | - { | ||
1292 | 1273 | - pix[0] = grays[(c2 >> 12) & 0x000F]; | ||
1293 | 1274 | - pix[1] = grays[(c2 >> 8 ) & 0x000F]; | ||
1294 | 1275 | - pix[2] = grays[(c2 >> 4 ) & 0x000F]; | ||
1295 | 1276 | - pix[3] = grays[ c2 & 0x000F]; | ||
1296 | 1277 | - | ||
1297 | 1278 | - *bit = 0; | ||
1298 | 1279 | - *bit2 = 0; | ||
1299 | 1280 | - } | ||
1300 | 1281 | - | ||
1301 | 1282 | - bit++; | ||
1302 | 1283 | - bit2++; | ||
1303 | 1284 | - pix += 4; | ||
1304 | 1285 | - c1--; | ||
1305 | 1286 | - } | ||
1306 | 1287 | - | ||
1307 | 1288 | - if ( over ) | ||
1308 | 1289 | - { | ||
1309 | 1290 | - c2 = count[*bit] + count[*bit2]; | ||
1310 | 1291 | - if ( c2 ) | ||
1311 | 1292 | - { | ||
1312 | 1293 | - switch ( last_bit ) | ||
1313 | 1294 | - { | ||
1314 | 1295 | - case 2: | ||
1315 | 1296 | - pix[2] = grays[(c2 >> 4 ) & 0x000F]; | ||
1316 | 1297 | - case 1: | ||
1317 | 1298 | - pix[1] = grays[(c2 >> 8 ) & 0x000F]; | ||
1318 | 1299 | - default: | ||
1319 | 1300 | - pix[0] = grays[(c2 >> 12) & 0x000F]; | ||
1320 | 1301 | - } | ||
1321 | 1302 | - | ||
1322 | 1303 | - *bit = 0; | ||
1323 | 1304 | - *bit2 = 0; | ||
1324 | 1305 | - } | ||
1325 | 1306 | - } | ||
1326 | 1307 | - } | ||
1327 | 1308 | - | ||
1328 | 1309 | - ras.traceOfs = 0; | ||
1329 | 1310 | - ras.traceG += ras.traceIncr; | ||
1330 | 1311 | - | ||
1331 | 1312 | - ras.gray_min_x = 32000; | ||
1332 | 1313 | - ras.gray_max_x = -32000; | ||
1333 | 1314 | - } | ||
1334 | 1315 | - } | ||
1335 | 1316 | - | ||
1336 | 1317 | - | ||
1337 | 1318 | - static void | ||
1338 | 1319 | - Horizontal_Gray_Sweep_Span( RAS_ARGS Short y, | ||
1339 | 1320 | - FT_F26Dot6 x1, | ||
1340 | 1321 | - FT_F26Dot6 x2, | ||
1341 | 1322 | - PProfile left, | ||
1342 | 1323 | - PProfile right ) | ||
1343 | 1324 | - { | ||
1344 | 1325 | - /* nothing, really */ | ||
1345 | 1326 | - FT_UNUSED_RASTER; | ||
1346 | 1327 | - FT_UNUSED( y ); | ||
1347 | 1328 | - FT_UNUSED( x1 ); | ||
1348 | 1329 | - FT_UNUSED( x2 ); | ||
1349 | 1330 | - FT_UNUSED( left ); | ||
1350 | 1331 | - FT_UNUSED( right ); | ||
1351 | 1332 | - } | ||
1352 | 1333 | - | ||
1353 | 1334 | - | ||
1354 | 1335 | - static void | ||
1355 | 1336 | - Horizontal_Gray_Sweep_Drop( RAS_ARGS Short y, | ||
1356 | 1337 | - FT_F26Dot6 x1, | ||
1357 | 1338 | - FT_F26Dot6 x2, | ||
1358 | 1339 | - PProfile left, | ||
1359 | 1340 | - PProfile right ) | ||
1360 | 1341 | - { | ||
1361 | 1342 | - Long e1, e2; | ||
1362 | 1343 | - PByte pixel; | ||
1363 | 1344 | - | ||
1364 | 1345 | - | ||
1365 | 1346 | - /* During the horizontal sweep, we only take care of drop-outs */ | ||
1366 | 1347 | - | ||
1367 | 1348 | - e1 = CEILING( x1 ); | ||
1368 | 1349 | - e2 = FLOOR ( x2 ); | ||
1369 | 1350 | - | ||
1370 | 1351 | - if ( e1 > e2 ) | ||
1371 | 1352 | - { | ||
1372 | 1353 | - Int dropOutControl = left->flags & 7; | ||
1373 | 1354 | - | ||
1374 | 1355 | - | ||
1375 | 1356 | - if ( e1 == e2 + ras.precision ) | ||
1376 | 1357 | - { | ||
1377 | 1358 | - switch ( dropOutControl ) | ||
1378 | 1359 | - { | ||
1379 | 1360 | - case 0: /* simple drop-outs including stubs */ | ||
1380 | 1361 | - e1 = e2; | ||
1381 | 1362 | - break; | ||
1382 | 1363 | - | ||
1383 | 1364 | - case 4: /* smart drop-outs including stubs */ | ||
1384 | 1365 | - e1 = FLOOR( ( x1 + x2 - 1 ) / 2 + ras.precision_half ); | ||
1385 | 1366 | - break; | ||
1386 | 1367 | - | ||
1387 | 1368 | - case 1: /* simple drop-outs excluding stubs */ | ||
1388 | 1369 | - case 5: /* smart drop-outs excluding stubs */ | ||
1389 | 1370 | - /* see Vertical_Sweep_Drop for details */ | ||
1390 | 1371 | - | ||
1391 | 1372 | - /* rightmost stub test */ | ||
1392 | 1373 | - if ( left->next == right && left->height <= 0 ) | ||
1393 | 1374 | - return; | ||
1394 | 1375 | - | ||
1395 | 1376 | - /* leftmost stub test */ | ||
1396 | 1377 | - if ( right->next == left && left->start == y ) | ||
1397 | 1378 | - return; | ||
1398 | 1379 | - | ||
1399 | 1380 | - if ( dropOutControl == 1 ) | ||
1400 | 1381 | - e1 = e2; | ||
1401 | 1382 | - else | ||
1402 | 1383 | - e1 = FLOOR( ( x1 + x2 - 1 ) / 2 + ras.precision_half ); | ||
1403 | 1384 | - | ||
1404 | 1385 | - break; | ||
1405 | 1386 | - | ||
1406 | 1387 | - default: /* modes 2, 3, 6, 7 */ | ||
1407 | 1388 | - return; /* no drop-out control */ | ||
1408 | 1389 | - } | ||
1409 | 1390 | - } | ||
1410 | 1391 | - else | ||
1411 | 1392 | - return; | ||
1412 | 1393 | - } | ||
1413 | 1394 | - | ||
1414 | 1395 | - if ( e1 >= 0 ) | ||
1415 | 1396 | - { | ||
1416 | 1397 | - Byte color; | ||
1417 | 1398 | - | ||
1418 | 1399 | - | ||
1419 | 1400 | - if ( x2 - x1 >= ras.precision_half ) | ||
1420 | 1401 | - color = ras.grays[2]; | ||
1421 | 1402 | - else | ||
1422 | 1403 | - color = ras.grays[1]; | ||
1423 | 1404 | - | ||
1424 | 1405 | - e1 = TRUNC( e1 ) / 2; | ||
1425 | 1406 | - if ( e1 < ras.target.rows ) | ||
1426 | 1407 | - { | ||
1427 | 1408 | - pixel = ras.gTarget - e1 * ras.target.pitch + y / 2; | ||
1428 | 1409 | - if ( ras.target.pitch > 0 ) | ||
1429 | 1410 | - pixel += ( ras.target.rows - 1 ) * ras.target.pitch; | ||
1430 | 1411 | - | ||
1431 | 1412 | - if ( pixel[0] == ras.grays[0] ) | ||
1432 | 1413 | - pixel[0] = color; | ||
1433 | 1414 | - } | ||
1434 | 1415 | - } | ||
1435 | 1416 | - } | ||
1436 | 1417 | - | ||
1437 | 1418 | - | ||
1438 | 1419 | -#endif /* FT_RASTER_OPTION_ANTI_ALIASING */ | ||
1439 | 1420 | - | ||
1440 | 1421 | - | ||
1441 | 1422 | /*************************************************************************/ | ||
1442 | 1423 | /* */ | ||
1443 | 1424 | /* Generic Sweep Drawing routine */ | ||
1444 | 1425 | @@ -3329,118 +2973,10 @@ | ||
1445 | 1426 | } | ||
1446 | 1427 | |||
1447 | 1428 | |||
1448 | 1429 | -#ifdef FT_RASTER_OPTION_ANTI_ALIASING | ||
1449 | 1430 | - | ||
1450 | 1431 | - /*************************************************************************/ | ||
1451 | 1432 | - /* */ | ||
1452 | 1433 | - /* <Function> */ | ||
1453 | 1434 | - /* Render_Gray_Glyph */ | ||
1454 | 1435 | - /* */ | ||
1455 | 1436 | - /* <Description> */ | ||
1456 | 1437 | - /* Render a glyph with grayscaling. Sub-banding if needed. */ | ||
1457 | 1438 | - /* */ | ||
1458 | 1439 | - /* <Return> */ | ||
1459 | 1440 | - /* FreeType error code. 0 means success. */ | ||
1460 | 1441 | - /* */ | ||
1461 | 1442 | - FT_LOCAL_DEF( FT_Error ) | ||
1462 | 1443 | - Render_Gray_Glyph( RAS_ARG ) | ||
1463 | 1444 | - { | ||
1464 | 1445 | - Long pixel_width; | ||
1465 | 1446 | - FT_Error error; | ||
1466 | 1447 | - | ||
1467 | 1448 | - | ||
1468 | 1449 | - Set_High_Precision( RAS_VARS ras.outline.flags & | ||
1469 | 1450 | - FT_OUTLINE_HIGH_PRECISION ); | ||
1470 | 1451 | - ras.scale_shift = ras.precision_shift + 1; | ||
1471 | 1452 | - | ||
1472 | 1453 | - if ( ras.outline.flags & FT_OUTLINE_IGNORE_DROPOUTS ) | ||
1473 | 1454 | - ras.dropOutControl = 2; | ||
1474 | 1455 | - else | ||
1475 | 1456 | - { | ||
1476 | 1457 | - if ( ras.outline.flags & FT_OUTLINE_SMART_DROPOUTS ) | ||
1477 | 1458 | - ras.dropOutControl = 4; | ||
1478 | 1459 | - else | ||
1479 | 1460 | - ras.dropOutControl = 0; | ||
1480 | 1461 | - | ||
1481 | 1462 | - if ( !( ras.outline.flags & FT_OUTLINE_INCLUDE_STUBS ) ) | ||
1482 | 1463 | - ras.dropOutControl += 1; | ||
1483 | 1464 | - } | ||
1484 | 1465 | - | ||
1485 | 1466 | - ras.second_pass = !( ras.outline.flags & FT_OUTLINE_SINGLE_PASS ); | ||
1486 | 1467 | - | ||
1487 | 1468 | - /* Vertical Sweep */ | ||
1488 | 1469 | - | ||
1489 | 1470 | - ras.band_top = 0; | ||
1490 | 1471 | - ras.band_stack[0].y_min = 0; | ||
1491 | 1472 | - ras.band_stack[0].y_max = 2 * ras.target.rows - 1; | ||
1492 | 1473 | - | ||
1493 | 1474 | - ras.bWidth = ras.gray_width; | ||
1494 | 1475 | - pixel_width = 2 * ( ( ras.target.width + 3 ) >> 2 ); | ||
1495 | 1476 | - | ||
1496 | 1477 | - if ( ras.bWidth > pixel_width ) | ||
1497 | 1478 | - ras.bWidth = pixel_width; | ||
1498 | 1479 | - | ||
1499 | 1480 | - ras.bWidth = ras.bWidth * 8; | ||
1500 | 1481 | - ras.bTarget = (Byte*)ras.gray_lines; | ||
1501 | 1482 | - ras.gTarget = (Byte*)ras.target.buffer; | ||
1502 | 1483 | - | ||
1503 | 1484 | - ras.Proc_Sweep_Init = Vertical_Gray_Sweep_Init; | ||
1504 | 1485 | - ras.Proc_Sweep_Span = Vertical_Sweep_Span; | ||
1505 | 1486 | - ras.Proc_Sweep_Drop = Vertical_Sweep_Drop; | ||
1506 | 1487 | - ras.Proc_Sweep_Step = Vertical_Gray_Sweep_Step; | ||
1507 | 1488 | - | ||
1508 | 1489 | - error = Render_Single_Pass( RAS_VARS 0 ); | ||
1509 | 1490 | - if ( error ) | ||
1510 | 1491 | - return error; | ||
1511 | 1492 | - | ||
1512 | 1493 | - /* Horizontal Sweep */ | ||
1513 | 1494 | - if ( ras.second_pass && ras.dropOutControl != 2 ) | ||
1514 | 1495 | - { | ||
1515 | 1496 | - ras.Proc_Sweep_Init = Horizontal_Sweep_Init; | ||
1516 | 1497 | - ras.Proc_Sweep_Span = Horizontal_Gray_Sweep_Span; | ||
1517 | 1498 | - ras.Proc_Sweep_Drop = Horizontal_Gray_Sweep_Drop; | ||
1518 | 1499 | - ras.Proc_Sweep_Step = Horizontal_Sweep_Step; | ||
1519 | 1500 | - | ||
1520 | 1501 | - ras.band_top = 0; | ||
1521 | 1502 | - ras.band_stack[0].y_min = 0; | ||
1522 | 1503 | - ras.band_stack[0].y_max = ras.target.width * 2 - 1; | ||
1523 | 1504 | - | ||
1524 | 1505 | - error = Render_Single_Pass( RAS_VARS 1 ); | ||
1525 | 1506 | - if ( error ) | ||
1526 | 1507 | - return error; | ||
1527 | 1508 | - } | ||
1528 | 1509 | - | ||
1529 | 1510 | - return Raster_Err_None; | ||
1530 | 1511 | - } | ||
1531 | 1512 | - | ||
1532 | 1513 | -#else /* !FT_RASTER_OPTION_ANTI_ALIASING */ | ||
1533 | 1514 | - | ||
1534 | 1515 | - FT_LOCAL_DEF( FT_Error ) | ||
1535 | 1516 | - Render_Gray_Glyph( RAS_ARG ) | ||
1536 | 1517 | - { | ||
1537 | 1518 | - FT_UNUSED_RASTER; | ||
1538 | 1519 | - | ||
1539 | 1520 | - return FT_THROW( Unsupported ); | ||
1540 | 1521 | - } | ||
1541 | 1522 | - | ||
1542 | 1523 | -#endif /* !FT_RASTER_OPTION_ANTI_ALIASING */ | ||
1543 | 1524 | - | ||
1544 | 1525 | - | ||
1545 | 1526 | static void | ||
1546 | 1527 | ft_black_init( black_PRaster raster ) | ||
1547 | 1528 | { | ||
1548 | 1529 | -#ifdef FT_RASTER_OPTION_ANTI_ALIASING | ||
1549 | 1530 | - FT_UInt n; | ||
1550 | 1531 | - | ||
1551 | 1532 | - | ||
1552 | 1533 | - /* set default 5-levels gray palette */ | ||
1553 | 1534 | - for ( n = 0; n < 5; n++ ) | ||
1554 | 1535 | - raster->grays[n] = n * 255 / 4; | ||
1555 | 1536 | - | ||
1556 | 1537 | - raster->gray_width = RASTER_GRAY_LINES / 2; | ||
1557 | 1538 | -#else | ||
1558 | 1539 | FT_UNUSED( raster ); | ||
1559 | 1540 | -#endif | ||
1560 | 1541 | } | ||
1561 | 1542 | |||
1562 | 1543 | |||
1563 | 1544 | @@ -3517,25 +3053,9 @@ | ||
1564 | 1545 | char* pool_base, | ||
1565 | 1546 | long pool_size ) | ||
1566 | 1547 | { | ||
1567 | 1548 | - if ( raster ) | ||
1568 | 1549 | - { | ||
1569 | 1550 | - if ( pool_base && pool_size >= (long)sizeof ( black_TWorker ) + 2048 ) | ||
1570 | 1551 | - { | ||
1571 | 1552 | - black_PWorker worker = (black_PWorker)pool_base; | ||
1572 | 1553 | - | ||
1573 | 1554 | - | ||
1574 | 1555 | - raster->buffer = pool_base + ( ( sizeof ( *worker ) + 7 ) & ~7 ); | ||
1575 | 1556 | - raster->buffer_size = (long)( pool_base + pool_size - | ||
1576 | 1557 | - (char*)raster->buffer ); | ||
1577 | 1558 | - raster->worker = worker; | ||
1578 | 1559 | - } | ||
1579 | 1560 | - else | ||
1580 | 1561 | - { | ||
1581 | 1562 | - raster->buffer = NULL; | ||
1582 | 1563 | - raster->buffer_size = 0; | ||
1583 | 1564 | - raster->worker = NULL; | ||
1584 | 1565 | - } | ||
1585 | 1566 | - } | ||
1586 | 1567 | + FT_UNUSED( raster ); | ||
1587 | 1568 | + FT_UNUSED( pool_base ); | ||
1588 | 1569 | + FT_UNUSED( pool_size ); | ||
1589 | 1570 | } | ||
1590 | 1571 | |||
1591 | 1572 | |||
1592 | 1573 | @@ -3544,25 +3064,9 @@ | ||
1593 | 1574 | unsigned long mode, | ||
1594 | 1575 | const char* palette ) | ||
1595 | 1576 | { | ||
1596 | 1577 | -#ifdef FT_RASTER_OPTION_ANTI_ALIASING | ||
1597 | 1578 | - | ||
1598 | 1579 | - if ( mode == FT_MAKE_TAG( 'p', 'a', 'l', '5' ) ) | ||
1599 | 1580 | - { | ||
1600 | 1581 | - /* set 5-levels gray palette */ | ||
1601 | 1582 | - raster->grays[0] = palette[0]; | ||
1602 | 1583 | - raster->grays[1] = palette[1]; | ||
1603 | 1584 | - raster->grays[2] = palette[2]; | ||
1604 | 1585 | - raster->grays[3] = palette[3]; | ||
1605 | 1586 | - raster->grays[4] = palette[4]; | ||
1606 | 1587 | - } | ||
1607 | 1588 | - | ||
1608 | 1589 | -#else | ||
1609 | 1590 | - | ||
1610 | 1591 | FT_UNUSED( raster ); | ||
1611 | 1592 | FT_UNUSED( mode ); | ||
1612 | 1593 | FT_UNUSED( palette ); | ||
1613 | 1594 | - | ||
1614 | 1595 | -#endif | ||
1615 | 1596 | } | ||
1616 | 1597 | |||
1617 | 1598 | |||
1618 | 1599 | @@ -3572,10 +3076,13 @@ | ||
1619 | 1600 | { | ||
1620 | 1601 | const FT_Outline* outline = (const FT_Outline*)params->source; | ||
1621 | 1602 | const FT_Bitmap* target_map = params->target; | ||
1622 | 1603 | - black_PWorker worker; | ||
1623 | 1604 | |||
1624 | 1605 | + black_TWorker worker[1]; | ||
1625 | 1606 | |||
1626 | 1607 | - if ( !raster || !raster->buffer || !raster->buffer_size ) | ||
1627 | 1608 | + Long buffer[FT_MAX( FT_RENDER_POOL_SIZE, 2048 ) / sizeof ( Long )]; | ||
1628 | 1609 | + | ||
1629 | 1610 | + | ||
1630 | 1611 | + if ( !raster ) | ||
1631 | 1612 | return FT_THROW( Not_Ini ); | ||
1632 | 1613 | |||
1633 | 1614 | if ( !outline ) | ||
1634 | 1615 | @@ -3592,12 +3099,13 @@ | ||
1635 | 1616 | outline->contours[outline->n_contours - 1] + 1 ) | ||
1636 | 1617 | return FT_THROW( Invalid ); | ||
1637 | 1618 | |||
1638 | 1619 | - worker = raster->worker; | ||
1639 | 1620 | - | ||
1640 | 1621 | /* this version of the raster does not support direct rendering, sorry */ | ||
1641 | 1622 | if ( params->flags & FT_RASTER_FLAG_DIRECT ) | ||
1642 | 1623 | return FT_THROW( Unsupported ); | ||
1643 | 1624 | |||
1644 | 1625 | + if ( params->flags & FT_RASTER_FLAG_AA ) | ||
1645 | 1626 | + return FT_THROW( Unsupported ); | ||
1646 | 1627 | + | ||
1647 | 1628 | if ( !target_map ) | ||
1648 | 1629 | return FT_THROW( Invalid ); | ||
1649 | 1630 | |||
1650 | 1631 | @@ -3611,19 +3119,10 @@ | ||
1651 | 1632 | ras.outline = *outline; | ||
1652 | 1633 | ras.target = *target_map; | ||
1653 | 1634 | |||
1654 | 1635 | - worker->buff = (PLong) raster->buffer; | ||
1655 | 1636 | - worker->sizeBuff = worker->buff + | ||
1656 | 1637 | - raster->buffer_size / sizeof ( Long ); | ||
1657 | 1638 | -#ifdef FT_RASTER_OPTION_ANTI_ALIASING | ||
1658 | 1639 | - worker->grays = raster->grays; | ||
1659 | 1640 | - worker->gray_width = raster->gray_width; | ||
1660 | 1641 | - | ||
1661 | 1642 | - FT_MEM_ZERO( worker->gray_lines, worker->gray_width * 2 ); | ||
1662 | 1643 | -#endif | ||
1663 | 1644 | + worker->buff = buffer; | ||
1664 | 1645 | + worker->sizeBuff = (&buffer)[1]; /* Points to right after buffer. */ | ||
1665 | 1646 | |||
1666 | 1647 | - return ( params->flags & FT_RASTER_FLAG_AA ) | ||
1667 | 1648 | - ? Render_Gray_Glyph( RAS_VAR ) | ||
1668 | 1649 | - : Render_Glyph( RAS_VAR ); | ||
1669 | 1650 | + return Render_Glyph( RAS_VAR ); | ||
1670 | 1651 | } | ||
1671 | 1652 | |||
1672 | 1653 | |||
1673 | 1654 | Index: freetype-2.5.2/src/raster/ftrend1.c | ||
1674 | 1655 | =================================================================== | ||
1675 | 1656 | --- freetype-2.5.2.orig/src/raster/ftrend1.c 2015-01-26 16:49:42.692849510 +0100 | ||
1676 | 1657 | +++ freetype-2.5.2/src/raster/ftrend1.c 2015-01-26 16:56:56.633016853 +0100 | ||
1677 | 1658 | @@ -120,38 +120,11 @@ | ||
1678 | 1659 | } | ||
1679 | 1660 | |||
1680 | 1661 | /* check rendering mode */ | ||
1681 | 1662 | -#ifndef FT_CONFIG_OPTION_PIC | ||
1682 | 1663 | if ( mode != FT_RENDER_MODE_MONO ) | ||
1683 | 1664 | { | ||
1684 | 1665 | /* raster1 is only capable of producing monochrome bitmaps */ | ||
1685 | 1666 | - if ( render->clazz == &ft_raster1_renderer_class ) | ||
1686 | 1667 | - return FT_THROW( Cannot_Render_Glyph ); | ||
1687 | 1668 | + return FT_THROW( Cannot_Render_Glyph ); | ||
1688 | 1669 | } | ||
1689 | 1670 | - else | ||
1690 | 1671 | - { | ||
1691 | 1672 | - /* raster5 is only capable of producing 5-gray-levels bitmaps */ | ||
1692 | 1673 | - if ( render->clazz == &ft_raster5_renderer_class ) | ||
1693 | 1674 | - return FT_THROW( Cannot_Render_Glyph ); | ||
1694 | 1675 | - } | ||
1695 | 1676 | -#else /* FT_CONFIG_OPTION_PIC */ | ||
1696 | 1677 | - /* When PIC is enabled, we cannot get to the class object */ | ||
1697 | 1678 | - /* so instead we check the final character in the class name */ | ||
1698 | 1679 | - /* ("raster5" or "raster1"). Yes this is a hack. */ | ||
1699 | 1680 | - /* The "correct" thing to do is have different render function */ | ||
1700 | 1681 | - /* for each of the classes. */ | ||
1701 | 1682 | - if ( mode != FT_RENDER_MODE_MONO ) | ||
1702 | 1683 | - { | ||
1703 | 1684 | - /* raster1 is only capable of producing monochrome bitmaps */ | ||
1704 | 1685 | - if ( render->clazz->root.module_name[6] == '1' ) | ||
1705 | 1686 | - return FT_THROW( Cannot_Render_Glyph ); | ||
1706 | 1687 | - } | ||
1707 | 1688 | - else | ||
1708 | 1689 | - { | ||
1709 | 1690 | - /* raster5 is only capable of producing 5-gray-levels bitmaps */ | ||
1710 | 1691 | - if ( render->clazz->root.module_name[6] == '5' ) | ||
1711 | 1692 | - return FT_THROW( Cannot_Render_Glyph ); | ||
1712 | 1693 | - } | ||
1713 | 1694 | -#endif /* FT_CONFIG_OPTION_PIC */ | ||
1714 | 1695 | |||
1715 | 1696 | outline = &slot->outline; | ||
1716 | 1697 | |||
1717 | 1698 | @@ -194,19 +167,8 @@ | ||
1718 | 1699 | slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP; | ||
1719 | 1700 | } | ||
1720 | 1701 | |||
1721 | 1702 | - /* allocate new one, depends on pixel format */ | ||
1722 | 1703 | - if ( !( mode & FT_RENDER_MODE_MONO ) ) | ||
1723 | 1704 | - { | ||
1724 | 1705 | - /* we pad to 32 bits, only for backwards compatibility with FT 1.x */ | ||
1725 | 1706 | - pitch = FT_PAD_CEIL( width, 4 ); | ||
1726 | 1707 | - bitmap->pixel_mode = FT_PIXEL_MODE_GRAY; | ||
1727 | 1708 | - bitmap->num_grays = 256; | ||
1728 | 1709 | - } | ||
1729 | 1710 | - else | ||
1730 | 1711 | - { | ||
1731 | 1712 | - pitch = ( ( width + 15 ) >> 4 ) << 1; | ||
1732 | 1713 | - bitmap->pixel_mode = FT_PIXEL_MODE_MONO; | ||
1733 | 1714 | - } | ||
1734 | 1715 | + pitch = ( ( width + 15 ) >> 4 ) << 1; | ||
1735 | 1716 | + bitmap->pixel_mode = FT_PIXEL_MODE_MONO; | ||
1736 | 1717 | |||
1737 | 1718 | bitmap->width = width; | ||
1738 | 1719 | bitmap->rows = height; | ||
1739 | 1720 | @@ -225,9 +187,6 @@ | ||
1740 | 1721 | params.source = outline; | ||
1741 | 1722 | params.flags = 0; | ||
1742 | 1723 | |||
1743 | 1724 | - if ( bitmap->pixel_mode == FT_PIXEL_MODE_GRAY ) | ||
1744 | 1725 | - params.flags |= FT_RASTER_FLAG_AA; | ||
1745 | 1726 | - | ||
1746 | 1727 | /* render outline into the bitmap */ | ||
1747 | 1728 | error = render->raster_render( render->raster, ¶ms ); | ||
1748 | 1729 | |||
1749 | 1730 | Index: freetype-2.5.2/src/smooth/ftgrays.c | ||
1750 | 1731 | =================================================================== | ||
1751 | 1732 | --- freetype-2.5.2.orig/src/smooth/ftgrays.c 2015-01-26 16:49:42.692849510 +0100 | ||
1752 | 1733 | +++ freetype-2.5.2/src/smooth/ftgrays.c 2015-01-26 16:49:42.680849506 +0100 | ||
1753 | 1734 | @@ -461,11 +461,7 @@ | ||
1754 | 1735 | |||
1755 | 1736 | typedef struct gray_TRaster_ | ||
1756 | 1737 | { | ||
1757 | 1738 | - void* buffer; | ||
1758 | 1739 | - long buffer_size; | ||
1759 | 1740 | - int band_size; | ||
1760 | 1741 | void* memory; | ||
1761 | 1742 | - gray_PWorker worker; | ||
1762 | 1743 | |||
1763 | 1744 | } gray_TRaster, *gray_PRaster; | ||
1764 | 1745 | |||
1765 | 1746 | @@ -1940,12 +1936,17 @@ | ||
1766 | 1747 | gray_raster_render( gray_PRaster raster, | ||
1767 | 1748 | const FT_Raster_Params* params ) | ||
1768 | 1749 | { | ||
1769 | 1750 | - const FT_Outline* outline = (const FT_Outline*)params->source; | ||
1770 | 1751 | - const FT_Bitmap* target_map = params->target; | ||
1771 | 1752 | - gray_PWorker worker; | ||
1772 | 1753 | + const FT_Outline* outline = (const FT_Outline*)params->source; | ||
1773 | 1754 | + const FT_Bitmap* target_map = params->target; | ||
1774 | 1755 | |||
1775 | 1756 | + gray_TWorker worker[1]; | ||
1776 | 1757 | |||
1777 | 1758 | - if ( !raster || !raster->buffer || !raster->buffer_size ) | ||
1778 | 1759 | + TCell buffer[FT_MAX( FT_RENDER_POOL_SIZE, 2048 ) / sizeof ( TCell )]; | ||
1779 | 1760 | + long buffer_size = sizeof ( buffer ); | ||
1780 | 1761 | + int band_size = (int)( buffer_size / ( sizeof ( TCell ) * 8 ) ); | ||
1781 | 1762 | + | ||
1782 | 1763 | + | ||
1783 | 1764 | + if ( !raster ) | ||
1784 | 1765 | return FT_THROW( Invalid_Argument ); | ||
1785 | 1766 | |||
1786 | 1767 | if ( !outline ) | ||
1787 | 1768 | @@ -1962,8 +1963,6 @@ | ||
1788 | 1769 | outline->contours[outline->n_contours - 1] + 1 ) | ||
1789 | 1770 | return FT_THROW( Invalid_Outline ); | ||
1790 | 1771 | |||
1791 | 1772 | - worker = raster->worker; | ||
1792 | 1773 | - | ||
1793 | 1774 | /* if direct mode is not set, we must have a target bitmap */ | ||
1794 | 1775 | if ( !( params->flags & FT_RASTER_FLAG_DIRECT ) ) | ||
1795 | 1776 | { | ||
1796 | 1777 | @@ -2001,13 +2000,14 @@ | ||
1797 | 1778 | ras.clip_box.yMax = 32767L; | ||
1798 | 1779 | } | ||
1799 | 1780 | |||
1800 | 1781 | - gray_init_cells( RAS_VAR_ raster->buffer, raster->buffer_size ); | ||
1801 | 1782 | + gray_init_cells( RAS_VAR_ buffer, buffer_size ); | ||
1802 | 1783 | |||
1803 | 1784 | ras.outline = *outline; | ||
1804 | 1785 | ras.num_cells = 0; | ||
1805 | 1786 | ras.invalid = 1; | ||
1806 | 1787 | - ras.band_size = raster->band_size; | ||
1807 | 1788 | + ras.band_size = band_size; | ||
1808 | 1789 | ras.num_gray_spans = 0; | ||
1809 | 1790 | + ras.span_y = 0; | ||
1810 | 1791 | |||
1811 | 1792 | if ( params->flags & FT_RASTER_FLAG_DIRECT ) | ||
1812 | 1793 | { | ||
1813 | 1794 | @@ -2091,34 +2091,9 @@ | ||
1814 | 1795 | char* pool_base, | ||
1815 | 1796 | long pool_size ) | ||
1816 | 1797 | { | ||
1817 | 1798 | - gray_PRaster rast = (gray_PRaster)raster; | ||
1818 | 1799 | - | ||
1819 | 1800 | - | ||
1820 | 1801 | - if ( raster ) | ||
1821 | 1802 | - { | ||
1822 | 1803 | - if ( pool_base && pool_size >= (long)sizeof ( gray_TWorker ) + 2048 ) | ||
1823 | 1804 | - { | ||
1824 | 1805 | - gray_PWorker worker = (gray_PWorker)pool_base; | ||
1825 | 1806 | - | ||
1826 | 1807 | - | ||
1827 | 1808 | - rast->worker = worker; | ||
1828 | 1809 | - rast->buffer = pool_base + | ||
1829 | 1810 | - ( ( sizeof ( gray_TWorker ) + | ||
1830 | 1811 | - sizeof ( TCell ) - 1 ) & | ||
1831 | 1812 | - ~( sizeof ( TCell ) - 1 ) ); | ||
1832 | 1813 | - rast->buffer_size = (long)( ( pool_base + pool_size ) - | ||
1833 | 1814 | - (char*)rast->buffer ) & | ||
1834 | 1815 | - ~( sizeof ( TCell ) - 1 ); | ||
1835 | 1816 | - rast->band_size = (int)( rast->buffer_size / | ||
1836 | 1817 | - ( sizeof ( TCell ) * 8 ) ); | ||
1837 | 1818 | - } | ||
1838 | 1819 | - else | ||
1839 | 1820 | - { | ||
1840 | 1821 | - rast->buffer = NULL; | ||
1841 | 1822 | - rast->buffer_size = 0; | ||
1842 | 1823 | - rast->worker = NULL; | ||
1843 | 1824 | - } | ||
1844 | 1825 | - } | ||
1845 | 1826 | + FT_UNUSED( raster ); | ||
1846 | 1827 | + FT_UNUSED( pool_base ); | ||
1847 | 1828 | + FT_UNUSED( pool_size ); | ||
1848 | 1829 | } | ||
1849 | 1830 | |||
1850 | 1831 | |||
1851 | 1832 | Index: freetype-2.5.2/src/truetype/ttgload.c | ||
1852 | 1833 | =================================================================== | ||
1853 | 1834 | --- freetype-2.5.2.orig/src/truetype/ttgload.c 2015-01-26 16:49:42.692849510 +0100 | ||
1854 | 1835 | +++ freetype-2.5.2/src/truetype/ttgload.c 2015-01-26 16:49:42.684849507 +0100 | ||
1855 | 1836 | @@ -802,7 +802,6 @@ | ||
1856 | 1837 | |||
1857 | 1838 | if ( n_ins > 0 ) | ||
1858 | 1839 | { | ||
1859 | 1840 | - FT_Bool debug; | ||
1860 | 1841 | FT_Error error; | ||
1861 | 1842 | |||
1862 | 1843 | FT_GlyphLoader gloader = loader->gloader; | ||
1863 | 1844 | @@ -817,10 +816,7 @@ | ||
1864 | 1845 | loader->exec->is_composite = is_composite; | ||
1865 | 1846 | loader->exec->pts = *zone; | ||
1866 | 1847 | |||
1867 | 1848 | - debug = FT_BOOL( !( loader->load_flags & FT_LOAD_NO_SCALE ) && | ||
1868 | 1849 | - ((TT_Size)loader->size)->debug ); | ||
1869 | 1850 | - | ||
1870 | 1851 | - error = TT_Run_Context( loader->exec, debug ); | ||
1871 | 1852 | + error = TT_Run_Context( loader->exec ); | ||
1872 | 1853 | if ( error && loader->exec->pedantic_hinting ) | ||
1873 | 1854 | return error; | ||
1874 | 1855 | |||
1875 | 1856 | @@ -2116,8 +2112,7 @@ | ||
1876 | 1857 | } | ||
1877 | 1858 | |||
1878 | 1859 | /* query new execution context */ | ||
1879 | 1860 | - exec = size->debug ? size->context | ||
1880 | 1861 | - : ( (TT_Driver)FT_FACE_DRIVER( face ) )->context; | ||
1881 | 1862 | + exec = size->context; | ||
1882 | 1863 | if ( !exec ) | ||
1883 | 1864 | return FT_THROW( Could_Not_Find_Context ); | ||
1884 | 1865 | |||
1885 | 1866 | Index: freetype-2.5.2/src/truetype/ttinterp.c | ||
1886 | 1867 | =================================================================== | ||
1887 | 1868 | --- freetype-2.5.2.orig/src/truetype/ttinterp.c 2015-01-26 16:49:42.692849510 +0100 | ||
1888 | 1869 | +++ freetype-2.5.2/src/truetype/ttinterp.c 2015-01-26 16:49:42.684849507 +0100 | ||
1889 | 1870 | @@ -714,12 +714,8 @@ | ||
1890 | 1871 | /* <Return> */ | ||
1891 | 1872 | /* TrueType error code. 0 means success. */ | ||
1892 | 1873 | /* */ | ||
1893 | 1874 | - /* <Note> */ | ||
1894 | 1875 | - /* Only the glyph loader and debugger should call this function. */ | ||
1895 | 1876 | - /* */ | ||
1896 | 1877 | FT_LOCAL_DEF( FT_Error ) | ||
1897 | 1878 | - TT_Run_Context( TT_ExecContext exec, | ||
1898 | 1879 | - FT_Bool debug ) | ||
1899 | 1880 | + TT_Run_Context( TT_ExecContext exec ) | ||
1900 | 1881 | { | ||
1901 | 1882 | FT_Error error; | ||
1902 | 1883 | |||
1903 | 1884 | @@ -754,16 +750,7 @@ | ||
1904 | 1885 | exec->top = 0; | ||
1905 | 1886 | exec->callTop = 0; | ||
1906 | 1887 | |||
1907 | 1888 | -#if 1 | ||
1908 | 1889 | - FT_UNUSED( debug ); | ||
1909 | 1890 | - | ||
1910 | 1891 | return exec->face->interpreter( exec ); | ||
1911 | 1892 | -#else | ||
1912 | 1893 | - if ( !debug ) | ||
1913 | 1894 | - return TT_RunIns( exec ); | ||
1914 | 1895 | - else | ||
1915 | 1896 | - return FT_Err_Ok; | ||
1916 | 1897 | -#endif | ||
1917 | 1898 | } | ||
1918 | 1899 | |||
1919 | 1900 | |||
1920 | 1901 | @@ -796,32 +783,26 @@ | ||
1921 | 1902 | FT_EXPORT_DEF( TT_ExecContext ) | ||
1922 | 1903 | TT_New_Context( TT_Driver driver ) | ||
1923 | 1904 | { | ||
1924 | 1905 | - TT_ExecContext exec; | ||
1925 | 1906 | FT_Memory memory; | ||
1926 | 1907 | + FT_Error error; | ||
1927 | 1908 | |||
1928 | 1909 | + TT_ExecContext exec; | ||
1929 | 1910 | |||
1930 | 1911 | - memory = driver->root.root.memory; | ||
1931 | 1912 | - exec = driver->context; | ||
1932 | 1913 | - | ||
1933 | 1914 | - if ( !driver->context ) | ||
1934 | 1915 | - { | ||
1935 | 1916 | - FT_Error error; | ||
1936 | 1917 | - | ||
1937 | 1918 | - | ||
1938 | 1919 | - /* allocate object */ | ||
1939 | 1920 | - if ( FT_NEW( exec ) ) | ||
1940 | 1921 | - goto Fail; | ||
1941 | 1922 | + if ( !driver ) | ||
1942 | 1923 | + goto Fail; | ||
1943 | 1924 | |||
1944 | 1925 | - /* initialize it; in case of error this deallocates `exec' too */ | ||
1945 | 1926 | - error = Init_Context( exec, memory ); | ||
1946 | 1927 | - if ( error ) | ||
1947 | 1928 | - goto Fail; | ||
1948 | 1929 | + memory = driver->root.root.memory; | ||
1949 | 1930 | |||
1950 | 1931 | - /* store it into the driver */ | ||
1951 | 1932 | - driver->context = exec; | ||
1952 | 1933 | - } | ||
1953 | 1934 | + /* allocate object */ | ||
1954 | 1935 | + if ( FT_NEW( exec ) ) | ||
1955 | 1936 | + goto Fail; | ||
1956 | 1937 | + | ||
1957 | 1938 | + /* initialize it; in case of error this deallocates `exec' too */ | ||
1958 | 1939 | + error = Init_Context( exec, memory ); | ||
1959 | 1940 | + if ( error ) | ||
1960 | 1941 | + goto Fail; | ||
1961 | 1942 | |||
1962 | 1943 | - return driver->context; | ||
1963 | 1944 | + return exec; | ||
1964 | 1945 | |||
1965 | 1946 | Fail: | ||
1966 | 1947 | return NULL; | ||
1967 | 1948 | Index: freetype-2.5.2/src/truetype/ttinterp.h | ||
1968 | 1949 | =================================================================== | ||
1969 | 1950 | --- freetype-2.5.2.orig/src/truetype/ttinterp.h 2015-01-26 16:49:42.692849510 +0100 | ||
1970 | 1951 | +++ freetype-2.5.2/src/truetype/ttinterp.h 2015-01-26 16:49:42.684849507 +0100 | ||
1971 | 1952 | @@ -340,6 +340,7 @@ | ||
1972 | 1953 | /* */ | ||
1973 | 1954 | /* <Note> */ | ||
1974 | 1955 | /* Only the glyph loader and debugger should call this function. */ | ||
1975 | 1956 | + /* (And right now only the glyph loader uses it.) */ | ||
1976 | 1957 | /* */ | ||
1977 | 1958 | FT_EXPORT( TT_ExecContext ) | ||
1978 | 1959 | TT_New_Context( TT_Driver driver ); | ||
1979 | 1960 | @@ -359,8 +360,7 @@ | ||
1980 | 1961 | TT_Size ins ); | ||
1981 | 1962 | |||
1982 | 1963 | FT_LOCAL( FT_Error ) | ||
1983 | 1964 | - TT_Run_Context( TT_ExecContext exec, | ||
1984 | 1965 | - FT_Bool debug ); | ||
1985 | 1966 | + TT_Run_Context( TT_ExecContext exec ); | ||
1986 | 1967 | #endif /* TT_USE_BYTECODE_INTERPRETER */ | ||
1987 | 1968 | |||
1988 | 1969 | |||
1989 | 1970 | Index: freetype-2.5.2/src/truetype/ttobjs.c | ||
1990 | 1971 | =================================================================== | ||
1991 | 1972 | --- freetype-2.5.2.orig/src/truetype/ttobjs.c 2015-01-26 16:49:42.692849510 +0100 | ||
1992 | 1973 | +++ freetype-2.5.2/src/truetype/ttobjs.c 2015-01-26 16:49:42.688849509 +0100 | ||
1993 | 1974 | @@ -751,14 +751,7 @@ | ||
1994 | 1975 | FT_Error error; | ||
1995 | 1976 | |||
1996 | 1977 | |||
1997 | 1978 | - /* debugging instances have their own context */ | ||
1998 | 1979 | - if ( size->debug ) | ||
1999 | 1980 | - exec = size->context; | ||
2000 | 1981 | - else | ||
2001 | 1982 | - exec = ( (TT_Driver)FT_FACE_DRIVER( face ) )->context; | ||
2002 | 1983 | - | ||
2003 | 1984 | - if ( !exec ) | ||
2004 | 1985 | - return FT_THROW( Could_Not_Find_Context ); | ||
2005 | 1986 | + exec = size->context; | ||
2006 | 1987 | |||
2007 | 1988 | TT_Load_Context( exec, face, size ); | ||
2008 | 1989 | |||
2009 | 1990 | @@ -845,14 +838,7 @@ | ||
2010 | 1991 | FT_Error error; | ||
2011 | 1992 | |||
2012 | 1993 | |||
2013 | 1994 | - /* debugging instances have their own context */ | ||
2014 | 1995 | - if ( size->debug ) | ||
2015 | 1996 | - exec = size->context; | ||
2016 | 1997 | - else | ||
2017 | 1998 | - exec = ( (TT_Driver)FT_FACE_DRIVER( face ) )->context; | ||
2018 | 1999 | - | ||
2019 | 2000 | - if ( !exec ) | ||
2020 | 2001 | - return FT_THROW( Could_Not_Find_Context ); | ||
2021 | 2002 | + exec = size->context; | ||
2022 | 2003 | |||
2023 | 2004 | TT_Load_Context( exec, face, size ); | ||
2024 | 2005 | |||
2025 | 2006 | @@ -872,14 +858,11 @@ | ||
2026 | 2007 | |||
2027 | 2008 | if ( face->cvt_program_size > 0 ) | ||
2028 | 2009 | { | ||
2029 | 2010 | - error = TT_Goto_CodeRange( exec, tt_coderange_cvt, 0 ); | ||
2030 | 2011 | + TT_Goto_CodeRange( exec, tt_coderange_cvt, 0 ); | ||
2031 | 2012 | |||
2032 | 2013 | - if ( !error && !size->debug ) | ||
2033 | 2014 | - { | ||
2034 | 2015 | - FT_TRACE4(( "Executing `prep' table.\n" )); | ||
2035 | 2016 | + FT_TRACE4(( "Executing `prep' table.\n" )); | ||
2036 | 2017 | |||
2037 | 2018 | - error = face->interpreter( exec ); | ||
2038 | 2019 | - } | ||
2039 | 2020 | + error = face->interpreter( exec ); | ||
2040 | 2021 | } | ||
2041 | 2022 | else | ||
2042 | 2023 | error = FT_Err_Ok; | ||
2043 | 2024 | @@ -924,12 +907,10 @@ | ||
2044 | 2025 | TT_Face face = (TT_Face)ftsize->face; | ||
2045 | 2026 | FT_Memory memory = face->root.memory; | ||
2046 | 2027 | |||
2047 | 2028 | - | ||
2048 | 2029 | - if ( size->debug ) | ||
2049 | 2030 | + if ( size->context ) | ||
2050 | 2031 | { | ||
2051 | 2032 | - /* the debug context must be deleted by the debugger itself */ | ||
2052 | 2033 | + TT_Done_Context( size->context ); | ||
2053 | 2034 | size->context = NULL; | ||
2054 | 2035 | - size->debug = FALSE; | ||
2055 | 2036 | } | ||
2056 | 2037 | |||
2057 | 2038 | FT_FREE( size->cvt ); | ||
2058 | 2039 | @@ -977,6 +958,8 @@ | ||
2059 | 2040 | size->bytecode_ready = 1; | ||
2060 | 2041 | size->cvt_ready = 0; | ||
2061 | 2042 | |||
2062 | 2043 | + size->context = TT_New_Context( (TT_Driver)face->root.driver ); | ||
2063 | 2044 | + | ||
2064 | 2045 | size->max_function_defs = maxp->maxFunctionDefs; | ||
2065 | 2046 | size->max_instruction_defs = maxp->maxInstructionDefs; | ||
2066 | 2047 | |||
2067 | 2048 | @@ -1261,10 +1244,6 @@ | ||
2068 | 2049 | |||
2069 | 2050 | TT_Driver driver = (TT_Driver)ttdriver; | ||
2070 | 2051 | |||
2071 | 2052 | - | ||
2072 | 2053 | - if ( !TT_New_Context( driver ) ) | ||
2073 | 2054 | - return FT_THROW( Could_Not_Find_Context ); | ||
2074 | 2055 | - | ||
2075 | 2056 | #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING | ||
2076 | 2057 | driver->interpreter_version = TT_INTERPRETER_VERSION_38; | ||
2077 | 2058 | #else | ||
2078 | 2059 | @@ -1295,20 +1274,7 @@ | ||
2079 | 2060 | FT_LOCAL_DEF( void ) | ||
2080 | 2061 | tt_driver_done( FT_Module ttdriver ) /* TT_Driver */ | ||
2081 | 2062 | { | ||
2082 | 2063 | -#ifdef TT_USE_BYTECODE_INTERPRETER | ||
2083 | 2064 | - TT_Driver driver = (TT_Driver)ttdriver; | ||
2084 | 2065 | - | ||
2085 | 2066 | - | ||
2086 | 2067 | - /* destroy the execution context */ | ||
2087 | 2068 | - if ( driver->context ) | ||
2088 | 2069 | - { | ||
2089 | 2070 | - TT_Done_Context( driver->context ); | ||
2090 | 2071 | - driver->context = NULL; | ||
2091 | 2072 | - } | ||
2092 | 2073 | -#else | ||
2093 | 2074 | FT_UNUSED( ttdriver ); | ||
2094 | 2075 | -#endif | ||
2095 | 2076 | - | ||
2096 | 2077 | } | ||
2097 | 2078 | |||
2098 | 2079 | |||
2099 | 2080 | Index: freetype-2.5.2/src/truetype/ttobjs.h | ||
2100 | 2081 | =================================================================== | ||
2101 | 2082 | --- freetype-2.5.2.orig/src/truetype/ttobjs.h 2015-01-26 16:49:42.692849510 +0100 | ||
2102 | 2083 | +++ freetype-2.5.2/src/truetype/ttobjs.h 2015-01-26 16:49:42.688849509 +0100 | ||
2103 | 2084 | @@ -324,13 +324,6 @@ | ||
2104 | 2085 | |||
2105 | 2086 | TT_GlyphZoneRec twilight; /* The instance's twilight zone */ | ||
2106 | 2087 | |||
2107 | 2088 | - /* debugging variables */ | ||
2108 | 2089 | - | ||
2109 | 2090 | - /* When using the debugger, we must keep the */ | ||
2110 | 2091 | - /* execution context tied to the instance */ | ||
2111 | 2092 | - /* object rather than asking it on demand. */ | ||
2112 | 2093 | - | ||
2113 | 2094 | - FT_Bool debug; | ||
2114 | 2095 | TT_ExecContext context; | ||
2115 | 2096 | |||
2116 | 2097 | FT_Bool bytecode_ready; | ||
2117 | 2098 | @@ -349,7 +342,6 @@ | ||
2118 | 2099 | { | ||
2119 | 2100 | FT_DriverRec root; | ||
2120 | 2101 | |||
2121 | 2102 | - TT_ExecContext context; /* execution context */ | ||
2122 | 2103 | TT_GlyphZoneRec zone; /* glyph loader points zone */ | ||
2123 | 2104 | |||
2124 | 2105 | FT_UInt interpreter_version; | ||
2125 | 0 | 2106 | ||
2126 | === modified file 'debian/patches-freetype/series' | |||
2127 | --- debian/patches-freetype/series 2014-04-27 22:05:39 +0000 | |||
2128 | +++ debian/patches-freetype/series 2015-01-26 16:10:26 +0000 | |||
2129 | @@ -6,3 +6,4 @@ | |||
2130 | 6 | CVE-2014-2241.patch | 6 | CVE-2014-2241.patch |
2131 | 7 | 0001-Fix-Savannah-bug-40997.patch | 7 | 0001-Fix-Savannah-bug-40997.patch |
2132 | 8 | fix-incorrect-korean-fonts-rendering.patch | 8 | fix-incorrect-korean-fonts-rendering.patch |
2133 | 9 | multi-thread-violations.patch |
I've uploaded this but the bug report is missing SRU information, see my comment there.