Commit | Line | Data |
---|---|---|
e14dc92d | 1 | /* Font backend for the Microsoft W32 Uniscribe API. |
acaf905b | 2 | Copyright (C) 2008-2012 Free Software Foundation, Inc. |
e14dc92d JR |
3 | |
4 | This file is part of GNU Emacs. | |
5 | ||
9ec0b715 | 6 | GNU Emacs is free software: you can redistribute it and/or modify |
e14dc92d | 7 | it under the terms of the GNU General Public License as published by |
9ec0b715 GM |
8 | the Free Software Foundation, either version 3 of the License, or |
9 | (at your option) any later version. | |
e14dc92d JR |
10 | |
11 | GNU Emacs is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
9ec0b715 | 17 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
e14dc92d | 18 | |
e14dc92d JR |
19 | |
20 | #include <config.h> | |
21 | /* Override API version - Uniscribe is only available as standard since | |
22 | Windows 2000, though most users of older systems will have it | |
23 | since it installs with Internet Explorer 5.0 and other software. | |
24 | We only enable the feature if it is available, so there is no chance | |
5a89f0a7 | 25 | of calling non-existent functions. */ |
e14dc92d JR |
26 | #undef _WIN32_WINNT |
27 | #define _WIN32_WINNT 0x500 | |
28 | #include <windows.h> | |
29 | #include <usp10.h> | |
d7306fe6 | 30 | #include <setjmp.h> |
e14dc92d JR |
31 | |
32 | #include "lisp.h" | |
33 | #include "w32term.h" | |
34 | #include "frame.h" | |
35 | #include "dispextern.h" | |
36 | #include "character.h" | |
37 | #include "charset.h" | |
716e6ba3 | 38 | #include "composite.h" |
e14dc92d JR |
39 | #include "fontset.h" |
40 | #include "font.h" | |
41 | #include "w32font.h" | |
42 | ||
43 | struct uniscribe_font_info | |
44 | { | |
45 | struct w32font_info w32_font; | |
46 | SCRIPT_CACHE cache; | |
47 | }; | |
48 | ||
49 | int uniscribe_available = 0; | |
50 | ||
51 | /* Defined in w32font.c, since it is required there as well. */ | |
52 | extern Lisp_Object Quniscribe; | |
53 | extern Lisp_Object Qopentype; | |
54 | ||
e14dc92d | 55 | /* EnumFontFamiliesEx callback. */ |
f57e2426 J |
56 | static int CALLBACK add_opentype_font_name_to_list (ENUMLOGFONTEX *, |
57 | NEWTEXTMETRICEX *, | |
58 | DWORD, LPARAM); | |
e14dc92d JR |
59 | /* Used by uniscribe_otf_capability. */ |
60 | static Lisp_Object otf_features (HDC context, char *table); | |
61 | ||
62 | static int | |
b56ceb92 | 63 | memq_no_quit (Lisp_Object elt, Lisp_Object list) |
e14dc92d JR |
64 | { |
65 | while (CONSP (list) && ! EQ (XCAR (list), elt)) | |
66 | list = XCDR (list); | |
67 | return (CONSP (list)); | |
68 | } | |
69 | ||
70 | \f | |
71 | /* Font backend interface implementation. */ | |
72 | static Lisp_Object | |
b56ceb92 | 73 | uniscribe_list (Lisp_Object frame, Lisp_Object font_spec) |
e14dc92d | 74 | { |
07d9ba9b | 75 | Lisp_Object fonts = w32font_list_internal (frame, font_spec, 1); |
678dca3d | 76 | FONT_ADD_LOG ("uniscribe-list", font_spec, fonts); |
07d9ba9b | 77 | return fonts; |
e14dc92d JR |
78 | } |
79 | ||
80 | static Lisp_Object | |
b56ceb92 | 81 | uniscribe_match (Lisp_Object frame, Lisp_Object font_spec) |
e14dc92d | 82 | { |
07d9ba9b | 83 | Lisp_Object entity = w32font_match_internal (frame, font_spec, 1); |
678dca3d | 84 | FONT_ADD_LOG ("uniscribe-match", font_spec, entity); |
07d9ba9b | 85 | return entity; |
e14dc92d JR |
86 | } |
87 | ||
88 | static Lisp_Object | |
b56ceb92 | 89 | uniscribe_list_family (Lisp_Object frame) |
e14dc92d JR |
90 | { |
91 | Lisp_Object list = Qnil; | |
92 | LOGFONT font_match_pattern; | |
93 | HDC dc; | |
94 | FRAME_PTR f = XFRAME (frame); | |
95 | ||
72af86bd | 96 | memset (&font_match_pattern, 0, sizeof (font_match_pattern)); |
e14dc92d JR |
97 | /* Limit enumerated fonts to outline fonts to save time. */ |
98 | font_match_pattern.lfOutPrecision = OUT_OUTLINE_PRECIS; | |
99 | ||
100 | dc = get_frame_dc (f); | |
101 | ||
102 | EnumFontFamiliesEx (dc, &font_match_pattern, | |
103 | (FONTENUMPROC) add_opentype_font_name_to_list, | |
104 | (LPARAM) &list, 0); | |
105 | release_frame_dc (f, dc); | |
106 | ||
107 | return list; | |
108 | } | |
109 | ||
fd302b02 | 110 | static Lisp_Object |
b56ceb92 | 111 | uniscribe_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size) |
e14dc92d | 112 | { |
fd302b02 | 113 | Lisp_Object font_object |
e83ceb8b KH |
114 | = font_make_object (VECSIZE (struct uniscribe_font_info), |
115 | font_entity, pixel_size); | |
e14dc92d | 116 | struct uniscribe_font_info *uniscribe_font |
fd302b02 | 117 | = (struct uniscribe_font_info *) XFONT_OBJECT (font_object); |
e14dc92d | 118 | |
4b135503 JR |
119 | ASET (font_object, FONT_TYPE_INDEX, Quniscribe); |
120 | ||
fd302b02 | 121 | if (!w32font_open_internal (f, font_entity, pixel_size, font_object)) |
e14dc92d | 122 | { |
fd302b02 | 123 | return Qnil; |
e14dc92d JR |
124 | } |
125 | ||
126 | /* Initialize the cache for this font. */ | |
127 | uniscribe_font->cache = NULL; | |
11856d4d | 128 | |
bd187c49 JR |
129 | /* Uniscribe backend uses glyph indices. */ |
130 | uniscribe_font->w32_font.glyph_idx = ETO_GLYPH_INDEX; | |
131 | ||
e14dc92d | 132 | /* Mark the format as opentype */ |
fd302b02 | 133 | uniscribe_font->w32_font.font.props[FONT_FORMAT_INDEX] = Qopentype; |
e14dc92d JR |
134 | uniscribe_font->w32_font.font.driver = &uniscribe_font_driver; |
135 | ||
fd302b02 | 136 | return font_object; |
e14dc92d JR |
137 | } |
138 | ||
139 | static void | |
b56ceb92 | 140 | uniscribe_close (FRAME_PTR f, struct font *font) |
e14dc92d JR |
141 | { |
142 | struct uniscribe_font_info *uniscribe_font | |
143 | = (struct uniscribe_font_info *) font; | |
144 | ||
145 | if (uniscribe_font->cache) | |
11856d4d | 146 | ScriptFreeCache (&(uniscribe_font->cache)); |
e14dc92d JR |
147 | |
148 | w32font_close (f, font); | |
149 | } | |
150 | ||
151 | /* Return a list describing which scripts/languages FONT supports by | |
152 | which GSUB/GPOS features of OpenType tables. */ | |
153 | static Lisp_Object | |
b56ceb92 | 154 | uniscribe_otf_capability (struct font *font) |
e14dc92d JR |
155 | { |
156 | HDC context; | |
157 | HFONT old_font; | |
158 | struct frame *f; | |
159 | Lisp_Object capability = Fcons (Qnil, Qnil); | |
160 | Lisp_Object features; | |
161 | ||
162 | f = XFRAME (selected_frame); | |
163 | context = get_frame_dc (f); | |
ed3751c8 | 164 | old_font = SelectObject (context, FONT_HANDLE (font)); |
e14dc92d JR |
165 | |
166 | features = otf_features (context, "GSUB"); | |
167 | XSETCAR (capability, features); | |
168 | features = otf_features (context, "GPOS"); | |
169 | XSETCDR (capability, features); | |
170 | ||
171 | SelectObject (context, old_font); | |
172 | release_frame_dc (f, context); | |
173 | ||
174 | return capability; | |
175 | } | |
176 | ||
177 | /* Uniscribe implementation of shape for font backend. | |
178 | ||
6e6b8e25 EZ |
179 | Shape text in LGSTRING. See the docstring of |
180 | `composition-get-gstring' for the format of LGSTRING. If the | |
181 | (N+1)th element of LGSTRING is nil, input of shaping is from the | |
182 | 1st to (N)th elements. In each input glyph, FROM, TO, CHAR, and | |
183 | CODE are already set. | |
e14dc92d JR |
184 | |
185 | This function updates all fields of the input glyphs. If the | |
186 | output glyphs (M) are more than the input glyphs (N), (N+1)th | |
187 | through (M)th elements of LGSTRING are updated possibly by making | |
188 | a new glyph object and storing it in LGSTRING. If (M) is greater | |
6e6b8e25 EZ |
189 | than the length of LGSTRING, nil should be returned. In that case, |
190 | this function is called again with a larger LGSTRING. */ | |
e14dc92d | 191 | static Lisp_Object |
b56ceb92 | 192 | uniscribe_shape (Lisp_Object lgstring) |
e14dc92d JR |
193 | { |
194 | struct font * font; | |
195 | struct uniscribe_font_info * uniscribe_font; | |
196 | EMACS_UINT nchars; | |
0ce24b2d | 197 | int nitems, max_items, i, max_glyphs, done_glyphs; |
e14dc92d JR |
198 | wchar_t *chars; |
199 | WORD *glyphs, *clusters; | |
200 | SCRIPT_ITEM *items; | |
e14dc92d JR |
201 | SCRIPT_VISATTR *attributes; |
202 | int *advances; | |
203 | GOFFSET *offsets; | |
204 | ABC overall_metrics; | |
e14dc92d | 205 | HRESULT result; |
c320e90a JR |
206 | struct frame * f = NULL; |
207 | HDC context = NULL; | |
208 | HFONT old_font = NULL; | |
e14dc92d JR |
209 | |
210 | CHECK_FONT_GET_OBJECT (LGSTRING_FONT (lgstring), font); | |
211 | uniscribe_font = (struct uniscribe_font_info *) font; | |
212 | ||
213 | /* Get the chars from lgstring in a form we can use with uniscribe. */ | |
716e6ba3 | 214 | max_glyphs = nchars = LGSTRING_GLYPH_LEN (lgstring); |
0ce24b2d | 215 | done_glyphs = 0; |
e14dc92d | 216 | chars = (wchar_t *) alloca (nchars * sizeof (wchar_t)); |
6e6b8e25 EZ |
217 | /* FIXME: This loop assumes that characters in the input LGSTRING |
218 | are all inside the BMP. Need to encode characters beyond the BMP | |
219 | as UTF-16. */ | |
e14dc92d JR |
220 | for (i = 0; i < nchars; i++) |
221 | { | |
222 | /* lgstring can be bigger than the number of characters in it, in | |
223 | the case where more glyphs are required to display those characters. | |
224 | If that is the case, note the real number of characters. */ | |
225 | if (NILP (LGSTRING_GLYPH (lgstring, i))) | |
226 | nchars = i; | |
227 | else | |
228 | chars[i] = LGLYPH_CHAR (LGSTRING_GLYPH (lgstring, i)); | |
229 | } | |
230 | ||
231 | /* First we need to break up the glyph string into runs of glyphs that | |
232 | can be treated together. First try a single run. */ | |
233 | max_items = 2; | |
23f86fce | 234 | items = xmalloc (sizeof (SCRIPT_ITEM) * max_items + 1); |
e14dc92d | 235 | |
11856d4d | 236 | while ((result = ScriptItemize (chars, nchars, max_items, NULL, NULL, |
e14dc92d JR |
237 | items, &nitems)) == E_OUTOFMEMORY) |
238 | { | |
239 | /* If that wasn't enough, keep trying with one more run. */ | |
240 | max_items++; | |
241 | items = (SCRIPT_ITEM *) xrealloc (items, | |
0ce24b2d | 242 | sizeof (SCRIPT_ITEM) * max_items + 1); |
e14dc92d JR |
243 | } |
244 | ||
c320e90a | 245 | if (FAILED (result)) |
e14dc92d JR |
246 | { |
247 | xfree (items); | |
248 | return Qnil; | |
249 | } | |
250 | ||
e14dc92d JR |
251 | glyphs = alloca (max_glyphs * sizeof (WORD)); |
252 | clusters = alloca (nchars * sizeof (WORD)); | |
253 | attributes = alloca (max_glyphs * sizeof (SCRIPT_VISATTR)); | |
254 | advances = alloca (max_glyphs * sizeof (int)); | |
255 | offsets = alloca (max_glyphs * sizeof (GOFFSET)); | |
e14dc92d JR |
256 | |
257 | for (i = 0; i < nitems; i++) | |
258 | { | |
6e6b8e25 | 259 | int nglyphs, nchars_in_run; |
e14dc92d | 260 | nchars_in_run = items[i+1].iCharPos - items[i].iCharPos; |
6e6b8e25 EZ |
261 | /* Force ScriptShape to generate glyphs in the same order as |
262 | they are in the input LGSTRING, which is in the logical | |
263 | order. */ | |
264 | items[i].a.fLogicalOrder = 1; | |
e14dc92d | 265 | |
c320e90a JR |
266 | /* Context may be NULL here, in which case the cache should be |
267 | used without needing to select the font. */ | |
e14dc92d JR |
268 | result = ScriptShape (context, &(uniscribe_font->cache), |
269 | chars + items[i].iCharPos, nchars_in_run, | |
270 | max_glyphs - done_glyphs, &(items[i].a), | |
271 | glyphs, clusters, attributes, &nglyphs); | |
c320e90a JR |
272 | |
273 | if (result == E_PENDING && !context) | |
274 | { | |
275 | /* This assumes the selected frame is on the same display as the | |
276 | one we are drawing. It would be better for the frame to be | |
277 | passed in. */ | |
278 | f = XFRAME (selected_frame); | |
279 | context = get_frame_dc (f); | |
ed3751c8 | 280 | old_font = SelectObject (context, FONT_HANDLE (font)); |
c320e90a JR |
281 | |
282 | result = ScriptShape (context, &(uniscribe_font->cache), | |
283 | chars + items[i].iCharPos, nchars_in_run, | |
284 | max_glyphs - done_glyphs, &(items[i].a), | |
285 | glyphs, clusters, attributes, &nglyphs); | |
286 | } | |
287 | ||
e14dc92d JR |
288 | if (result == E_OUTOFMEMORY) |
289 | { | |
290 | /* Need a bigger lgstring. */ | |
291 | lgstring = Qnil; | |
292 | break; | |
293 | } | |
c320e90a | 294 | else if (FAILED (result)) |
e14dc92d JR |
295 | { |
296 | /* Can't shape this run - return results so far if any. */ | |
297 | break; | |
298 | } | |
0ce24b2d JR |
299 | else if (items[i].a.fNoGlyphIndex) |
300 | { | |
301 | /* Glyph indices not supported by this font (or OS), means we | |
302 | can't really do any meaningful shaping. */ | |
303 | break; | |
304 | } | |
e14dc92d JR |
305 | else |
306 | { | |
307 | result = ScriptPlace (context, &(uniscribe_font->cache), | |
308 | glyphs, nglyphs, attributes, &(items[i].a), | |
309 | advances, offsets, &overall_metrics); | |
c320e90a JR |
310 | if (result == E_PENDING && !context) |
311 | { | |
312 | /* Cache not complete... */ | |
313 | f = XFRAME (selected_frame); | |
314 | context = get_frame_dc (f); | |
ed3751c8 | 315 | old_font = SelectObject (context, FONT_HANDLE (font)); |
c320e90a JR |
316 | |
317 | result = ScriptPlace (context, &(uniscribe_font->cache), | |
318 | glyphs, nglyphs, attributes, &(items[i].a), | |
319 | advances, offsets, &overall_metrics); | |
320 | } | |
321 | if (SUCCEEDED (result)) | |
e14dc92d | 322 | { |
b2f09701 EZ |
323 | int j, from, to, adj_offset = 0; |
324 | ||
325 | /* For RTL text, the Uniscribe shaper prepares the | |
326 | values in ADVANCES array for layout in reverse order, | |
327 | whereby "advance width" is applied to move the pen in | |
328 | reverse direction and _before_ drawing the glyph. | |
329 | Since we draw glyphs in their normal left-to-right | |
330 | order, we need to adjust the coordinates of each | |
331 | non-base glyph in a grapheme cluster via X-OFF | |
332 | component of the gstring's ADJUSTMENT sub-vector. | |
333 | This loop computes the initial value of the | |
334 | adjustment for the base character, which is then | |
335 | updated for each successive glyph in the grapheme | |
336 | cluster. */ | |
337 | if (items[i].a.fRTL) | |
338 | for (j = 1; j < nglyphs; j++) | |
339 | adj_offset += advances[j]; | |
b7655e0c | 340 | |
6e6b8e25 | 341 | from = 0; |
b7655e0c | 342 | to = from; |
e14dc92d JR |
343 | |
344 | for (j = 0; j < nglyphs; j++) | |
345 | { | |
346 | int lglyph_index = j + done_glyphs; | |
347 | Lisp_Object lglyph = LGSTRING_GLYPH (lgstring, lglyph_index); | |
0ce24b2d | 348 | ABC char_metric; |
4bf84f7d | 349 | unsigned gl; |
e14dc92d JR |
350 | |
351 | if (NILP (lglyph)) | |
352 | { | |
353 | lglyph = Fmake_vector (make_number (LGLYPH_SIZE), Qnil); | |
354 | LGSTRING_SET_GLYPH (lgstring, lglyph_index, lglyph); | |
355 | } | |
4bf84f7d EZ |
356 | /* Copy to a 32-bit data type to shut up the |
357 | compiler warning in LGLYPH_SET_CODE about | |
358 | comparison being always false. */ | |
359 | gl = glyphs[j]; | |
360 | LGLYPH_SET_CODE (lglyph, gl); | |
0ce24b2d | 361 | |
6e6b8e25 EZ |
362 | /* Detect clusters, for linking codes back to |
363 | characters. */ | |
0ce24b2d | 364 | if (attributes[j].fClusterStart) |
e14dc92d | 365 | { |
6e6b8e25 EZ |
366 | while (from < nchars_in_run && clusters[from] < j) |
367 | from++; | |
368 | if (from >= nchars_in_run) | |
b7655e0c | 369 | from = to = nchars_in_run - 1; |
0ce24b2d JR |
370 | else |
371 | { | |
372 | int k; | |
6e6b8e25 EZ |
373 | to = nchars_in_run - 1; |
374 | for (k = from + 1; k < nchars_in_run; k++) | |
0ce24b2d JR |
375 | { |
376 | if (clusters[k] > j) | |
377 | { | |
b7655e0c | 378 | to = k - 1; |
0ce24b2d JR |
379 | break; |
380 | } | |
381 | } | |
382 | } | |
e14dc92d | 383 | } |
e14dc92d | 384 | |
b7655e0c JR |
385 | LGLYPH_SET_CHAR (lglyph, chars[items[i].iCharPos |
386 | + from]); | |
387 | LGLYPH_SET_FROM (lglyph, items[i].iCharPos + from); | |
388 | LGLYPH_SET_TO (lglyph, items[i].iCharPos + to); | |
e14dc92d | 389 | |
0ce24b2d JR |
390 | /* Metrics. */ |
391 | LGLYPH_SET_WIDTH (lglyph, advances[j]); | |
392 | LGLYPH_SET_ASCENT (lglyph, font->ascent); | |
393 | LGLYPH_SET_DESCENT (lglyph, font->descent); | |
394 | ||
395 | result = ScriptGetGlyphABCWidth (context, | |
396 | &(uniscribe_font->cache), | |
397 | glyphs[j], &char_metric); | |
c320e90a JR |
398 | if (result == E_PENDING && !context) |
399 | { | |
400 | /* Cache incomplete... */ | |
401 | f = XFRAME (selected_frame); | |
402 | context = get_frame_dc (f); | |
ed3751c8 | 403 | old_font = SelectObject (context, FONT_HANDLE (font)); |
c320e90a JR |
404 | result = ScriptGetGlyphABCWidth (context, |
405 | &(uniscribe_font->cache), | |
406 | glyphs[j], &char_metric); | |
407 | } | |
e14dc92d | 408 | |
11856d4d | 409 | if (SUCCEEDED (result)) |
0ce24b2d | 410 | { |
b2f09701 EZ |
411 | int lbearing = char_metric.abcA; |
412 | int rbearing = char_metric.abcA + char_metric.abcB; | |
413 | ||
414 | LGLYPH_SET_LBEARING (lglyph, lbearing); | |
415 | LGLYPH_SET_RBEARING (lglyph, rbearing); | |
0ce24b2d JR |
416 | } |
417 | else | |
e14dc92d | 418 | { |
0ce24b2d JR |
419 | LGLYPH_SET_LBEARING (lglyph, 0); |
420 | LGLYPH_SET_RBEARING (lglyph, advances[j]); | |
e14dc92d | 421 | } |
0ce24b2d | 422 | |
b2f09701 EZ |
423 | if (offsets[j].du || offsets[j].dv |
424 | /* For non-base glyphs of RTL grapheme clusters, | |
425 | adjust the X offset even if both DU and DV | |
426 | are zero. */ | |
427 | || (!attributes[j].fClusterStart && items[i].a.fRTL)) | |
e14dc92d | 428 | { |
0ce24b2d JR |
429 | Lisp_Object vec; |
430 | vec = Fmake_vector (make_number (3), Qnil); | |
b2f09701 EZ |
431 | if (items[i].a.fRTL) |
432 | { | |
433 | /* Empirically, it looks like Uniscribe | |
434 | interprets DU in reverse direction for | |
435 | RTL clusters. E.g., if we don't reverse | |
436 | the direction, the Hebrew point HOLAM is | |
437 | drawn above the right edge of the base | |
438 | consonant, instead of above the left edge. */ | |
439 | ASET (vec, 0, make_number (-offsets[j].du | |
440 | + adj_offset)); | |
441 | /* Update the adjustment value for the width | |
442 | advance of the glyph we just emitted. */ | |
443 | adj_offset -= 2 * advances[j]; | |
444 | } | |
445 | else | |
446 | ASET (vec, 0, make_number (offsets[j].du + adj_offset)); | |
0ce24b2d JR |
447 | ASET (vec, 1, make_number (offsets[j].dv)); |
448 | /* Based on what ftfont.c does... */ | |
449 | ASET (vec, 2, make_number (advances[j])); | |
450 | LGLYPH_SET_ADJUSTMENT (lglyph, vec); | |
e14dc92d | 451 | } |
0ce24b2d | 452 | else |
b2f09701 EZ |
453 | { |
454 | LGLYPH_SET_ADJUSTMENT (lglyph, Qnil); | |
455 | /* Update the adjustment value to compensate for | |
456 | the width of the base character. */ | |
457 | if (items[i].a.fRTL) | |
458 | adj_offset -= advances[j]; | |
459 | } | |
c320e90a JR |
460 | } |
461 | } | |
e14dc92d JR |
462 | } |
463 | done_glyphs += nglyphs; | |
e14dc92d JR |
464 | } |
465 | ||
466 | xfree (items); | |
c320e90a JR |
467 | |
468 | if (context) | |
469 | { | |
470 | SelectObject (context, old_font); | |
471 | release_frame_dc (f, context); | |
472 | } | |
e14dc92d JR |
473 | |
474 | if (NILP (lgstring)) | |
475 | return Qnil; | |
476 | else | |
0ce24b2d | 477 | return make_number (done_glyphs); |
e14dc92d JR |
478 | } |
479 | ||
480 | /* Uniscribe implementation of encode_char for font backend. | |
51e4f4a8 | 481 | Return a glyph code of FONT for character C (Unicode code point). |
e14dc92d JR |
482 | If FONT doesn't have such a glyph, return FONT_INVALID_CODE. */ |
483 | static unsigned | |
b56ceb92 | 484 | uniscribe_encode_char (struct font *font, int c) |
e14dc92d | 485 | { |
c320e90a JR |
486 | HDC context = NULL; |
487 | struct frame *f = NULL; | |
488 | HFONT old_font = NULL; | |
11856d4d | 489 | unsigned code = FONT_INVALID_CODE; |
c320e90a JR |
490 | wchar_t ch[2]; |
491 | int len; | |
492 | SCRIPT_ITEM* items; | |
493 | int nitems; | |
494 | struct uniscribe_font_info *uniscribe_font | |
495 | = (struct uniscribe_font_info *)font; | |
11856d4d | 496 | |
11856d4d JR |
497 | if (c < 0x10000) |
498 | { | |
c320e90a JR |
499 | ch[0] = (wchar_t) c; |
500 | len = 1; | |
11856d4d | 501 | } |
11856d4d | 502 | else |
f31cf550 JR |
503 | { |
504 | DWORD surrogate = c - 0x10000; | |
e14dc92d | 505 | |
f31cf550 | 506 | /* High surrogate: U+D800 - U+DBFF. */ |
11856d4d | 507 | ch[0] = 0xD800 + ((surrogate >> 10) & 0x03FF); |
f31cf550 | 508 | /* Low surrogate: U+DC00 - U+DFFF. */ |
11856d4d | 509 | ch[1] = 0xDC00 + (surrogate & 0x03FF); |
c320e90a JR |
510 | len = 2; |
511 | } | |
11856d4d | 512 | |
c320e90a JR |
513 | /* Non BMP characters must be handled by the uniscribe shaping |
514 | engine as GDI functions (except blindly displaying lines of | |
fe7a3057 | 515 | Unicode text) and the promising looking ScriptGetCMap do not |
c320e90a JR |
516 | convert surrogate pairs to glyph indexes correctly. */ |
517 | { | |
11856d4d | 518 | items = (SCRIPT_ITEM *) alloca (sizeof (SCRIPT_ITEM) * 2 + 1); |
c320e90a JR |
519 | if (SUCCEEDED (ScriptItemize (ch, len, 2, NULL, NULL, items, &nitems))) |
520 | { | |
521 | HRESULT result; | |
b4233ec9 JR |
522 | /* Surrogates seem to need 2 here, even though only one glyph is |
523 | returned. Indic characters can also produce 2 or more glyphs for | |
524 | a single code point, but they need to use uniscribe_shape | |
525 | above for correct display. */ | |
526 | WORD glyphs[2], clusters[2]; | |
527 | SCRIPT_VISATTR attrs[2]; | |
11856d4d JR |
528 | int nglyphs; |
529 | ||
6e6b8e25 EZ |
530 | /* Force ScriptShape to generate glyphs in the logical |
531 | order. */ | |
532 | items[0].a.fLogicalOrder = 1; | |
533 | ||
c320e90a | 534 | result = ScriptShape (context, &(uniscribe_font->cache), |
b4233ec9 | 535 | ch, len, 2, &(items[0].a), |
c320e90a JR |
536 | glyphs, clusters, attrs, &nglyphs); |
537 | ||
538 | if (result == E_PENDING) | |
539 | { | |
540 | /* Use selected frame until API is updated to pass | |
541 | the frame. */ | |
542 | f = XFRAME (selected_frame); | |
543 | context = get_frame_dc (f); | |
ed3751c8 | 544 | old_font = SelectObject (context, FONT_HANDLE (font)); |
c320e90a JR |
545 | result = ScriptShape (context, &(uniscribe_font->cache), |
546 | ch, len, 2, &(items[0].a), | |
547 | glyphs, clusters, attrs, &nglyphs); | |
548 | } | |
549 | ||
550 | if (SUCCEEDED (result) && nglyphs == 1) | |
11856d4d | 551 | { |
1fc200d6 | 552 | /* Some fonts return .notdef glyphs instead of failing. |
7877f373 | 553 | (TrueType spec reserves glyph code 0 for .notdef) */ |
1fc200d6 JR |
554 | if (glyphs[0]) |
555 | code = glyphs[0]; | |
11856d4d | 556 | } |
c320e90a JR |
557 | else if (SUCCEEDED (result) || result == E_OUTOFMEMORY) |
558 | { | |
559 | /* This character produces zero or more than one glyph | |
560 | when shaped. But we still need the return from here | |
561 | to be valid for the shaping engine to be invoked | |
562 | later. */ | |
563 | result = ScriptGetCMap (context, &(uniscribe_font->cache), | |
564 | ch, len, 0, glyphs); | |
1fc200d6 | 565 | if (SUCCEEDED (result) && glyphs[0]) |
a608bcbf | 566 | code = glyphs[0]; |
c320e90a JR |
567 | } |
568 | } | |
f31cf550 | 569 | } |
c320e90a JR |
570 | if (context) |
571 | { | |
572 | SelectObject (context, old_font); | |
573 | release_frame_dc (f, context); | |
574 | } | |
e14dc92d | 575 | |
c320e90a | 576 | return code; |
e14dc92d JR |
577 | } |
578 | ||
579 | /* | |
580 | Shared with w32font: | |
581 | Lisp_Object uniscribe_get_cache (Lisp_Object frame); | |
582 | void uniscribe_free_entity (Lisp_Object font_entity); | |
583 | int uniscribe_has_char (Lisp_Object entity, int c); | |
584 | int uniscribe_text_extents (struct font *font, unsigned *code, | |
585 | int nglyphs, struct font_metrics *metrics); | |
586 | int uniscribe_draw (struct glyph_string *s, int from, int to, | |
587 | int x, int y, int with_background); | |
588 | ||
589 | Unused: | |
590 | int uniscribe_prepare_face (FRAME_PTR f, struct face *face); | |
591 | void uniscribe_done_face (FRAME_PTR f, struct face *face); | |
592 | int uniscribe_get_bitmap (struct font *font, unsigned code, | |
593 | struct font_bitmap *bitmap, int bits_per_pixel); | |
594 | void uniscribe_free_bitmap (struct font *font, struct font_bitmap *bitmap); | |
595 | void * uniscribe_get_outline (struct font *font, unsigned code); | |
596 | void uniscribe_free_outline (struct font *font, void *outline); | |
597 | int uniscribe_anchor_point (struct font *font, unsigned code, | |
598 | int index, int *x, int *y); | |
599 | int uniscribe_start_for_frame (FRAME_PTR f); | |
600 | int uniscribe_end_for_frame (FRAME_PTR f); | |
601 | ||
602 | */ | |
603 | ||
604 | \f | |
605 | /* Callback function for EnumFontFamiliesEx. | |
606 | Adds the name of opentype fonts to a Lisp list (passed in as the | |
607 | lParam arg). */ | |
608 | static int CALLBACK | |
b56ceb92 JB |
609 | add_opentype_font_name_to_list (ENUMLOGFONTEX *logical_font, |
610 | NEWTEXTMETRICEX *physical_font, | |
611 | DWORD font_type, LPARAM list_object) | |
e14dc92d JR |
612 | { |
613 | Lisp_Object* list = (Lisp_Object *) list_object; | |
614 | Lisp_Object family; | |
615 | ||
616 | /* Skip vertical fonts (intended only for printing) */ | |
617 | if (logical_font->elfLogFont.lfFaceName[0] == '@') | |
618 | return 1; | |
619 | ||
620 | /* Skip non opentype fonts. Count old truetype fonts as opentype, | |
621 | as some of them do contain GPOS and GSUB data that Uniscribe | |
622 | can make use of. */ | |
623 | if (!(physical_font->ntmTm.ntmFlags & NTMFLAGS_OPENTYPE) | |
624 | && font_type != TRUETYPE_FONTTYPE) | |
625 | return 1; | |
626 | ||
fe7a3057 | 627 | /* Skip fonts that have no Unicode coverage. */ |
351ccb76 JR |
628 | if (!physical_font->ntmFontSig.fsUsb[3] |
629 | && !physical_font->ntmFontSig.fsUsb[2] | |
630 | && !physical_font->ntmFontSig.fsUsb[1] | |
631 | && !(physical_font->ntmFontSig.fsUsb[0] & 0x3fffffff)) | |
632 | return 1; | |
633 | ||
e6df5336 | 634 | family = intern_font_name (logical_font->elfLogFont.lfFaceName); |
e14dc92d JR |
635 | if (! memq_no_quit (family, *list)) |
636 | *list = Fcons (family, *list); | |
637 | ||
638 | return 1; | |
639 | } | |
640 | ||
641 | \f | |
642 | /* :otf property handling. | |
643 | Since the necessary Uniscribe APIs for getting font tag information | |
644 | are only available in Vista, we need to parse the font data directly | |
645 | according to the OpenType Specification. */ | |
646 | ||
647 | /* Push into DWORD backwards to cope with endianness. */ | |
648 | #define OTF_TAG(STR) \ | |
649 | ((STR[3] << 24) | (STR[2] << 16) | (STR[1] << 8) | STR[0]) | |
650 | ||
651 | #define OTF_INT16_VAL(TABLE, OFFSET, PTR) \ | |
652 | do { \ | |
653 | BYTE temp, data[2]; \ | |
654 | if (GetFontData (context, TABLE, OFFSET, data, 2) != 2) \ | |
655 | goto font_table_error; \ | |
656 | temp = data[0], data[0] = data[1], data[1] = temp; \ | |
657 | memcpy (PTR, data, 2); \ | |
658 | } while (0) | |
659 | ||
660 | /* Do not reverse the bytes, because we will compare with a OTF_TAG value | |
661 | that has them reversed already. */ | |
662 | #define OTF_DWORDTAG_VAL(TABLE, OFFSET, PTR) \ | |
663 | do { \ | |
664 | if (GetFontData (context, TABLE, OFFSET, PTR, 4) != 4) \ | |
665 | goto font_table_error; \ | |
666 | } while (0) | |
667 | ||
668 | #define OTF_TAG_VAL(TABLE, OFFSET, STR) \ | |
669 | do { \ | |
670 | if (GetFontData (context, TABLE, OFFSET, STR, 4) != 4) \ | |
671 | goto font_table_error; \ | |
672 | STR[4] = '\0'; \ | |
673 | } while (0) | |
674 | ||
3bf8d230 | 675 | #define SNAME(VAL) SDATA (SYMBOL_NAME (VAL)) |
e14dc92d JR |
676 | |
677 | /* Check if font supports the otf script/language/features specified. | |
678 | OTF_SPEC is in the format | |
679 | (script lang [(gsub_feature ...)|nil] [(gpos_feature ...)]?) */ | |
b56ceb92 JB |
680 | int |
681 | uniscribe_check_otf (LOGFONT *font, Lisp_Object otf_spec) | |
e14dc92d JR |
682 | { |
683 | Lisp_Object script, lang, rest; | |
684 | Lisp_Object features[2]; | |
685 | DWORD feature_tables[2]; | |
686 | DWORD script_tag, default_script, lang_tag = 0; | |
687 | struct frame * f; | |
688 | HDC context; | |
689 | HFONT check_font, old_font; | |
e14dc92d | 690 | int i, retval = 0; |
e38ac6e2 | 691 | struct gcpro gcpro1; |
e14dc92d | 692 | |
6b8aa22a | 693 | /* Check the spec is in the right format. */ |
df7e1ea0 | 694 | if (!CONSP (otf_spec) || XINT (Flength (otf_spec)) < 3) |
6b8aa22a JR |
695 | return 0; |
696 | ||
e14dc92d JR |
697 | /* Break otf_spec into its components. */ |
698 | script = XCAR (otf_spec); | |
699 | rest = XCDR (otf_spec); | |
700 | ||
701 | lang = XCAR (rest); | |
702 | rest = XCDR (rest); | |
703 | ||
704 | features[0] = XCAR (rest); | |
705 | rest = XCDR (rest); | |
706 | if (NILP (rest)) | |
707 | features[1] = Qnil; | |
708 | else | |
709 | features[1] = XCAR (rest); | |
710 | ||
711 | /* Set up tags we will use in the search. */ | |
712 | feature_tables[0] = OTF_TAG ("GSUB"); | |
713 | feature_tables[1] = OTF_TAG ("GPOS"); | |
714 | default_script = OTF_TAG ("DFLT"); | |
715 | if (NILP (script)) | |
716 | script_tag = default_script; | |
717 | else | |
718 | script_tag = OTF_TAG (SNAME (script)); | |
719 | if (!NILP (lang)) | |
720 | lang_tag = OTF_TAG (SNAME (lang)); | |
721 | ||
722 | /* Set up graphics context so we can use the font. */ | |
723 | f = XFRAME (selected_frame); | |
724 | context = get_frame_dc (f); | |
725 | check_font = CreateFontIndirect (font); | |
726 | old_font = SelectObject (context, check_font); | |
727 | ||
e38ac6e2 JR |
728 | /* Everything else is contained within otf_spec so should get |
729 | marked along with it. */ | |
730 | GCPRO1 (otf_spec); | |
731 | ||
e14dc92d JR |
732 | /* Scan GSUB and GPOS tables. */ |
733 | for (i = 0; i < 2; i++) | |
734 | { | |
735 | int j, n_match_features; | |
736 | unsigned short scriptlist_table, feature_table, n_scripts; | |
737 | unsigned short script_table, langsys_table, n_langs; | |
738 | unsigned short feature_index, n_features; | |
739 | DWORD tbl = feature_tables[i]; | |
e14dc92d JR |
740 | |
741 | /* Skip if no features requested from this table. */ | |
742 | if (NILP (features[i])) | |
743 | continue; | |
744 | ||
6b8aa22a JR |
745 | /* If features is not a cons, this font spec is messed up. */ |
746 | if (!CONSP (features[i])) | |
747 | goto no_support; | |
748 | ||
e14dc92d JR |
749 | /* Read GPOS/GSUB header. */ |
750 | OTF_INT16_VAL (tbl, 4, &scriptlist_table); | |
751 | OTF_INT16_VAL (tbl, 6, &feature_table); | |
752 | OTF_INT16_VAL (tbl, scriptlist_table, &n_scripts); | |
753 | ||
754 | /* Find the appropriate script table. */ | |
755 | script_table = 0; | |
756 | for (j = 0; j < n_scripts; j++) | |
757 | { | |
758 | DWORD script_id; | |
759 | OTF_DWORDTAG_VAL (tbl, scriptlist_table + 2 + j * 6, &script_id); | |
760 | if (script_id == script_tag) | |
761 | { | |
762 | OTF_INT16_VAL (tbl, scriptlist_table + 6 + j * 6, &script_table); | |
763 | break; | |
764 | } | |
595f1870 | 765 | #if 0 /* Causes false positives. */ |
e14dc92d JR |
766 | /* If there is a DFLT script defined in the font, use it |
767 | if the specified script is not found. */ | |
768 | else if (script_id == default_script) | |
769 | OTF_INT16_VAL (tbl, scriptlist_table + 6 + j * 6, &script_table); | |
595f1870 | 770 | #endif |
e14dc92d JR |
771 | } |
772 | /* If no specific or default script table was found, then this font | |
773 | does not support the script. */ | |
774 | if (!script_table) | |
775 | goto no_support; | |
776 | ||
777 | /* Offset is from beginning of scriptlist_table. */ | |
778 | script_table += scriptlist_table; | |
779 | ||
780 | /* Get default langsys table. */ | |
781 | OTF_INT16_VAL (tbl, script_table, &langsys_table); | |
782 | ||
783 | /* If lang was specified, see if font contains a specific entry. */ | |
784 | if (!NILP (lang)) | |
785 | { | |
786 | OTF_INT16_VAL (tbl, script_table + 2, &n_langs); | |
787 | ||
788 | for (j = 0; j < n_langs; j++) | |
789 | { | |
790 | DWORD lang_id; | |
791 | OTF_DWORDTAG_VAL (tbl, script_table + 4 + j * 6, &lang_id); | |
792 | if (lang_id == lang_tag) | |
793 | { | |
794 | OTF_INT16_VAL (tbl, script_table + 8 + j * 6, &langsys_table); | |
795 | break; | |
796 | } | |
797 | } | |
798 | } | |
799 | ||
800 | if (!langsys_table) | |
801 | goto no_support; | |
802 | ||
803 | /* Offset is from beginning of script table. */ | |
804 | langsys_table += script_table; | |
805 | ||
806 | /* Check the features. Features may contain nil according to | |
807 | documentation in font_prop_validate_otf, so count them. */ | |
808 | n_match_features = 0; | |
d0bfec76 | 809 | for (rest = features[i]; CONSP (rest); rest = XCDR (rest)) |
e14dc92d | 810 | { |
d0bfec76 | 811 | Lisp_Object feature = XCAR (rest); |
e14dc92d JR |
812 | if (!NILP (feature)) |
813 | n_match_features++; | |
814 | } | |
815 | ||
816 | /* If there are no features to check, skip checking. */ | |
817 | if (!n_match_features) | |
818 | continue; | |
819 | ||
820 | /* First check required feature (if any). */ | |
821 | OTF_INT16_VAL (tbl, langsys_table + 2, &feature_index); | |
822 | if (feature_index != 0xFFFF) | |
823 | { | |
824 | char feature_id[5]; | |
825 | OTF_TAG_VAL (tbl, feature_table + 2 + feature_index * 6, feature_id); | |
826 | OTF_TAG_VAL (tbl, feature_table + 2 + feature_index * 6, feature_id); | |
827 | /* Assume no duplicates in the font table. This allows us to mark | |
828 | the features off by simply decrementing a counter. */ | |
829 | if (!NILP (Fmemq (intern (feature_id), features[i]))) | |
830 | n_match_features--; | |
831 | } | |
832 | /* Now check all the other features. */ | |
833 | OTF_INT16_VAL (tbl, langsys_table + 4, &n_features); | |
834 | for (j = 0; j < n_features; j++) | |
835 | { | |
836 | char feature_id[5]; | |
837 | OTF_INT16_VAL (tbl, langsys_table + 6 + j * 2, &feature_index); | |
838 | OTF_TAG_VAL (tbl, feature_table + 2 + feature_index * 6, feature_id); | |
839 | /* Assume no duplicates in the font table. This allows us to mark | |
840 | the features off by simply decrementing a counter. */ | |
841 | if (!NILP (Fmemq (intern (feature_id), features[i]))) | |
842 | n_match_features--; | |
843 | } | |
844 | ||
845 | if (n_match_features > 0) | |
846 | goto no_support; | |
847 | } | |
848 | ||
849 | retval = 1; | |
850 | ||
851 | no_support: | |
852 | font_table_error: | |
853 | /* restore graphics context. */ | |
854 | SelectObject (context, old_font); | |
855 | DeleteObject (check_font); | |
856 | release_frame_dc (f, context); | |
857 | ||
858 | return retval; | |
859 | } | |
860 | ||
861 | static Lisp_Object | |
862 | otf_features (HDC context, char *table) | |
863 | { | |
864 | Lisp_Object script_list = Qnil; | |
865 | unsigned short scriptlist_table, n_scripts, feature_table; | |
866 | DWORD tbl = OTF_TAG (table); | |
867 | int i, j, k; | |
868 | ||
869 | /* Look for scripts in the table. */ | |
870 | OTF_INT16_VAL (tbl, 4, &scriptlist_table); | |
871 | OTF_INT16_VAL (tbl, 6, &feature_table); | |
872 | OTF_INT16_VAL (tbl, scriptlist_table, &n_scripts); | |
873 | ||
874 | for (i = 0; i < n_scripts; i++) | |
875 | { | |
876 | char script[5], lang[5]; | |
877 | unsigned short script_table, lang_count, langsys_table, feature_count; | |
878 | Lisp_Object script_tag, langsys_list, langsys_tag, feature_list; | |
879 | unsigned short record_offset = scriptlist_table + 2 + i * 6; | |
880 | OTF_TAG_VAL (tbl, record_offset, script); | |
881 | OTF_INT16_VAL (tbl, record_offset + 4, &script_table); | |
882 | ||
883 | /* Offset is from beginning of script table. */ | |
884 | script_table += scriptlist_table; | |
885 | ||
886 | script_tag = intern (script); | |
887 | langsys_list = Qnil; | |
888 | ||
889 | /* Optional default lang. */ | |
890 | OTF_INT16_VAL (tbl, script_table, &langsys_table); | |
891 | if (langsys_table) | |
892 | { | |
893 | /* Offset is from beginning of script table. */ | |
894 | langsys_table += script_table; | |
895 | ||
896 | langsys_tag = Qnil; | |
897 | feature_list = Qnil; | |
898 | OTF_INT16_VAL (tbl, langsys_table + 4, &feature_count); | |
899 | for (k = 0; k < feature_count; k++) | |
900 | { | |
901 | char feature[5]; | |
902 | unsigned short index; | |
903 | OTF_INT16_VAL (tbl, langsys_table + 6 + k * 2, &index); | |
904 | OTF_TAG_VAL (tbl, feature_table + 2 + index * 6, feature); | |
905 | feature_list = Fcons (intern (feature), feature_list); | |
906 | } | |
907 | langsys_list = Fcons (Fcons (langsys_tag, feature_list), | |
908 | langsys_list); | |
909 | } | |
910 | ||
911 | /* List of supported languages. */ | |
912 | OTF_INT16_VAL (tbl, script_table + 2, &lang_count); | |
913 | ||
914 | for (j = 0; j < lang_count; j++) | |
915 | { | |
916 | record_offset = script_table + 4 + j * 6; | |
917 | OTF_TAG_VAL (tbl, record_offset, lang); | |
918 | OTF_INT16_VAL (tbl, record_offset + 4, &langsys_table); | |
919 | ||
920 | /* Offset is from beginning of script table. */ | |
921 | langsys_table += script_table; | |
922 | ||
923 | langsys_tag = intern (lang); | |
924 | feature_list = Qnil; | |
925 | OTF_INT16_VAL (tbl, langsys_table + 4, &feature_count); | |
926 | for (k = 0; k < feature_count; k++) | |
927 | { | |
928 | char feature[5]; | |
929 | unsigned short index; | |
930 | OTF_INT16_VAL (tbl, langsys_table + 6 + k * 2, &index); | |
931 | OTF_TAG_VAL (tbl, feature_table + 2 + index * 6, feature); | |
932 | feature_list = Fcons (intern (feature), feature_list); | |
933 | } | |
934 | langsys_list = Fcons (Fcons (langsys_tag, feature_list), | |
935 | langsys_list); | |
936 | ||
937 | } | |
938 | ||
939 | script_list = Fcons (Fcons (script_tag, langsys_list), script_list); | |
940 | } | |
941 | ||
942 | return script_list; | |
943 | ||
944 | font_table_error: | |
945 | return Qnil; | |
946 | } | |
947 | ||
948 | #undef OTF_INT16_VAL | |
949 | #undef OTF_TAG_VAL | |
950 | #undef OTF_TAG | |
951 | ||
952 | \f | |
953 | struct font_driver uniscribe_font_driver = | |
954 | { | |
955 | 0, /* Quniscribe */ | |
fd302b02 | 956 | 0, /* case insensitive */ |
e14dc92d JR |
957 | w32font_get_cache, |
958 | uniscribe_list, | |
959 | uniscribe_match, | |
960 | uniscribe_list_family, | |
961 | NULL, /* free_entity */ | |
962 | uniscribe_open, | |
963 | uniscribe_close, | |
964 | NULL, /* prepare_face */ | |
965 | NULL, /* done_face */ | |
966 | w32font_has_char, | |
967 | uniscribe_encode_char, | |
968 | w32font_text_extents, | |
969 | w32font_draw, | |
970 | NULL, /* get_bitmap */ | |
971 | NULL, /* free_bitmap */ | |
972 | NULL, /* get_outline */ | |
973 | NULL, /* free_outline */ | |
974 | NULL, /* anchor_point */ | |
b56ceb92 | 975 | uniscribe_otf_capability, /* Defined so (font-get FONTOBJ :otf) works. */ |
e14dc92d JR |
976 | NULL, /* otf_drive - use shape instead. */ |
977 | NULL, /* start_for_frame */ | |
978 | NULL, /* end_for_frame */ | |
9c88f339 JB |
979 | uniscribe_shape, |
980 | NULL, /* check */ | |
981 | NULL, /* get_variation_glyphs */ | |
982 | NULL, /* filter_properties */ | |
983 | NULL, /* cached_font_ok */ | |
e14dc92d JR |
984 | }; |
985 | ||
986 | /* Note that this should be called at every startup, not just when dumping, | |
987 | as it needs to test for the existence of the Uniscribe library. */ | |
988 | void | |
b56ceb92 | 989 | syms_of_w32uniscribe (void) |
e14dc92d JR |
990 | { |
991 | HMODULE uniscribe; | |
992 | ||
993 | /* Don't init uniscribe when dumping */ | |
994 | if (!initialized) | |
995 | return; | |
996 | ||
997 | /* Don't register if uniscribe is not available. */ | |
998 | uniscribe = GetModuleHandle ("usp10"); | |
999 | if (!uniscribe) | |
1000 | return; | |
1001 | ||
1002 | uniscribe_font_driver.type = Quniscribe; | |
1003 | uniscribe_available = 1; | |
1004 | ||
1005 | register_font_driver (&uniscribe_font_driver, NULL); | |
1006 | } |