]>
Commit | Line | Data |
---|---|---|
60fbc3c7 JB |
1 | --- gnustep-back-0.9.3/Source/art/ftfont.m.orig 2004-05-13 17:14:46.000000000 +0200 |
2 | +++ gnustep-back-0.9.3/Source/art/ftfont.m 2004-06-26 11:32:32.704296824 +0200 | |
3 | @@ -61,6 +61,8 @@ | |
4 | ||
5 | #if (FREETYPE_MAJOR==2) && ((FREETYPE_MINOR<1) || ((FREETYPE_MINOR==1) && (FREETYPE_PATCH<=2))) | |
6 | #define FT212_STUFF | |
7 | +#elif (FREETYPE_MAJOR==2) && ((FREETYPE_MINOR>1) || ((FREETYPE_MINOR==1) && (FREETYPE_PATCH>=8))) | |
8 | +#define FT_GE_218 | |
9 | #endif | |
10 | ||
11 | ||
12 | @@ -95,6 +97,9 @@ | |
13 | ||
14 | FTC_ImageTypeRec advancementImgd; | |
15 | #endif | |
16 | +#ifdef FT_GE_218 | |
17 | + FTC_ScalerRec scalerd; | |
18 | +#endif | |
19 | ||
20 | FTFaceInfo *face_info; | |
21 | ||
22 | @@ -718,17 +723,31 @@ | |
23 | matrix[3] = ceil(matrix[3]); | |
24 | } | |
25 | ||
26 | +#ifdef FT_GE_218 | |
27 | + scalerd.pixel = 1; | |
28 | + scalerd.width = imgd.width = fabs(matrix[0]); | |
29 | + scalerd.height = imgd.height = fabs(matrix[3]); | |
30 | +#else | |
31 | imgd.font.pix_width = fabs(matrix[0]); | |
32 | imgd.font.pix_height = fabs(matrix[3]); | |
33 | +#endif | |
34 | ||
35 | rfi = font_entry->files; | |
36 | if (screenFont && font_entry->num_sizes && | |
37 | +#ifdef FT_GE_218 | |
38 | + imgd.width == imgd.height) | |
39 | +#else | |
40 | imgd.font.pix_width == imgd.font.pix_height) | |
41 | +#endif | |
42 | { | |
43 | int i; | |
44 | for (i = 0; i < font_entry->num_sizes; i++) | |
45 | { | |
46 | +#ifdef FT_GE_218 | |
47 | + if (font_entry->sizes[i].pixel_size == imgd.width) | |
48 | +#else | |
49 | if (font_entry->sizes[i].pixel_size == imgd.font.pix_width) | |
50 | +#endif | |
51 | { | |
52 | rfi = font_entry->sizes[i].files; | |
53 | break; | |
54 | @@ -736,9 +755,18 @@ | |
55 | } | |
56 | } | |
57 | ||
58 | +#ifdef FT_GE_218 | |
59 | + scalerd.face_id = imgd.face_id = (FTC_FaceID)rfi; | |
60 | +#else | |
61 | imgd.font.face_id = (FTC_FaceID)rfi; | |
62 | +#endif | |
63 | ||
64 | +#ifdef FT_GE_218 | |
65 | + if ((error=FTC_Manager_LookupFace(ftc_manager, scalerd.face_id, &face)) || | |
66 | + (error=FTC_Manager_LookupSize(ftc_manager, &scalerd, &size))) | |
67 | +#else | |
68 | if ((error=FTC_Manager_Lookup_Size(ftc_manager, &imgd.font, &face, &size))) | |
69 | +#endif | |
70 | { | |
71 | NSLog(@"FTC_Manager_Lookup_Size() failed for '%@', error %08x!\n", name, error); | |
72 | return self; | |
73 | @@ -762,6 +790,19 @@ | |
74 | fontBBox.size.width, fontBBox.size.height);*/ | |
75 | ||
76 | { | |
77 | +#ifdef FT_GE_218 | |
78 | + FT_CharMapRec crec; | |
79 | + FT_Int cind; | |
80 | + crec.face = face; | |
81 | + crec.encoding = ft_encoding_unicode; | |
82 | + crec.platform_id = crec.encoding_id = 0; | |
83 | + cind = FT_Get_Charmap_Index( &crec ); | |
84 | + ligature_ff = FTC_CMapCache_Lookup(ftc_cmapcache, imgd.face_id, cind, 0xfb00); | |
85 | + ligature_fi = FTC_CMapCache_Lookup(ftc_cmapcache, imgd.face_id, cind, 0xfb01); | |
86 | + ligature_fl = FTC_CMapCache_Lookup(ftc_cmapcache, imgd.face_id, cind, 0xfb02); | |
87 | + ligature_ffi = FTC_CMapCache_Lookup(ftc_cmapcache, imgd.face_id, cind, 0xfb03); | |
88 | + ligature_ffl = FTC_CMapCache_Lookup(ftc_cmapcache, imgd.face_id, cind, 0xfb04); | |
89 | +#else | |
90 | FTC_CMapDescRec cmap; | |
91 | cmap.face_id = imgd.font.face_id; | |
92 | cmap.u.encoding = ft_encoding_unicode; | |
93 | @@ -771,6 +812,7 @@ | |
94 | ligature_fl = FTC_CMapCache_Lookup(ftc_cmapcache, &cmap, 0xfb02); | |
95 | ligature_ffi = FTC_CMapCache_Lookup(ftc_cmapcache, &cmap, 0xfb03); | |
96 | ligature_ffl = FTC_CMapCache_Lookup(ftc_cmapcache, &cmap, 0xfb04); | |
97 | +#endif | |
98 | /* printf("ligatures %04x %04x %04x %04x %04x | %02x %02x %02x for |%@|\n", | |
99 | ligature_ff,ligature_fi,ligature_fl,ligature_ffi,ligature_ffl, | |
100 | FTC_CMapCache_Lookup(ftc_cmapcache, &cmap, 'f'), | |
101 | @@ -881,7 +923,13 @@ | |
102 | unsigned char ch; | |
103 | unsigned int uch; | |
104 | ||
105 | +#ifdef FT_GE_218 | |
106 | + FT_CharMapRec crec; | |
107 | + FT_Int cind; | |
108 | + FT_Face face1; | |
109 | +#else | |
110 | FTC_CMapDescRec cmap; | |
111 | +#endif | |
112 | unsigned int glyph; | |
113 | ||
114 | int use_sbit; | |
115 | @@ -935,8 +983,13 @@ | |
116 | xx < 72 && yy < 72 && xx > 0.5 && yy > 0.5) | |
117 | { | |
118 | use_sbit = 1; | |
119 | +#ifdef FT_GE_218 | |
120 | + cur.width = xx; | |
121 | + cur.height = yy; | |
122 | +#else | |
123 | cur.font.pix_width = xx; | |
124 | cur.font.pix_height = yy; | |
125 | +#endif | |
126 | ||
127 | if (xx == yy && xx < 16 && xx >= 8) | |
128 | { | |
129 | @@ -998,7 +1051,11 @@ | |
130 | ||
131 | f = (int)f; | |
132 | ||
133 | +#ifdef FT_GE_218 | |
134 | + cur.width = cur.height = f; | |
135 | +#else | |
136 | cur.font.pix_width = cur.font.pix_height = f; | |
137 | +#endif | |
138 | ftmatrix.xx = xx / f * 65536.0; | |
139 | ftmatrix.xy = xy / f * 65536.0; | |
140 | ftmatrix.yx = yx / f * 65536.0; | |
141 | @@ -1011,9 +1068,17 @@ | |
142 | /* NSLog(@"drawString: '%s' at: %i:%i to: %i:%i:%i:%i:%p\n", | |
143 | s, x, y, x0, y0, x1, y1, buf);*/ | |
144 | ||
145 | +#ifdef FT_GE_218 | |
146 | + FTC_Manager_LookupFace(ftc_manager, imgd.face_id, &face1); | |
147 | + crec.face = face1; | |
148 | + crec.encoding = ft_encoding_unicode; | |
149 | + crec.platform_id = crec.encoding_id = 0; | |
150 | + cind = FT_Get_Charmap_Index( &crec ); | |
151 | +#else | |
152 | cmap.face_id = imgd.font.face_id; | |
153 | cmap.u.encoding = ft_encoding_unicode; | |
154 | cmap.type = FTC_CMAP_BY_ENCODING; | |
155 | +#endif | |
156 | ||
157 | for (c = s; *c; c++) | |
158 | { | |
159 | @@ -1069,15 +1134,24 @@ | |
160 | uch = 0xfffd; | |
161 | #undef ADD_UTF_BYTE | |
162 | ||
163 | +#ifdef FT_GE_218 | |
164 | + glyph = FTC_CMapCache_Lookup(ftc_cmapcache, imgd.face_id, cind, uch); | |
165 | + cur.face_id = imgd.face_id; | |
166 | +#else | |
167 | glyph = FTC_CMapCache_Lookup(ftc_cmapcache, &cmap, uch); | |
168 | cur.font.face_id = imgd.font.face_id; | |
169 | +#endif | |
170 | ||
171 | if (use_sbit) | |
172 | { | |
173 | if ((error=FTC_SBitCache_Lookup(ftc_sbitcache, &cur, glyph, &sbit, NULL))) | |
174 | { | |
175 | NSLog(@"FTC_SBitCache_Lookup() failed with error %08x (%08x, %08x, %ix%i, %08x)\n", | |
176 | +#ifdef FT_GE_218 | |
177 | + error, glyph, cur.face_id, cur.width, cur.height, | |
178 | +#else | |
179 | error, glyph, cur.font.face_id, cur.font.pix_width, cur.font.pix_height, | |
180 | +#endif | |
181 | #ifdef FT212_STUFF | |
182 | cur.type | |
183 | #else | |
184 | @@ -1206,12 +1280,19 @@ | |
185 | FT_Glyph gl; | |
186 | FT_BitmapGlyph gb; | |
187 | ||
188 | +#ifdef FT_GE_218 | |
189 | + if ((error=FTC_Manager_LookupFace(ftc_manager, cur.face_id, &face))) | |
190 | + { | |
191 | + NSLog(@"FTC_Manager_LookupFace() failed with error %08x\n",error); | |
192 | + continue; | |
193 | + } | |
194 | +#else | |
195 | if ((error=FTC_Manager_Lookup_Size(ftc_manager, &cur.font, &face, 0))) | |
196 | { | |
197 | NSLog(@"FTC_Manager_Lookup_Size() failed with error %08x\n",error); | |
198 | continue; | |
199 | } | |
200 | - | |
201 | +#endif | |
202 | /* TODO: for rotations of 90, 180, 270, and integer | |
203 | scales hinting might still be a good idea. */ | |
204 | if ((error=FT_Load_Glyph(face, glyph, FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP))) | |
205 | @@ -1377,8 +1458,13 @@ | |
206 | xx < 72 && yy < 72 && xx > 0.5 && yy > 0.5) | |
207 | { | |
208 | use_sbit = 1; | |
209 | +#ifdef FT_GE_218 | |
210 | + cur.width = xx; | |
211 | + cur.height = yy; | |
212 | +#else | |
213 | cur.font.pix_width = xx; | |
214 | cur.font.pix_height = yy; | |
215 | +#endif | |
216 | ||
217 | if (xx == yy && xx < 16 && xx >= 8) | |
218 | { | |
219 | @@ -1440,7 +1526,11 @@ | |
220 | ||
221 | f = (int)f; | |
222 | ||
223 | +#ifdef FT_GE_218 | |
224 | + cur.width = cur.height = f; | |
225 | +#else | |
226 | cur.font.pix_width = cur.font.pix_height = f; | |
227 | +#endif | |
228 | ftmatrix.xx = xx / f * 65536.0; | |
229 | ftmatrix.xy = xy / f * 65536.0; | |
230 | ftmatrix.yx = yx / f * 65536.0; | |
231 | @@ -1461,7 +1551,11 @@ | |
232 | if ((error = FTC_SBitCache_Lookup(ftc_sbitcache, &cur, glyph, &sbit, NULL))) | |
233 | { | |
234 | NSLog(@"FTC_SBitCache_Lookup() failed with error %08x (%08x, %08x, %ix%i, %08x)\n", | |
235 | +#ifdef FT_GE_218 | |
236 | + error, glyph, cur.face_id, cur.width, cur.height, | |
237 | +#else | |
238 | error, glyph, cur.font.face_id, cur.font.pix_width, cur.font.pix_height, | |
239 | +#endif | |
240 | #ifdef FT212_STUFF | |
241 | cur.type | |
242 | #else | |
243 | @@ -1590,11 +1684,19 @@ | |
244 | FT_Glyph gl; | |
245 | FT_BitmapGlyph gb; | |
246 | ||
247 | +#ifdef FT_GE_218 | |
248 | + if ((error=FTC_Manager_LookupFace(ftc_manager, cur.face_id, &face))) | |
249 | + { | |
250 | + NSLog(@"FTC_Manager_LookupFace() failed with error %08x\n",error); | |
251 | + continue; | |
252 | + } | |
253 | +#else | |
254 | if ((error=FTC_Manager_Lookup_Size(ftc_manager, &cur.font, &face, 0))) | |
255 | { | |
256 | NSLog(@"FTC_Manager_Lookup_Size() failed with error %08x\n",error); | |
257 | continue; | |
258 | } | |
259 | +#endif | |
260 | ||
261 | /* TODO: for rotations of 90, 180, 270, and integer | |
262 | scales hinting might still be a good idea. */ | |
263 | @@ -1751,8 +1853,13 @@ | |
264 | xx < 72 && yy < 72 && xx > 0.5 && yy > 0.5) | |
265 | { | |
266 | use_sbit = 1; | |
267 | +#ifdef FT_GE_218 | |
268 | + cur.width = xx; | |
269 | + cur.height = yy; | |
270 | +#else | |
271 | cur.font.pix_width = xx; | |
272 | cur.font.pix_height = yy; | |
273 | +#endif | |
274 | ||
275 | if (xx == yy && xx < 16 && xx >= 8) | |
276 | { | |
277 | @@ -1814,7 +1921,11 @@ | |
278 | ||
279 | f = (int)f; | |
280 | ||
281 | +#ifdef FT_GE_218 | |
282 | + cur.width = cur.height = f; | |
283 | +#else | |
284 | cur.font.pix_width = cur.font.pix_height = f; | |
285 | +#endif | |
286 | ftmatrix.xx = xx / f * 65536.0; | |
287 | ftmatrix.xy = xy / f * 65536.0; | |
288 | ftmatrix.yx = yx / f * 65536.0; | |
289 | @@ -1836,7 +1947,11 @@ | |
290 | { | |
291 | if (glyph != 0xffffffff) | |
292 | NSLog(@"FTC_SBitCache_Lookup() failed with error %08x (%08x, %08x, %ix%i, %08x)\n", | |
293 | +#ifdef FT_GE_218 | |
294 | + error, glyph, cur.face_id, cur.width, cur.height, | |
295 | +#else | |
296 | error, glyph, cur.font.face_id, cur.font.pix_width, cur.font.pix_height, | |
297 | +#endif | |
298 | #ifdef FT212_STUFF | |
299 | cur.type | |
300 | #else | |
301 | @@ -1963,11 +2078,19 @@ | |
302 | FT_Glyph gl; | |
303 | FT_BitmapGlyph gb; | |
304 | ||
305 | +#ifdef FT_GE_218 | |
306 | + if ((error=FTC_Manager_LookupFace(ftc_manager, cur.face_id, &face))) | |
307 | + { | |
308 | + NSLog(@"FTC_Manager_LookupFace() failed with error %08x\n",error); | |
309 | + continue; | |
310 | + } | |
311 | +#else | |
312 | if ((error=FTC_Manager_Lookup_Size(ftc_manager, &cur.font, &face, 0))) | |
313 | { | |
314 | NSLog(@"FTC_Manager_Lookup_Size() failed with error %08x\n",error); | |
315 | continue; | |
316 | } | |
317 | +#endif | |
318 | ||
319 | /* TODO: for rotations of 90, 180, 270, and integer | |
320 | scales hinting might still be a good idea. */ | |
321 | @@ -2067,11 +2190,19 @@ | |
322 | FT_Error error; | |
323 | ||
324 | glyph--; | |
325 | +#ifdef FT_GE_218 | |
326 | + if ((error=FTC_Manager_LookupFace(ftc_manager, imgd.face_id, &face))) | |
327 | + { | |
328 | + NSLog(@"FTC_Manager_LookupFace() failed with error %08x",error); | |
329 | + return NO; | |
330 | + } | |
331 | +#else | |
332 | if ((error=FTC_Manager_Lookup_Size(ftc_manager, &imgd.font, &face, 0))) | |
333 | { | |
334 | NSLog(@"FTC_Manager_Lookup_Size() failed with error %08x",error); | |
335 | return NO; | |
336 | } | |
337 | +#endif | |
338 | ||
339 | if ((error=FT_Load_Glyph(face, glyph, 0))) | |
340 | { | |
341 | @@ -2104,8 +2235,13 @@ | |
342 | if ((error=FTC_SBitCache_Lookup(ftc_sbitcache, &advancementImgd, glyph, &sbit, NULL))) | |
343 | { | |
344 | NSLog(@"FTC_SBitCache_Lookup() failed with error %08x (%08x, %08x, %ix%i, %08x)\n", | |
345 | +#ifdef FT_GE_218 | |
346 | + error, glyph, advancementImgd.face_id, | |
347 | + advancementImgd.width, advancementImgd.height, | |
348 | +#else | |
349 | error, glyph, advancementImgd.font.face_id, | |
350 | advancementImgd.font.pix_width, advancementImgd.font.pix_height, | |
351 | +#endif | |
352 | #ifdef FT212_STUFF | |
353 | advancementImgd.type | |
354 | #else | |
355 | @@ -2142,7 +2278,11 @@ | |
356 | ftmatrix.yy = matrix[3] / f * 65536.0; | |
357 | ftdelta.x = ftdelta.y = 0; | |
358 | ||
359 | +#ifdef FT_GE_218 | |
360 | + if (FTC_Manager_LookupFace(ftc_manager, imgd.face_id, &face)) | |
361 | +#else | |
362 | if (FTC_Manager_Lookup_Size(ftc_manager, &imgd.font, &face, 0)) | |
363 | +#endif | |
364 | return NSZeroSize; | |
365 | ||
366 | if (FT_Load_Glyph(face, glyph, FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP)) | |
367 | @@ -2210,7 +2350,11 @@ | |
368 | g--; | |
369 | prev--; | |
370 | ||
371 | +#ifdef FT_GE_218 | |
372 | + if (FTC_Manager_LookupFace(ftc_manager, imgd.face_id, &face)) | |
373 | +#else | |
374 | if (FTC_Manager_Lookup_Size(ftc_manager, &imgd.font, &face, 0)) | |
375 | +#endif | |
376 | return NSZeroPoint; | |
377 | ||
378 | if (FT_Load_Glyph(face, prev, FT_LOAD_DEFAULT)) | |
379 | @@ -2240,7 +2384,13 @@ | |
380 | int i, c = [string length]; | |
381 | int total; | |
382 | ||
383 | +#ifdef FT_GE_218 | |
384 | + FT_CharMapRec crec; | |
385 | + FT_Int cind; | |
386 | + FT_Face face1; | |
387 | +#else | |
388 | FTC_CMapDescRec cmap; | |
389 | +#endif | |
390 | unsigned int glyph; | |
391 | ||
392 | FTC_SBit sbit; | |
393 | @@ -2251,17 +2401,28 @@ | |
394 | FTC_ImageTypeRec *cur; | |
395 | #endif | |
396 | ||
397 | - | |
398 | +#ifdef FT_GE_218 | |
399 | + FTC_Manager_LookupFace(ftc_manager, imgd.face_id, &face1); | |
400 | + crec.face = face1; | |
401 | + crec.encoding = ft_encoding_unicode; | |
402 | + crec.platform_id = crec.encoding_id = 0; | |
403 | + cind = FT_Get_Charmap_Index( &crec ); | |
404 | +#else | |
405 | cmap.face_id = imgd.font.face_id; | |
406 | cmap.u.encoding = ft_encoding_unicode; | |
407 | cmap.type = FTC_CMAP_BY_ENCODING; | |
408 | +#endif | |
409 | ||
410 | total = 0; | |
411 | for (i = 0; i < c; i++) | |
412 | { | |
413 | ch = [string characterAtIndex: i]; | |
414 | cur = &imgd; | |
415 | +#ifdef FT_GE_218 | |
416 | + glyph = FTC_CMapCache_Lookup(ftc_cmapcache, imgd.face_id, cind, ch); | |
417 | +#else | |
418 | glyph = FTC_CMapCache_Lookup(ftc_cmapcache, &cmap, ch); | |
419 | +#endif | |
420 | ||
421 | /* TODO: shouldn't use sbit cache for this */ | |
422 | if (1) | |
423 | @@ -2285,7 +2446,11 @@ | |
424 | FT_Face face; | |
425 | NSGlyph g; | |
426 | ||
427 | +#ifdef FT_GE_218 | |
428 | + if (FTC_Manager_LookupFace(ftc_manager, imgd.face_id, &face)) | |
429 | +#else | |
430 | if (FTC_Manager_Lookup_Size(ftc_manager, &imgd.font, &face, 0)) | |
431 | +#endif | |
432 | return NSNullGlyph; | |
433 | ||
434 | g = FT_Get_Name_Index(face, (FT_String *)[glyphName lossyCString]); | |
435 | @@ -2526,7 +2691,12 @@ | |
436 | { | |
437 | unichar *c; | |
438 | int i; | |
439 | +#ifdef FT_GE_218 | |
440 | + FT_CharMapRec crec; | |
441 | + FT_Int cind; | |
442 | +#else | |
443 | FTC_CMapDescRec cmap; | |
444 | +#endif | |
445 | unsigned int glyph; | |
446 | ||
447 | unichar *uch; | |
448 | @@ -2557,9 +2727,14 @@ | |
449 | ||
450 | cur = imgd; | |
451 | ||
452 | +#ifdef FT_GE_218 | |
453 | + crec.encoding = ft_encoding_unicode; | |
454 | + crec.platform_id = crec.encoding_id = 0; | |
455 | +#else | |
456 | cmap.face_id = imgd.font.face_id; | |
457 | cmap.u.encoding = ft_encoding_unicode; | |
458 | cmap.type = FTC_CMAP_BY_ENCODING; | |
459 | +#endif | |
460 | ||
461 | for (c = uch, i = 0; i < ulen; i++, c++) | |
462 | { | |
463 | @@ -2567,11 +2742,23 @@ | |
464 | FT_Glyph gl; | |
465 | FT_OutlineGlyph og; | |
466 | ||
467 | +#ifdef FT_GE_218 | |
468 | + if (FTC_Manager_LookupFace(ftc_manager, cur.face_id, &face)) | |
469 | +#else | |
470 | + if (FTC_Manager_Lookup_Size(ftc_manager, &cur.font, &face, 0)) | |
471 | +#endif | |
472 | + continue; | |
473 | + | |
474 | +#ifdef FT_GE_218 | |
475 | + crec.face = face; | |
476 | + cind = FT_Get_Charmap_Index( &crec ); | |
477 | + glyph = FTC_CMapCache_Lookup(ftc_cmapcache, imgd.face_id, cind, *c); | |
478 | + cur.face_id = imgd.face_id; | |
479 | +#else | |
480 | glyph = FTC_CMapCache_Lookup(ftc_cmapcache, &cmap, *c); | |
481 | cur.font.face_id = imgd.font.face_id; | |
482 | +#endif | |
483 | ||
484 | - if (FTC_Manager_Lookup_Size(ftc_manager, &cur.font, &face, 0)) | |
485 | - continue; | |
486 | if (FT_Load_Glyph(face, glyph, FT_LOAD_DEFAULT)) | |
487 | continue; | |
488 | ||
489 | @@ -2630,7 +2817,11 @@ | |
490 | ||
491 | glyph = *glyphs - 1; | |
492 | ||
493 | +#ifdef FT_GE_218 | |
494 | + if (FTC_Manager_LookupFace(ftc_manager, imgd.face_id, &face)) | |
495 | +#else | |
496 | if (FTC_Manager_Lookup_Size(ftc_manager, &imgd.font, &face, 0)) | |
497 | +#endif | |
498 | continue; | |
499 | if (FT_Load_Glyph(face, glyph, FT_LOAD_DEFAULT)) | |
500 | continue; | |
501 | @@ -2757,7 +2948,6 @@ | |
502 | transform: (NSAffineTransform *)transform | |
503 | drawinfo: (struct draw_info_s *)di | |
504 | { | |
505 | - FTC_CMapDescRec cmap; | |
506 | unsigned int glyph; | |
507 | ||
508 | int use_sbit; | |
509 | @@ -2808,15 +2998,24 @@ | |
510 | xx < 72 && yy < 72 && xx > 0.5 && yy > 0.5) | |
511 | { | |
512 | use_sbit = 1; | |
513 | +#ifdef FT_GE_218 | |
514 | + cur.width = xx; | |
515 | + cur.height = yy; | |
516 | +#else | |
517 | cur.font.pix_width = xx; | |
518 | cur.font.pix_height = yy; | |
519 | +#endif | |
520 | ||
521 | /* if (cur.font.pix_width < 16 && cur.font.pix_height < 16 && | |
522 | cur.font.pix_width > 6 && cur.font.pix_height > 6) | |
523 | cur.type = ftc_image_mono; | |
524 | else*/ | |
525 | #ifdef FT212_STUFF | |
526 | +#ifdef FT_GE_218 | |
527 | + cur.type = ftc_image_grays, subpixel = YES, cur.width *= 3, x *= 3; | |
528 | +#else | |
529 | cur.type = ftc_image_grays, subpixel = YES, cur.font.pix_width *= 3, x *= 3; | |
530 | +#endif | |
531 | #else | |
532 | cur.flags = FT_LOAD_TARGET_LCD, subpixel = YES; | |
533 | #endif | |
534 | @@ -2835,7 +3034,11 @@ | |
535 | ||
536 | f = (int)f; | |
537 | ||
538 | +#ifdef FT_GE_218 | |
539 | + cur.width = cur.height = f; | |
540 | +#else | |
541 | cur.font.pix_width = cur.font.pix_height = f; | |
542 | +#endif | |
543 | ftmatrix.xx = xx / f * 65536.0; | |
544 | ftmatrix.xy = xy / f * 65536.0; | |
545 | ftmatrix.yx = yx / f * 65536.0; | |
546 | @@ -2848,10 +3051,6 @@ | |
547 | /* NSLog(@"drawString: '%s' at: %i:%i to: %i:%i:%i:%i:%p\n", | |
548 | s, x, y, x0, y0, x1, y1, buf);*/ | |
549 | ||
550 | - cmap.face_id = imgd.font.face_id; | |
551 | - cmap.u.encoding = ft_encoding_unicode; | |
552 | - cmap.type = FTC_CMAP_BY_ENCODING; | |
553 | - | |
554 | for (; length; length--, glyphs++) | |
555 | { | |
556 | glyph = *glyphs - 1; | |
557 | @@ -3033,7 +3232,11 @@ | |
558 | FT_Glyph gl; | |
559 | FT_BitmapGlyph gb; | |
560 | ||
561 | +#ifdef FT_GE_218 | |
562 | + if (FTC_Manager_LookupFace(ftc_manager, cur.face_id, &face)) | |
563 | +#else | |
564 | if (FTC_Manager_Lookup_Size(ftc_manager, &cur.font, &face, 0)) | |
565 | +#endif | |
566 | continue; | |
567 | ||
568 | /* TODO: for rotations of 90, 180, 270, and integer | |
569 | @@ -3134,6 +3337,17 @@ | |
570 | { | |
571 | FTFontInfo *fi=fontInfo; | |
572 | ||
573 | +#ifdef FT_GE_218 | |
574 | + FT_CharMapRec crec; | |
575 | + FT_Int cind; | |
576 | + FT_Face face1; | |
577 | + FTC_Manager_LookupFace(ftc_manager, fi->imgd.face_id, &face1); | |
578 | + crec.face = face1; | |
579 | + crec.encoding = ft_encoding_unicode; | |
580 | + crec.platform_id = crec.encoding_id = 0; | |
581 | + cind = FT_Get_Charmap_Index( &crec ); | |
582 | + return FTC_CMapCache_Lookup(ftc_cmapcache, fi->imgd.face_id, cind, ch) + 1; | |
583 | +#else | |
584 | FTC_CMapDescRec cmap; | |
585 | ||
586 | cmap.face_id = fi->imgd.font.face_id; | |
587 | @@ -3141,6 +3355,7 @@ | |
588 | cmap.type = FTC_CMAP_BY_ENCODING; | |
589 | ||
590 | return FTC_CMapCache_Lookup(ftc_cmapcache, &cmap, ch) + 1; | |
591 | +#endif | |
592 | } | |
593 | ||
594 | -(NSString *) nameOfGlyph: (NSGlyph)glyph | |
595 | @@ -3152,7 +3367,11 @@ | |
596 | ||
597 | glyph--; | |
598 | ||
599 | +#ifdef FT_GE_218 | |
600 | + if (FTC_Manager_LookupFace(ftc_manager, fi->imgd.face_id, &face)) | |
601 | +#else | |
602 | if (FTC_Manager_Lookup_Size(ftc_manager, &fi->imgd.font, &face, 0)) | |
603 | +#endif | |
604 | return nil; | |
605 | ||
606 | if (FT_Get_Glyph_Name(face,glyph,buf,sizeof(buf))) | |
607 | @@ -3219,7 +3438,13 @@ | |
608 | unsigned int ch,ch2,ch3; | |
609 | ||
610 | FTFontInfo *fi=[run->font fontInfo]; | |
611 | +#ifdef FT_GE_218 | |
612 | + FT_CharMapRec crec; | |
613 | + FT_Int cind; | |
614 | + FT_Face face1; | |
615 | +#else | |
616 | FTC_CMapDescRec cmap; | |
617 | +#endif | |
618 | ||
619 | NSCharacterSet *cs=[NSCharacterSet controlCharacterSet]; | |
620 | IMP characterIsMember=[cs methodForSelector: @selector(characterIsMember:)]; | |
621 | @@ -3231,9 +3456,17 @@ | |
622 | [[_textStorage string] getCharacters: buf | |
623 | range: NSMakeRange(pos,c)]; | |
624 | ||
625 | +#ifdef FT_GE_218 | |
626 | + FTC_Manager_LookupFace(ftc_manager, fi->imgd.face_id, &face1); | |
627 | + crec.face = face1; | |
628 | + crec.encoding = ft_encoding_unicode; | |
629 | + crec.platform_id = crec.encoding_id = 0; | |
630 | + cind = FT_Get_Charmap_Index( &crec ); | |
631 | +#else | |
632 | cmap.face_id = fi->imgd.font.face_id; | |
633 | cmap.u.encoding = ft_encoding_unicode; | |
634 | cmap.type = FTC_CMAP_BY_ENCODING; | |
635 | +#endif | |
636 | ||
637 | /* first guess */ | |
638 | glyph_size=c; | |
639 | @@ -3309,7 +3542,11 @@ | |
640 | ch = 0xfffd; | |
641 | } | |
642 | ||
643 | +#ifdef FT_GE_218 | |
644 | + g->g=FTC_CMapCache_Lookup(ftc_cmapcache, fi->imgd.face_id, cind, ch) + 1; | |
645 | +#else | |
646 | g->g=FTC_CMapCache_Lookup(ftc_cmapcache, &cmap, ch) + 1; | |
647 | +#endif | |
648 | ||
649 | if (g->g == 1 && ch<0x10000) | |
650 | { | |
651 | @@ -3325,7 +3562,11 @@ | |
652 | g=run->glyphs+j; | |
653 | memset(&run->glyphs[glyph_size-1],0,sizeof(glyph_t)); | |
654 | ||
655 | +#ifdef FT_GE_218 | |
656 | + g->g=FTC_CMapCache_Lookup(ftc_cmapcache, fi->imgd.face_id, cind, *decomp) + 1; | |
657 | +#else | |
658 | g->g=FTC_CMapCache_Lookup(ftc_cmapcache, &cmap, *decomp) + 1; | |
659 | +#endif | |
660 | if (g->g == 1) | |
661 | break; | |
662 | c++; | |
663 | @@ -3365,7 +3606,11 @@ | |
664 | FT_Face face; | |
665 | ||
666 | g--; | |
667 | +#ifdef FT_GE_218 | |
668 | + if (FTC_Manager_LookupFace(ftc_manager, imgd.face_id, &face)) | |
669 | +#else | |
670 | if (FTC_Manager_Lookup_Size(ftc_manager, &imgd.font, &face, 0)) | |
671 | +#endif | |
672 | return ".notdef"; | |
673 | ||
674 | if (FT_Get_Glyph_Name(face, g, buf, sizeof(buf))) |