Mercurial > emacs
annotate src/w32uniscribe.c @ 95328:44c693827736
(casify_object): Try to guess better whether the argument is a byte or a char.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Tue, 27 May 2008 00:50:01 +0000 |
parents | 8971ddf55736 |
children | 9fcb5d4baf9b |
rev | line source |
---|---|
93590
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
1 /* Font backend for the Microsoft W32 Uniscribe API. |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
2 Copyright (C) 2008 Free Software Foundation, Inc. |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
3 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
4 This file is part of GNU Emacs. |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
5 |
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94911
diff
changeset
|
6 GNU Emacs is free software: you can redistribute it and/or modify |
93590
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
7 it under the terms of the GNU General Public License as published by |
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94911
diff
changeset
|
8 the Free Software Foundation, either version 3 of the License, or |
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94911
diff
changeset
|
9 (at your option) any later version. |
93590
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
10 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
11 GNU Emacs is distributed in the hope that it will be useful, |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
12 but WITHOUT ANY WARRANTY; without even the implied warranty of |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
14 GNU General Public License for more details. |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
15 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
16 You should have received a copy of the GNU General Public License |
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94911
diff
changeset
|
17 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
93590
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
18 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
19 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
20 #include <config.h> |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
21 /* Override API version - Uniscribe is only available as standard since |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
22 Windows 2000, though most users of older systems will have it |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
23 since it installs with Internet Explorer 5.0 and other software. |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
24 We only enable the feature if it is available, so there is no chance |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
25 of calling non-existant functions. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
26 #undef _WIN32_WINNT |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
27 #define _WIN32_WINNT 0x500 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
28 #include <windows.h> |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
29 #include <usp10.h> |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
30 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
31 #include "lisp.h" |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
32 #include "w32term.h" |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
33 #include "frame.h" |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
34 #include "dispextern.h" |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
35 #include "character.h" |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
36 #include "charset.h" |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
37 #include "fontset.h" |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
38 #include "font.h" |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
39 #include "w32font.h" |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
40 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
41 struct uniscribe_font_info |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
42 { |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
43 struct w32font_info w32_font; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
44 SCRIPT_CACHE cache; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
45 }; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
46 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
47 int uniscribe_available = 0; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
48 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
49 /* Defined in w32font.c, since it is required there as well. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
50 extern Lisp_Object Quniscribe; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
51 extern Lisp_Object Qopentype; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
52 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
53 extern int initialized; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
54 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
55 extern struct font_driver uniscribe_font_driver; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
56 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
57 /* EnumFontFamiliesEx callback. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
58 static int CALLBACK add_opentype_font_name_to_list P_ ((ENUMLOGFONTEX *, |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
59 NEWTEXTMETRICEX *, |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
60 DWORD, LPARAM)); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
61 /* Used by uniscribe_otf_capability. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
62 static Lisp_Object otf_features (HDC context, char *table); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
63 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
64 static int |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
65 memq_no_quit (elt, list) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
66 Lisp_Object elt, list; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
67 { |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
68 while (CONSP (list) && ! EQ (XCAR (list), elt)) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
69 list = XCDR (list); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
70 return (CONSP (list)); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
71 } |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
72 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
73 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
74 /* Font backend interface implementation. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
75 static Lisp_Object |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
76 uniscribe_list (frame, font_spec) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
77 Lisp_Object frame, font_spec; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
78 { |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
79 return w32font_list_internal (frame, font_spec, 1); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
80 } |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
81 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
82 static Lisp_Object |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
83 uniscribe_match (frame, font_spec) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
84 Lisp_Object frame, font_spec; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
85 { |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
86 return w32font_match_internal (frame, font_spec, 1); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
87 } |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
88 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
89 static Lisp_Object |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
90 uniscribe_list_family (frame) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
91 Lisp_Object frame; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
92 { |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
93 Lisp_Object list = Qnil; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
94 LOGFONT font_match_pattern; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
95 HDC dc; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
96 FRAME_PTR f = XFRAME (frame); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
97 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
98 bzero (&font_match_pattern, sizeof (font_match_pattern)); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
99 /* Limit enumerated fonts to outline fonts to save time. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
100 font_match_pattern.lfOutPrecision = OUT_OUTLINE_PRECIS; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
101 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
102 dc = get_frame_dc (f); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
103 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
104 EnumFontFamiliesEx (dc, &font_match_pattern, |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
105 (FONTENUMPROC) add_opentype_font_name_to_list, |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
106 (LPARAM) &list, 0); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
107 release_frame_dc (f, dc); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
108 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
109 return list; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
110 } |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
111 |
94911
f29483946da4
Delete USE_FONT_BACKEND conditional.
Kenichi Handa <handa@m17n.org>
parents:
93863
diff
changeset
|
112 static Lisp_Object |
93590
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
113 uniscribe_open (f, font_entity, pixel_size) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
114 FRAME_PTR f; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
115 Lisp_Object font_entity; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
116 int pixel_size; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
117 { |
94911
f29483946da4
Delete USE_FONT_BACKEND conditional.
Kenichi Handa <handa@m17n.org>
parents:
93863
diff
changeset
|
118 Lisp_Object font_object |
f29483946da4
Delete USE_FONT_BACKEND conditional.
Kenichi Handa <handa@m17n.org>
parents:
93863
diff
changeset
|
119 = font_make_object (VECSIZE (struct uniscribe_font_info)); |
93590
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
120 struct uniscribe_font_info *uniscribe_font |
94911
f29483946da4
Delete USE_FONT_BACKEND conditional.
Kenichi Handa <handa@m17n.org>
parents:
93863
diff
changeset
|
121 = (struct uniscribe_font_info *) XFONT_OBJECT (font_object); |
93590
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
122 |
94911
f29483946da4
Delete USE_FONT_BACKEND conditional.
Kenichi Handa <handa@m17n.org>
parents:
93863
diff
changeset
|
123 if (!w32font_open_internal (f, font_entity, pixel_size, font_object)) |
93590
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
124 { |
94911
f29483946da4
Delete USE_FONT_BACKEND conditional.
Kenichi Handa <handa@m17n.org>
parents:
93863
diff
changeset
|
125 return Qnil; |
93590
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
126 } |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
127 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
128 /* Initialize the cache for this font. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
129 uniscribe_font->cache = NULL; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
130 /* Mark the format as opentype */ |
94911
f29483946da4
Delete USE_FONT_BACKEND conditional.
Kenichi Handa <handa@m17n.org>
parents:
93863
diff
changeset
|
131 uniscribe_font->w32_font.font.props[FONT_FORMAT_INDEX] = Qopentype; |
93590
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
132 uniscribe_font->w32_font.font.driver = &uniscribe_font_driver; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
133 |
94911
f29483946da4
Delete USE_FONT_BACKEND conditional.
Kenichi Handa <handa@m17n.org>
parents:
93863
diff
changeset
|
134 return font_object; |
93590
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
135 } |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
136 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
137 static void |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
138 uniscribe_close (f, font) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
139 FRAME_PTR f; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
140 struct font *font; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
141 { |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
142 struct uniscribe_font_info *uniscribe_font |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
143 = (struct uniscribe_font_info *) font; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
144 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
145 if (uniscribe_font->cache) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
146 ScriptFreeCache (&uniscribe_font->cache); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
147 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
148 w32font_close (f, font); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
149 } |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
150 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
151 /* Return a list describing which scripts/languages FONT supports by |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
152 which GSUB/GPOS features of OpenType tables. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
153 static Lisp_Object |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
154 uniscribe_otf_capability (font) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
155 struct font *font; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
156 { |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
157 HDC context; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
158 HFONT old_font; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
159 struct frame *f; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
160 Lisp_Object capability = Fcons (Qnil, Qnil); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
161 Lisp_Object features; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
162 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
163 f = XFRAME (selected_frame); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
164 context = get_frame_dc (f); |
94911
f29483946da4
Delete USE_FONT_BACKEND conditional.
Kenichi Handa <handa@m17n.org>
parents:
93863
diff
changeset
|
165 old_font = SelectObject (context, FONT_COMPAT (font)->hfont); |
93590
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
166 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
167 features = otf_features (context, "GSUB"); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
168 XSETCAR (capability, features); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
169 features = otf_features (context, "GPOS"); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
170 XSETCDR (capability, features); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
171 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
172 SelectObject (context, old_font); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
173 release_frame_dc (f, context); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
174 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
175 return capability; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
176 } |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
177 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
178 /* Uniscribe implementation of shape for font backend. |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
179 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
180 Shape text in LGSTRING. See the docstring of `font-make-gstring' |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
181 for the format of LGSTRING. If the (N+1)th element of LGSTRING |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
182 is nil, input of shaping is from the 1st to (N)th elements. In |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
183 each input glyph, FROM, TO, CHAR, and CODE are already set. |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
184 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
185 This function updates all fields of the input glyphs. If the |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
186 output glyphs (M) are more than the input glyphs (N), (N+1)th |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
187 through (M)th elements of LGSTRING are updated possibly by making |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
188 a new glyph object and storing it in LGSTRING. If (M) is greater |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
189 than the length of LGSTRING, nil should be return. In that case, |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
190 this function is called again with the larger LGSTRING. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
191 static Lisp_Object |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
192 uniscribe_shape (lgstring) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
193 Lisp_Object lgstring; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
194 { |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
195 struct font * font; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
196 struct uniscribe_font_info * uniscribe_font; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
197 EMACS_UINT nchars; |
93762
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
198 int nitems, max_items, i, max_glyphs, done_glyphs; |
93590
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
199 wchar_t *chars; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
200 WORD *glyphs, *clusters; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
201 SCRIPT_ITEM *items; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
202 SCRIPT_CONTROL control; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
203 SCRIPT_VISATTR *attributes; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
204 int *advances; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
205 GOFFSET *offsets; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
206 ABC overall_metrics; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
207 MAT2 transform; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
208 HDC context; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
209 HFONT old_font; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
210 HRESULT result; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
211 struct frame * f; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
212 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
213 CHECK_FONT_GET_OBJECT (LGSTRING_FONT (lgstring), font); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
214 uniscribe_font = (struct uniscribe_font_info *) font; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
215 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
216 /* Get the chars from lgstring in a form we can use with uniscribe. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
217 max_glyphs = nchars = LGSTRING_LENGTH (lgstring); |
93762
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
218 done_glyphs = 0; |
93590
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
219 chars = (wchar_t *) alloca (nchars * sizeof (wchar_t)); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
220 for (i = 0; i < nchars; i++) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
221 { |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
222 /* lgstring can be bigger than the number of characters in it, in |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
223 the case where more glyphs are required to display those characters. |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
224 If that is the case, note the real number of characters. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
225 if (NILP (LGSTRING_GLYPH (lgstring, i))) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
226 nchars = i; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
227 else |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
228 chars[i] = LGLYPH_CHAR (LGSTRING_GLYPH (lgstring, i)); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
229 } |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
230 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
231 /* First we need to break up the glyph string into runs of glyphs that |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
232 can be treated together. First try a single run. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
233 max_items = 2; |
93762
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
234 items = (SCRIPT_ITEM *) xmalloc (sizeof (SCRIPT_ITEM) * max_items + 1); |
93590
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
235 bzero (&control, sizeof (control)); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
236 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
237 while ((result = ScriptItemize (chars, nchars, max_items, &control, NULL, |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
238 items, &nitems)) == E_OUTOFMEMORY) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
239 { |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
240 /* If that wasn't enough, keep trying with one more run. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
241 max_items++; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
242 items = (SCRIPT_ITEM *) xrealloc (items, |
93762
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
243 sizeof (SCRIPT_ITEM) * max_items + 1); |
93590
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
244 } |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
245 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
246 /* 0 = success in Microsoft's backwards world. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
247 if (result) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
248 { |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
249 xfree (items); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
250 return Qnil; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
251 } |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
252 |
93762
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
253 /* TODO: When we get BIDI support, we need to call ScriptLayout here. |
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
254 Requires that we know the surrounding context. */ |
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
255 |
93590
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
256 f = XFRAME (selected_frame); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
257 context = get_frame_dc (f); |
94911
f29483946da4
Delete USE_FONT_BACKEND conditional.
Kenichi Handa <handa@m17n.org>
parents:
93863
diff
changeset
|
258 old_font = SelectObject (context, FONT_COMPAT (font)->hfont); |
93590
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
259 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
260 glyphs = alloca (max_glyphs * sizeof (WORD)); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
261 clusters = alloca (nchars * sizeof (WORD)); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
262 attributes = alloca (max_glyphs * sizeof (SCRIPT_VISATTR)); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
263 advances = alloca (max_glyphs * sizeof (int)); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
264 offsets = alloca (max_glyphs * sizeof (GOFFSET)); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
265 bzero (&transform, sizeof (transform)); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
266 transform.eM11.value = 1; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
267 transform.eM22.value = 1; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
268 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
269 for (i = 0; i < nitems; i++) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
270 { |
93762
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
271 int nglyphs, nchars_in_run, rtl = items[i].a.fRTL ? -1 : 1; |
93590
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
272 nchars_in_run = items[i+1].iCharPos - items[i].iCharPos; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
273 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
274 result = ScriptShape (context, &(uniscribe_font->cache), |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
275 chars + items[i].iCharPos, nchars_in_run, |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
276 max_glyphs - done_glyphs, &(items[i].a), |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
277 glyphs, clusters, attributes, &nglyphs); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
278 if (result == E_OUTOFMEMORY) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
279 { |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
280 /* Need a bigger lgstring. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
281 lgstring = Qnil; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
282 break; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
283 } |
93762
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
284 else if (result) /* Failure. */ |
93590
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
285 { |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
286 /* Can't shape this run - return results so far if any. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
287 break; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
288 } |
93762
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
289 else if (items[i].a.fNoGlyphIndex) |
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
290 { |
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
291 /* Glyph indices not supported by this font (or OS), means we |
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
292 can't really do any meaningful shaping. */ |
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
293 break; |
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
294 } |
93590
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
295 else |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
296 { |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
297 result = ScriptPlace (context, &(uniscribe_font->cache), |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
298 glyphs, nglyphs, attributes, &(items[i].a), |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
299 advances, offsets, &overall_metrics); |
93762
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
300 if (result == 0) /* Success. */ |
93590
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
301 { |
93766
2382df5e230a
(uniscribe_shape): Map char at FROM to current glyph.
Jason Rumney <jasonr@gnu.org>
parents:
93762
diff
changeset
|
302 int j, nclusters, from, to; |
2382df5e230a
(uniscribe_shape): Map char at FROM to current glyph.
Jason Rumney <jasonr@gnu.org>
parents:
93762
diff
changeset
|
303 |
2382df5e230a
(uniscribe_shape): Map char at FROM to current glyph.
Jason Rumney <jasonr@gnu.org>
parents:
93762
diff
changeset
|
304 from = rtl > 0 ? 0 : nchars_in_run - 1; |
2382df5e230a
(uniscribe_shape): Map char at FROM to current glyph.
Jason Rumney <jasonr@gnu.org>
parents:
93762
diff
changeset
|
305 to = from; |
93590
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
306 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
307 for (j = 0; j < nglyphs; j++) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
308 { |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
309 int lglyph_index = j + done_glyphs; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
310 Lisp_Object lglyph = LGSTRING_GLYPH (lgstring, lglyph_index); |
93762
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
311 ABC char_metric; |
93590
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
312 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
313 if (NILP (lglyph)) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
314 { |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
315 lglyph = Fmake_vector (make_number (LGLYPH_SIZE), Qnil); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
316 LGSTRING_SET_GLYPH (lgstring, lglyph_index, lglyph); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
317 } |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
318 LGLYPH_SET_CODE (lglyph, glyphs[j]); |
93762
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
319 |
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
320 /* Detect clusters, for linking codes back to characters. */ |
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
321 if (attributes[j].fClusterStart) |
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
322 { |
93766
2382df5e230a
(uniscribe_shape): Map char at FROM to current glyph.
Jason Rumney <jasonr@gnu.org>
parents:
93762
diff
changeset
|
323 while (from >= 0 && from < nchars_in_run |
2382df5e230a
(uniscribe_shape): Map char at FROM to current glyph.
Jason Rumney <jasonr@gnu.org>
parents:
93762
diff
changeset
|
324 && clusters[from] < j) |
2382df5e230a
(uniscribe_shape): Map char at FROM to current glyph.
Jason Rumney <jasonr@gnu.org>
parents:
93762
diff
changeset
|
325 from += rtl; |
2382df5e230a
(uniscribe_shape): Map char at FROM to current glyph.
Jason Rumney <jasonr@gnu.org>
parents:
93762
diff
changeset
|
326 if (from < 0) |
2382df5e230a
(uniscribe_shape): Map char at FROM to current glyph.
Jason Rumney <jasonr@gnu.org>
parents:
93762
diff
changeset
|
327 from = to = 0; |
2382df5e230a
(uniscribe_shape): Map char at FROM to current glyph.
Jason Rumney <jasonr@gnu.org>
parents:
93762
diff
changeset
|
328 else if (from >= nchars_in_run) |
2382df5e230a
(uniscribe_shape): Map char at FROM to current glyph.
Jason Rumney <jasonr@gnu.org>
parents:
93762
diff
changeset
|
329 from = to = nchars_in_run - 1; |
93762
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
330 else |
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
331 { |
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
332 int k; |
93766
2382df5e230a
(uniscribe_shape): Map char at FROM to current glyph.
Jason Rumney <jasonr@gnu.org>
parents:
93762
diff
changeset
|
333 to = rtl > 0 ? nchars_in_run - 1 : 0; |
2382df5e230a
(uniscribe_shape): Map char at FROM to current glyph.
Jason Rumney <jasonr@gnu.org>
parents:
93762
diff
changeset
|
334 for (k = from + rtl; k >= 0 && k < nchars_in_run; |
93762
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
335 k += rtl) |
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
336 { |
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
337 if (clusters[k] > j) |
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
338 { |
93766
2382df5e230a
(uniscribe_shape): Map char at FROM to current glyph.
Jason Rumney <jasonr@gnu.org>
parents:
93762
diff
changeset
|
339 to = k - 1; |
93762
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
340 break; |
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
341 } |
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
342 } |
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
343 } |
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
344 } |
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
345 |
93766
2382df5e230a
(uniscribe_shape): Map char at FROM to current glyph.
Jason Rumney <jasonr@gnu.org>
parents:
93762
diff
changeset
|
346 LGLYPH_SET_CHAR (lglyph, chars[items[i].iCharPos |
2382df5e230a
(uniscribe_shape): Map char at FROM to current glyph.
Jason Rumney <jasonr@gnu.org>
parents:
93762
diff
changeset
|
347 + from]); |
2382df5e230a
(uniscribe_shape): Map char at FROM to current glyph.
Jason Rumney <jasonr@gnu.org>
parents:
93762
diff
changeset
|
348 LGLYPH_SET_FROM (lglyph, items[i].iCharPos + from); |
2382df5e230a
(uniscribe_shape): Map char at FROM to current glyph.
Jason Rumney <jasonr@gnu.org>
parents:
93762
diff
changeset
|
349 LGLYPH_SET_TO (lglyph, items[i].iCharPos + to); |
93762
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
350 |
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
351 /* Metrics. */ |
93590
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
352 LGLYPH_SET_WIDTH (lglyph, advances[j]); |
93762
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
353 LGLYPH_SET_ASCENT (lglyph, font->ascent); |
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
354 LGLYPH_SET_DESCENT (lglyph, font->descent); |
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
355 |
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
356 result = ScriptGetGlyphABCWidth (context, |
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
357 &(uniscribe_font->cache), |
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
358 glyphs[j], &char_metric); |
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
359 |
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
360 if (result == 0) /* Success. */ |
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
361 { |
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
362 LGLYPH_SET_LBEARING (lglyph, char_metric.abcA); |
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
363 LGLYPH_SET_RBEARING (lglyph, (char_metric.abcA |
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
364 + char_metric.abcB)); |
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
365 } |
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
366 else |
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
367 { |
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
368 LGLYPH_SET_LBEARING (lglyph, 0); |
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
369 LGLYPH_SET_RBEARING (lglyph, advances[j]); |
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
370 } |
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
371 |
93590
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
372 if (offsets[j].du || offsets[j].dv) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
373 { |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
374 Lisp_Object vec; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
375 vec = Fmake_vector (make_number (3), Qnil); |
93762
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
376 ASET (vec, 0, make_number (offsets[j].du)); |
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
377 ASET (vec, 1, make_number (offsets[j].dv)); |
93590
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
378 /* Based on what ftfont.c does... */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
379 ASET (vec, 2, make_number (advances[j])); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
380 LGLYPH_SET_ADJUSTMENT (lglyph, vec); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
381 } |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
382 else |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
383 LGLYPH_SET_ADJUSTMENT (lglyph, Qnil); |
93762
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
384 } } |
93590
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
385 } |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
386 done_glyphs += nglyphs; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
387 } |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
388 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
389 xfree (items); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
390 SelectObject (context, old_font); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
391 release_frame_dc (f, context); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
392 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
393 if (NILP (lgstring)) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
394 return Qnil; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
395 else |
93762
46d39c0f7bf9
(uniscribe_shape): Increase items buffer size.
Jason Rumney <jasonr@gnu.org>
parents:
93729
diff
changeset
|
396 return make_number (done_glyphs); |
93590
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
397 } |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
398 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
399 /* Uniscribe implementation of encode_char for font backend. |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
400 Return a glyph code of FONT for characer C (Unicode code point). |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
401 If FONT doesn't have such a glyph, return FONT_INVALID_CODE. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
402 static unsigned |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
403 uniscribe_encode_char (font, c) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
404 struct font *font; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
405 int c; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
406 { |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
407 wchar_t chars[1]; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
408 WORD indices[1]; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
409 HDC context; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
410 struct frame *f; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
411 HFONT old_font; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
412 DWORD retval; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
413 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
414 /* TODO: surrogates. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
415 if (c > 0xFFFF) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
416 return FONT_INVALID_CODE; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
417 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
418 chars[0] = (wchar_t) c; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
419 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
420 /* Use selected frame until API is updated to pass the frame. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
421 f = XFRAME (selected_frame); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
422 context = get_frame_dc (f); |
94911
f29483946da4
Delete USE_FONT_BACKEND conditional.
Kenichi Handa <handa@m17n.org>
parents:
93863
diff
changeset
|
423 old_font = SelectObject (context, FONT_COMPAT (font)->hfont); |
93590
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
424 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
425 retval = GetGlyphIndicesW (context, chars, 1, indices, |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
426 GGI_MARK_NONEXISTING_GLYPHS); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
427 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
428 SelectObject (context, old_font); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
429 release_frame_dc (f, context); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
430 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
431 if (retval == 1) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
432 return indices[0] == 0xFFFF ? FONT_INVALID_CODE : indices[0]; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
433 else |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
434 return FONT_INVALID_CODE; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
435 } |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
436 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
437 /* |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
438 Shared with w32font: |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
439 Lisp_Object uniscribe_get_cache (Lisp_Object frame); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
440 void uniscribe_free_entity (Lisp_Object font_entity); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
441 int uniscribe_has_char (Lisp_Object entity, int c); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
442 int uniscribe_text_extents (struct font *font, unsigned *code, |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
443 int nglyphs, struct font_metrics *metrics); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
444 int uniscribe_draw (struct glyph_string *s, int from, int to, |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
445 int x, int y, int with_background); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
446 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
447 Unused: |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
448 int uniscribe_prepare_face (FRAME_PTR f, struct face *face); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
449 void uniscribe_done_face (FRAME_PTR f, struct face *face); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
450 int uniscribe_get_bitmap (struct font *font, unsigned code, |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
451 struct font_bitmap *bitmap, int bits_per_pixel); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
452 void uniscribe_free_bitmap (struct font *font, struct font_bitmap *bitmap); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
453 void * uniscribe_get_outline (struct font *font, unsigned code); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
454 void uniscribe_free_outline (struct font *font, void *outline); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
455 int uniscribe_anchor_point (struct font *font, unsigned code, |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
456 int index, int *x, int *y); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
457 int uniscribe_start_for_frame (FRAME_PTR f); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
458 int uniscribe_end_for_frame (FRAME_PTR f); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
459 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
460 */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
461 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
462 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
463 /* Callback function for EnumFontFamiliesEx. |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
464 Adds the name of opentype fonts to a Lisp list (passed in as the |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
465 lParam arg). */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
466 static int CALLBACK |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
467 add_opentype_font_name_to_list (logical_font, physical_font, font_type, |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
468 list_object) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
469 ENUMLOGFONTEX *logical_font; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
470 NEWTEXTMETRICEX *physical_font; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
471 DWORD font_type; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
472 LPARAM list_object; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
473 { |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
474 Lisp_Object* list = (Lisp_Object *) list_object; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
475 Lisp_Object family; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
476 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
477 /* Skip vertical fonts (intended only for printing) */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
478 if (logical_font->elfLogFont.lfFaceName[0] == '@') |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
479 return 1; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
480 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
481 /* Skip non opentype fonts. Count old truetype fonts as opentype, |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
482 as some of them do contain GPOS and GSUB data that Uniscribe |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
483 can make use of. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
484 if (!(physical_font->ntmTm.ntmFlags & NTMFLAGS_OPENTYPE) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
485 && font_type != TRUETYPE_FONTTYPE) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
486 return 1; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
487 |
94911
f29483946da4
Delete USE_FONT_BACKEND conditional.
Kenichi Handa <handa@m17n.org>
parents:
93863
diff
changeset
|
488 family = font_intern_prop (logical_font->elfLogFont.lfFaceName, |
f29483946da4
Delete USE_FONT_BACKEND conditional.
Kenichi Handa <handa@m17n.org>
parents:
93863
diff
changeset
|
489 strlen (logical_font->elfLogFont.lfFaceName)); |
93590
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
490 if (! memq_no_quit (family, *list)) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
491 *list = Fcons (family, *list); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
492 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
493 return 1; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
494 } |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
495 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
496 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
497 /* :otf property handling. |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
498 Since the necessary Uniscribe APIs for getting font tag information |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
499 are only available in Vista, we need to parse the font data directly |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
500 according to the OpenType Specification. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
501 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
502 /* Push into DWORD backwards to cope with endianness. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
503 #define OTF_TAG(STR) \ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
504 ((STR[3] << 24) | (STR[2] << 16) | (STR[1] << 8) | STR[0]) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
505 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
506 #define OTF_INT16_VAL(TABLE, OFFSET, PTR) \ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
507 do { \ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
508 BYTE temp, data[2]; \ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
509 if (GetFontData (context, TABLE, OFFSET, data, 2) != 2) \ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
510 goto font_table_error; \ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
511 temp = data[0], data[0] = data[1], data[1] = temp; \ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
512 memcpy (PTR, data, 2); \ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
513 } while (0) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
514 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
515 /* Do not reverse the bytes, because we will compare with a OTF_TAG value |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
516 that has them reversed already. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
517 #define OTF_DWORDTAG_VAL(TABLE, OFFSET, PTR) \ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
518 do { \ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
519 if (GetFontData (context, TABLE, OFFSET, PTR, 4) != 4) \ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
520 goto font_table_error; \ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
521 } while (0) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
522 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
523 #define OTF_TAG_VAL(TABLE, OFFSET, STR) \ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
524 do { \ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
525 if (GetFontData (context, TABLE, OFFSET, STR, 4) != 4) \ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
526 goto font_table_error; \ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
527 STR[4] = '\0'; \ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
528 } while (0) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
529 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
530 static char* NOTHING = " "; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
531 |
93863
f9841841f5a5
(SNAME): Extract only symbol name.
Jason Rumney <jasonr@gnu.org>
parents:
93766
diff
changeset
|
532 #define SNAME(VAL) SDATA (SYMBOL_NAME (VAL)) |
93590
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
533 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
534 /* Check if font supports the otf script/language/features specified. |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
535 OTF_SPEC is in the format |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
536 (script lang [(gsub_feature ...)|nil] [(gpos_feature ...)]?) */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
537 int uniscribe_check_otf (font, otf_spec) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
538 LOGFONT *font; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
539 Lisp_Object otf_spec; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
540 { |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
541 Lisp_Object script, lang, rest; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
542 Lisp_Object features[2]; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
543 DWORD feature_tables[2]; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
544 DWORD script_tag, default_script, lang_tag = 0; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
545 struct frame * f; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
546 HDC context; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
547 HFONT check_font, old_font; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
548 DWORD table; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
549 int i, retval = 0; |
93659
f606935ea4be
(uniscribe_check_otf): Add GC protection before consing.
Jason Rumney <jasonr@gnu.org>
parents:
93654
diff
changeset
|
550 struct gcpro gcpro1; |
93590
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
551 |
93604
5476a4f5d2f2
(uniscribe_check_otf): Sanity check otf_spec.
Jason Rumney <jasonr@gnu.org>
parents:
93590
diff
changeset
|
552 /* Check the spec is in the right format. */ |
93654
566bfd5b644d
(uniscribe_check_otf): Fix last change.
Jason Rumney <jasonr@gnu.org>
parents:
93604
diff
changeset
|
553 if (!CONSP (otf_spec) || Flength (otf_spec) < 3) |
93604
5476a4f5d2f2
(uniscribe_check_otf): Sanity check otf_spec.
Jason Rumney <jasonr@gnu.org>
parents:
93590
diff
changeset
|
554 return 0; |
5476a4f5d2f2
(uniscribe_check_otf): Sanity check otf_spec.
Jason Rumney <jasonr@gnu.org>
parents:
93590
diff
changeset
|
555 |
93590
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
556 /* Break otf_spec into its components. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
557 script = XCAR (otf_spec); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
558 rest = XCDR (otf_spec); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
559 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
560 lang = XCAR (rest); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
561 rest = XCDR (rest); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
562 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
563 features[0] = XCAR (rest); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
564 rest = XCDR (rest); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
565 if (NILP (rest)) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
566 features[1] = Qnil; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
567 else |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
568 features[1] = XCAR (rest); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
569 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
570 /* Set up tags we will use in the search. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
571 feature_tables[0] = OTF_TAG ("GSUB"); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
572 feature_tables[1] = OTF_TAG ("GPOS"); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
573 default_script = OTF_TAG ("DFLT"); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
574 if (NILP (script)) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
575 script_tag = default_script; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
576 else |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
577 script_tag = OTF_TAG (SNAME (script)); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
578 if (!NILP (lang)) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
579 lang_tag = OTF_TAG (SNAME (lang)); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
580 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
581 /* Set up graphics context so we can use the font. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
582 f = XFRAME (selected_frame); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
583 context = get_frame_dc (f); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
584 check_font = CreateFontIndirect (font); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
585 old_font = SelectObject (context, check_font); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
586 |
93659
f606935ea4be
(uniscribe_check_otf): Add GC protection before consing.
Jason Rumney <jasonr@gnu.org>
parents:
93654
diff
changeset
|
587 /* Everything else is contained within otf_spec so should get |
f606935ea4be
(uniscribe_check_otf): Add GC protection before consing.
Jason Rumney <jasonr@gnu.org>
parents:
93654
diff
changeset
|
588 marked along with it. */ |
f606935ea4be
(uniscribe_check_otf): Add GC protection before consing.
Jason Rumney <jasonr@gnu.org>
parents:
93654
diff
changeset
|
589 GCPRO1 (otf_spec); |
f606935ea4be
(uniscribe_check_otf): Add GC protection before consing.
Jason Rumney <jasonr@gnu.org>
parents:
93654
diff
changeset
|
590 |
93590
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
591 /* Scan GSUB and GPOS tables. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
592 for (i = 0; i < 2; i++) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
593 { |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
594 int j, n_match_features; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
595 unsigned short scriptlist_table, feature_table, n_scripts; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
596 unsigned short script_table, langsys_table, n_langs; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
597 unsigned short feature_index, n_features; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
598 DWORD tbl = feature_tables[i]; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
599 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
600 /* Skip if no features requested from this table. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
601 if (NILP (features[i])) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
602 continue; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
603 |
93604
5476a4f5d2f2
(uniscribe_check_otf): Sanity check otf_spec.
Jason Rumney <jasonr@gnu.org>
parents:
93590
diff
changeset
|
604 /* If features is not a cons, this font spec is messed up. */ |
5476a4f5d2f2
(uniscribe_check_otf): Sanity check otf_spec.
Jason Rumney <jasonr@gnu.org>
parents:
93590
diff
changeset
|
605 if (!CONSP (features[i])) |
5476a4f5d2f2
(uniscribe_check_otf): Sanity check otf_spec.
Jason Rumney <jasonr@gnu.org>
parents:
93590
diff
changeset
|
606 goto no_support; |
5476a4f5d2f2
(uniscribe_check_otf): Sanity check otf_spec.
Jason Rumney <jasonr@gnu.org>
parents:
93590
diff
changeset
|
607 |
93590
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
608 /* Read GPOS/GSUB header. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
609 OTF_INT16_VAL (tbl, 4, &scriptlist_table); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
610 OTF_INT16_VAL (tbl, 6, &feature_table); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
611 OTF_INT16_VAL (tbl, scriptlist_table, &n_scripts); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
612 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
613 /* Find the appropriate script table. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
614 script_table = 0; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
615 for (j = 0; j < n_scripts; j++) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
616 { |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
617 DWORD script_id; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
618 OTF_DWORDTAG_VAL (tbl, scriptlist_table + 2 + j * 6, &script_id); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
619 if (script_id == script_tag) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
620 { |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
621 OTF_INT16_VAL (tbl, scriptlist_table + 6 + j * 6, &script_table); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
622 break; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
623 } |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
624 /* If there is a DFLT script defined in the font, use it |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
625 if the specified script is not found. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
626 else if (script_id == default_script) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
627 OTF_INT16_VAL (tbl, scriptlist_table + 6 + j * 6, &script_table); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
628 } |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
629 /* If no specific or default script table was found, then this font |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
630 does not support the script. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
631 if (!script_table) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
632 goto no_support; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
633 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
634 /* Offset is from beginning of scriptlist_table. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
635 script_table += scriptlist_table; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
636 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
637 /* Get default langsys table. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
638 OTF_INT16_VAL (tbl, script_table, &langsys_table); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
639 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
640 /* If lang was specified, see if font contains a specific entry. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
641 if (!NILP (lang)) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
642 { |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
643 OTF_INT16_VAL (tbl, script_table + 2, &n_langs); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
644 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
645 for (j = 0; j < n_langs; j++) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
646 { |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
647 DWORD lang_id; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
648 OTF_DWORDTAG_VAL (tbl, script_table + 4 + j * 6, &lang_id); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
649 if (lang_id == lang_tag) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
650 { |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
651 OTF_INT16_VAL (tbl, script_table + 8 + j * 6, &langsys_table); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
652 break; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
653 } |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
654 } |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
655 } |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
656 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
657 if (!langsys_table) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
658 goto no_support; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
659 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
660 /* Offset is from beginning of script table. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
661 langsys_table += script_table; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
662 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
663 /* Check the features. Features may contain nil according to |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
664 documentation in font_prop_validate_otf, so count them. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
665 n_match_features = 0; |
93660
96c69ebb9cfa
(uniscribe_check_otf): Rearrange loop for counting features.
Jason Rumney <jasonr@gnu.org>
parents:
93659
diff
changeset
|
666 for (rest = features[i]; CONSP (rest); rest = XCDR (rest)) |
93590
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
667 { |
93660
96c69ebb9cfa
(uniscribe_check_otf): Rearrange loop for counting features.
Jason Rumney <jasonr@gnu.org>
parents:
93659
diff
changeset
|
668 Lisp_Object feature = XCAR (rest); |
93590
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
669 if (!NILP (feature)) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
670 n_match_features++; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
671 } |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
672 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
673 /* If there are no features to check, skip checking. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
674 if (!n_match_features) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
675 continue; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
676 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
677 /* First check required feature (if any). */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
678 OTF_INT16_VAL (tbl, langsys_table + 2, &feature_index); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
679 if (feature_index != 0xFFFF) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
680 { |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
681 char feature_id[5]; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
682 OTF_TAG_VAL (tbl, feature_table + 2 + feature_index * 6, feature_id); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
683 OTF_TAG_VAL (tbl, feature_table + 2 + feature_index * 6, feature_id); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
684 /* Assume no duplicates in the font table. This allows us to mark |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
685 the features off by simply decrementing a counter. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
686 if (!NILP (Fmemq (intern (feature_id), features[i]))) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
687 n_match_features--; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
688 } |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
689 /* Now check all the other features. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
690 OTF_INT16_VAL (tbl, langsys_table + 4, &n_features); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
691 for (j = 0; j < n_features; j++) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
692 { |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
693 char feature_id[5]; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
694 OTF_INT16_VAL (tbl, langsys_table + 6 + j * 2, &feature_index); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
695 OTF_TAG_VAL (tbl, feature_table + 2 + feature_index * 6, feature_id); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
696 /* Assume no duplicates in the font table. This allows us to mark |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
697 the features off by simply decrementing a counter. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
698 if (!NILP (Fmemq (intern (feature_id), features[i]))) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
699 n_match_features--; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
700 } |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
701 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
702 if (n_match_features > 0) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
703 goto no_support; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
704 } |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
705 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
706 retval = 1; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
707 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
708 no_support: |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
709 font_table_error: |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
710 /* restore graphics context. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
711 SelectObject (context, old_font); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
712 DeleteObject (check_font); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
713 release_frame_dc (f, context); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
714 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
715 return retval; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
716 } |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
717 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
718 static Lisp_Object |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
719 otf_features (HDC context, char *table) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
720 { |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
721 Lisp_Object script_list = Qnil; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
722 unsigned short scriptlist_table, n_scripts, feature_table; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
723 DWORD tbl = OTF_TAG (table); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
724 int i, j, k; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
725 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
726 /* Look for scripts in the table. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
727 OTF_INT16_VAL (tbl, 4, &scriptlist_table); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
728 OTF_INT16_VAL (tbl, 6, &feature_table); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
729 OTF_INT16_VAL (tbl, scriptlist_table, &n_scripts); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
730 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
731 for (i = 0; i < n_scripts; i++) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
732 { |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
733 char script[5], lang[5]; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
734 unsigned short script_table, lang_count, langsys_table, feature_count; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
735 Lisp_Object script_tag, langsys_list, langsys_tag, feature_list; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
736 unsigned short record_offset = scriptlist_table + 2 + i * 6; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
737 OTF_TAG_VAL (tbl, record_offset, script); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
738 OTF_INT16_VAL (tbl, record_offset + 4, &script_table); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
739 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
740 /* Offset is from beginning of script table. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
741 script_table += scriptlist_table; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
742 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
743 script_tag = intern (script); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
744 langsys_list = Qnil; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
745 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
746 /* Optional default lang. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
747 OTF_INT16_VAL (tbl, script_table, &langsys_table); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
748 if (langsys_table) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
749 { |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
750 /* Offset is from beginning of script table. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
751 langsys_table += script_table; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
752 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
753 langsys_tag = Qnil; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
754 feature_list = Qnil; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
755 OTF_INT16_VAL (tbl, langsys_table + 4, &feature_count); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
756 for (k = 0; k < feature_count; k++) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
757 { |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
758 char feature[5]; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
759 unsigned short index; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
760 OTF_INT16_VAL (tbl, langsys_table + 6 + k * 2, &index); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
761 OTF_TAG_VAL (tbl, feature_table + 2 + index * 6, feature); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
762 feature_list = Fcons (intern (feature), feature_list); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
763 } |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
764 langsys_list = Fcons (Fcons (langsys_tag, feature_list), |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
765 langsys_list); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
766 } |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
767 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
768 /* List of supported languages. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
769 OTF_INT16_VAL (tbl, script_table + 2, &lang_count); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
770 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
771 for (j = 0; j < lang_count; j++) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
772 { |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
773 record_offset = script_table + 4 + j * 6; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
774 OTF_TAG_VAL (tbl, record_offset, lang); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
775 OTF_INT16_VAL (tbl, record_offset + 4, &langsys_table); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
776 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
777 /* Offset is from beginning of script table. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
778 langsys_table += script_table; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
779 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
780 langsys_tag = intern (lang); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
781 feature_list = Qnil; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
782 OTF_INT16_VAL (tbl, langsys_table + 4, &feature_count); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
783 for (k = 0; k < feature_count; k++) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
784 { |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
785 char feature[5]; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
786 unsigned short index; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
787 OTF_INT16_VAL (tbl, langsys_table + 6 + k * 2, &index); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
788 OTF_TAG_VAL (tbl, feature_table + 2 + index * 6, feature); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
789 feature_list = Fcons (intern (feature), feature_list); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
790 } |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
791 langsys_list = Fcons (Fcons (langsys_tag, feature_list), |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
792 langsys_list); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
793 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
794 } |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
795 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
796 script_list = Fcons (Fcons (script_tag, langsys_list), script_list); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
797 } |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
798 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
799 return script_list; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
800 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
801 font_table_error: |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
802 return Qnil; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
803 } |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
804 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
805 #undef OTF_INT16_VAL |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
806 #undef OTF_TAG_VAL |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
807 #undef OTF_TAG |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
808 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
809 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
810 struct font_driver uniscribe_font_driver = |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
811 { |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
812 0, /* Quniscribe */ |
94911
f29483946da4
Delete USE_FONT_BACKEND conditional.
Kenichi Handa <handa@m17n.org>
parents:
93863
diff
changeset
|
813 0, /* case insensitive */ |
93590
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
814 w32font_get_cache, |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
815 uniscribe_list, |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
816 uniscribe_match, |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
817 uniscribe_list_family, |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
818 NULL, /* free_entity */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
819 uniscribe_open, |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
820 uniscribe_close, |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
821 NULL, /* prepare_face */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
822 NULL, /* done_face */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
823 w32font_has_char, |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
824 uniscribe_encode_char, |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
825 w32font_text_extents, |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
826 w32font_draw, |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
827 NULL, /* get_bitmap */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
828 NULL, /* free_bitmap */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
829 NULL, /* get_outline */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
830 NULL, /* free_outline */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
831 NULL, /* anchor_point */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
832 uniscribe_otf_capability, /* Defined so (font-get FONTOBJ :otf) works. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
833 NULL, /* otf_drive - use shape instead. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
834 NULL, /* start_for_frame */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
835 NULL, /* end_for_frame */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
836 uniscribe_shape |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
837 }; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
838 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
839 /* Note that this should be called at every startup, not just when dumping, |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
840 as it needs to test for the existence of the Uniscribe library. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
841 void |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
842 syms_of_w32uniscribe () |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
843 { |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
844 HMODULE uniscribe; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
845 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
846 /* Don't init uniscribe when dumping */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
847 if (!initialized) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
848 return; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
849 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
850 /* Don't register if uniscribe is not available. */ |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
851 uniscribe = GetModuleHandle ("usp10"); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
852 if (!uniscribe) |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
853 return; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
854 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
855 uniscribe_font_driver.type = Quniscribe; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
856 uniscribe_available = 1; |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
857 |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
858 register_font_driver (&uniscribe_font_driver, NULL); |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
859 } |
57eed2a0d99f
Font backend implementation for Uniscribe on Windows 2000 and later.
Jason Rumney <jasonr@gnu.org>
parents:
diff
changeset
|
860 |
93729 | 861 /* arch-tag: 9530f0e1-7471-47dd-a780-94330af87ea0 |
862 (do not change this comment) */ |