Mercurial > emacs
annotate src/ftfont.c @ 109390:f1045a53471c
Merge from mainline.
author | Katsumi Yamaoka <katsumi@flagship2> |
---|---|
date | Wed, 14 Jul 2010 13:03:03 +0000 |
parents | 89a16701cde1 |
children | c4c8e4a16194 |
rev | line source |
---|---|
90400 | 1 /* ftfont.c -- FreeType font driver. |
106815 | 2 Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
3 Copyright (C) 2006, 2007, 2008, 2009, 2010 | |
90400 | 4 National Institute of Advanced Industrial Science and Technology (AIST) |
5 Registration Number H13PRO009 | |
6 | |
7 This file is part of GNU Emacs. | |
8 | |
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94931
diff
changeset
|
9 GNU Emacs is free software: you can redistribute it and/or modify |
90400 | 10 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:
94931
diff
changeset
|
11 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:
94931
diff
changeset
|
12 (at your option) any later version. |
90400 | 13 |
14 GNU Emacs is distributed in the hope that it will be useful, | |
15 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 GNU General Public License for more details. | |
18 | |
19 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:
94931
diff
changeset
|
20 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
90400 | 21 |
22 #include <config.h> | |
23 #include <stdio.h> | |
105669
68dd71358159
* alloc.c: Do not define struct catchtag.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
103887
diff
changeset
|
24 #include <setjmp.h> |
90400 | 25 |
26 #include <fontconfig/fontconfig.h> | |
27 #include <fontconfig/fcfreetype.h> | |
28 | |
29 #include "lisp.h" | |
30 #include "dispextern.h" | |
31 #include "frame.h" | |
32 #include "blockinput.h" | |
33 #include "character.h" | |
34 #include "charset.h" | |
35 #include "coding.h" | |
97826 | 36 #include "composite.h" |
90400 | 37 #include "fontset.h" |
38 #include "font.h" | |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
39 #include "ftfont.h" |
90400 | 40 |
90441
d63258b13d84
(Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved to
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
41 /* Symbolic type of this font-driver. */ |
90400 | 42 Lisp_Object Qfreetype; |
43 | |
90464
4702b592db4c
(Qmonospace, Qsans_serif, Qserif, Qmono, Qsans)
Kenichi Handa <handa@m17n.org>
parents:
90450
diff
changeset
|
44 /* Fontconfig's generic families and their aliases. */ |
4702b592db4c
(Qmonospace, Qsans_serif, Qserif, Qmono, Qsans)
Kenichi Handa <handa@m17n.org>
parents:
90450
diff
changeset
|
45 static Lisp_Object Qmonospace, Qsans_serif, Qserif, Qmono, Qsans, Qsans__serif; |
4702b592db4c
(Qmonospace, Qsans_serif, Qserif, Qmono, Qsans)
Kenichi Handa <handa@m17n.org>
parents:
90450
diff
changeset
|
46 |
95464
de4cb7ab40db
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
95433
diff
changeset
|
47 /* Flag to tell if FcInit is already called or not. */ |
90400 | 48 static int fc_initialized; |
90441
d63258b13d84
(Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved to
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
49 |
d63258b13d84
(Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved to
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
50 /* Handle to a FreeType library instance. */ |
90400 | 51 static FT_Library ft_library; |
52 | |
90441
d63258b13d84
(Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved to
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
53 /* Cache for FreeType fonts. */ |
90400 | 54 static Lisp_Object freetype_font_cache; |
55 | |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
56 /* Cache for FT_Face and FcCharSet. */ |
95103 | 57 static Lisp_Object ft_face_cache; |
90400 | 58 |
59 /* The actual structure for FreeType font that can be casted to struct | |
60 font. */ | |
61 | |
62 struct ftfont_info | |
63 { | |
64 struct font font; | |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
65 #ifdef HAVE_LIBOTF |
101556
7f8b5730cfa5
(ftfont_has_char): If the arg FONT is a font-object,
Kenichi Handa <handa@m17n.org>
parents:
101284
diff
changeset
|
66 /* The following four members must be here in this order to be |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
67 compatible with struct xftfont_info (in xftfont.c). */ |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
68 int maybe_otf; /* Flag to tell if this may be OTF or not. */ |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
69 OTF *otf; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
70 #endif /* HAVE_LIBOTF */ |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
71 FT_Size ft_size; |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
72 int index; |
106539
e5416066efd1
(struct ftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106085
diff
changeset
|
73 FT_Matrix matrix; |
90400 | 74 }; |
75 | |
102991
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
76 enum ftfont_cache_for |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
77 { |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
78 FTFONT_CACHE_FOR_FACE, |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
79 FTFONT_CACHE_FOR_CHARSET, |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
80 FTFONT_CACHE_FOR_ENTITY |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
81 }; |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
82 |
109100
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
109081
diff
changeset
|
83 static Lisp_Object ftfont_pattern_entity (FcPattern *, Lisp_Object); |
95103 | 84 |
109100
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
109081
diff
changeset
|
85 static Lisp_Object ftfont_resolve_generic_family (Lisp_Object, |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
109081
diff
changeset
|
86 FcPattern *); |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
109081
diff
changeset
|
87 static Lisp_Object ftfont_lookup_cache (Lisp_Object, |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
109081
diff
changeset
|
88 enum ftfont_cache_for); |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
89 |
109100
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
109081
diff
changeset
|
90 static void ftfont_filter_properties (Lisp_Object font, Lisp_Object alist); |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
91 |
109100
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
109081
diff
changeset
|
92 Lisp_Object ftfont_font_format (FcPattern *, Lisp_Object); |
90464
4702b592db4c
(Qmonospace, Qsans_serif, Qserif, Qmono, Qsans)
Kenichi Handa <handa@m17n.org>
parents:
90450
diff
changeset
|
93 |
4702b592db4c
(Qmonospace, Qsans_serif, Qserif, Qmono, Qsans)
Kenichi Handa <handa@m17n.org>
parents:
90450
diff
changeset
|
94 #define SYMBOL_FcChar8(SYM) (FcChar8 *) SDATA (SYMBOL_NAME (SYM)) |
4702b592db4c
(Qmonospace, Qsans_serif, Qserif, Qmono, Qsans)
Kenichi Handa <handa@m17n.org>
parents:
90450
diff
changeset
|
95 |
95103 | 96 static struct |
90400 | 97 { |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
98 /* registry name */ |
95103 | 99 char *name; |
100 /* characters to distinguish the charset from the others */ | |
101 int uniquifier[6]; | |
96429
5ee216cdf0e3
(fc_charset_table): New member lang.
Kenichi Handa <handa@m17n.org>
parents:
96076
diff
changeset
|
102 /* additional constraint by language */ |
5ee216cdf0e3
(fc_charset_table): New member lang.
Kenichi Handa <handa@m17n.org>
parents:
96076
diff
changeset
|
103 char *lang; |
95103 | 104 /* set on demand */ |
105 FcCharSet *fc_charset; | |
106 } fc_charset_table[] = | |
102991
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
107 { { "iso8859-1", { 0x00A0, 0x00A1, 0x00B4, 0x00BC, 0x00D0 } }, |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
108 { "iso8859-2", { 0x00A0, 0x010E }}, |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
109 { "iso8859-3", { 0x00A0, 0x0108 }}, |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
110 { "iso8859-4", { 0x00A0, 0x00AF, 0x0128, 0x0156, 0x02C7 }}, |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
111 { "iso8859-5", { 0x00A0, 0x0401 }}, |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
112 { "iso8859-6", { 0x00A0, 0x060C }}, |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
113 { "iso8859-7", { 0x00A0, 0x0384 }}, |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
114 { "iso8859-8", { 0x00A0, 0x05D0 }}, |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
115 { "iso8859-9", { 0x00A0, 0x00A1, 0x00BC, 0x011E }}, |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
116 { "iso8859-10", { 0x00A0, 0x00D0, 0x0128, 0x2015 }}, |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
117 { "iso8859-11", { 0x00A0, 0x0E01 }}, |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
118 { "iso8859-13", { 0x00A0, 0x201C }}, |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
119 { "iso8859-14", { 0x00A0, 0x0174 }}, |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
120 { "iso8859-15", { 0x00A0, 0x00A1, 0x00D0, 0x0152 }}, |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
121 { "iso8859-16", { 0x00A0, 0x0218}}, |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
122 { "gb2312.1980-0", { 0x4E13 }, "zh-cn"}, |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
123 { "big5-0", { 0xF6B1 }, "zh-tw" }, |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
124 { "jisx0208.1983-0", { 0x4E55 }, "ja"}, |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
125 { "ksc5601.1985-0", { 0xAC00 }, "ko"}, |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
126 { "cns11643.1992-1", { 0xFE32 }, "zh-tw"}, |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
127 { "cns11643.1992-2", { 0x4E33, 0x7934 }}, |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
128 { "cns11643.1992-3", { 0x201A9 }}, |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
129 { "cns11643.1992-4", { 0x20057 }}, |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
130 { "cns11643.1992-5", { 0x20000 }}, |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
131 { "cns11643.1992-6", { 0x20003 }}, |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
132 { "cns11643.1992-7", { 0x20055 }}, |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
133 { "gbk-0", { 0x4E06 }, "zh-cn"}, |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
134 { "jisx0212.1990-0", { 0x4E44 }}, |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
135 { "jisx0213.2000-1", { 0xFA10 }, "ja"}, |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
136 { "jisx0213.2000-2", { 0xFA49 }}, |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
137 { "jisx0213.2004-1", { 0x20B9F }}, |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
138 { "viscii1.1-1", { 0x1EA0, 0x1EAE, 0x1ED2 }, "vi"}, |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
139 { "tis620.2529-1", { 0x0E01 }, "th"}, |
96429
5ee216cdf0e3
(fc_charset_table): New member lang.
Kenichi Handa <handa@m17n.org>
parents:
96076
diff
changeset
|
140 { "windows-1251", { 0x0401, 0x0490 }, "ru"}, |
5ee216cdf0e3
(fc_charset_table): New member lang.
Kenichi Handa <handa@m17n.org>
parents:
96076
diff
changeset
|
141 { "koi8-r", { 0x0401, 0x2219 }, "ru"}, |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
142 { "mulelao-1", { 0x0E81 }, "lo"}, |
100308
611f0256259c
(fc_charset_table): Add "unicode-sip".
Kenichi Handa <handa@m17n.org>
parents:
100239
diff
changeset
|
143 { "unicode-sip", { 0x20000 }}, |
95103 | 144 { NULL } |
145 }; | |
90400 | 146 |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
147 extern Lisp_Object Qc, Qm, Qp, Qd; |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
148 |
102944
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
149 /* Dirty hack for handing ADSTYLE property. |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
150 |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
151 Fontconfig (actually the underlying FreeType) gives such ADSTYLE |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
152 font property of PCF/BDF fonts in FC_STYLE. And, "Bold", |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
153 "Oblique", "Italic", or any non-normal SWIDTH property names |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
154 (e.g. SemiCondensed) are appended. In addition, if there's no |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
155 ADSTYLE property nor non-normal WEIGHT/SLANT/SWIDTH properties, |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
156 "Regular" is used for FC_STYLE (see the function |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
157 pcf_interpret_style in src/pcf/pcfread.c of FreeType). |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
158 |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
159 Unfortunately this behavior is not documented, so the following |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
160 code may fail if FreeType changes the behavior in the future. */ |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
161 |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
162 static Lisp_Object |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
163 get_adstyle_property (FcPattern *p) |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
164 { |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
165 char *str, *end; |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
166 Lisp_Object adstyle; |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
167 |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
168 if (FcPatternGetString (p, FC_STYLE, 0, (FcChar8 **) &str) != FcResultMatch) |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
169 return Qnil; |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
170 for (end = str; *end && *end != ' '; end++); |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
171 if (*end) |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
172 { |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
173 char *p = alloca (end - str + 1); |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
174 memcpy (p, str, end - str); |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
175 p[end - str] = '\0'; |
102945
f623dc25d37e
(get_adstyle_property): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
102944
diff
changeset
|
176 end = p + (end - str); |
102944
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
177 str = p; |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
178 } |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
179 if (xstrcasecmp (str, "Regular") == 0 |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
180 || xstrcasecmp (str, "Bold") == 0 |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
181 || xstrcasecmp (str, "Oblique") == 0 |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
182 || xstrcasecmp (str, "Italic") == 0) |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
183 return Qnil; |
103591
1e63d004a073
(get_adstyle_property): Call font_intern_prop with 1 as
Kenichi Handa <handa@m17n.org>
parents:
103556
diff
changeset
|
184 adstyle = font_intern_prop (str, end - str, 1); |
102944
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
185 if (font_style_to_value (FONT_WIDTH_INDEX, adstyle, 0) >= 0) |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
186 return Qnil; |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
187 return adstyle; |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
188 } |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
189 |
90464
4702b592db4c
(Qmonospace, Qsans_serif, Qserif, Qmono, Qsans)
Kenichi Handa <handa@m17n.org>
parents:
90450
diff
changeset
|
190 static Lisp_Object |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
191 ftfont_pattern_entity (FcPattern *p, Lisp_Object extra) |
90441
d63258b13d84
(Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved to
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
192 { |
102991
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
193 Lisp_Object key, cache, entity; |
95103 | 194 char *file, *str; |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
195 int index; |
90441
d63258b13d84
(Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved to
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
196 int numeric; |
d63258b13d84
(Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved to
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
197 double dbl; |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
198 FcBool b; |
90441
d63258b13d84
(Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved to
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
199 |
95103 | 200 if (FcPatternGetString (p, FC_FILE, 0, (FcChar8 **) &file) != FcResultMatch) |
90441
d63258b13d84
(Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved to
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
201 return Qnil; |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
202 if (FcPatternGetInteger (p, FC_INDEX, 0, &index) != FcResultMatch) |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
203 return Qnil; |
90441
d63258b13d84
(Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved to
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
204 |
102991
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
205 key = Fcons (make_unibyte_string ((char *) file, strlen ((char *) file)), |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
206 make_number (index)); |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
207 cache = ftfont_lookup_cache (key, FTFONT_CACHE_FOR_ENTITY); |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
208 entity = XCAR (cache); |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
209 if (! NILP (entity)) |
103003
bf88e5d2f4af
(ftfont_pattern_entity): Return a newly allocated
Kenichi Handa <handa@m17n.org>
parents:
102991
diff
changeset
|
210 { |
bf88e5d2f4af
(ftfont_pattern_entity): Return a newly allocated
Kenichi Handa <handa@m17n.org>
parents:
102991
diff
changeset
|
211 Lisp_Object val = font_make_entity (); |
bf88e5d2f4af
(ftfont_pattern_entity): Return a newly allocated
Kenichi Handa <handa@m17n.org>
parents:
102991
diff
changeset
|
212 int i; |
bf88e5d2f4af
(ftfont_pattern_entity): Return a newly allocated
Kenichi Handa <handa@m17n.org>
parents:
102991
diff
changeset
|
213 |
bf88e5d2f4af
(ftfont_pattern_entity): Return a newly allocated
Kenichi Handa <handa@m17n.org>
parents:
102991
diff
changeset
|
214 for (i = 0; i < FONT_OBJLIST_INDEX; i++) |
bf88e5d2f4af
(ftfont_pattern_entity): Return a newly allocated
Kenichi Handa <handa@m17n.org>
parents:
102991
diff
changeset
|
215 ASET (val, i, AREF (entity, i)); |
bf88e5d2f4af
(ftfont_pattern_entity): Return a newly allocated
Kenichi Handa <handa@m17n.org>
parents:
102991
diff
changeset
|
216 return val; |
bf88e5d2f4af
(ftfont_pattern_entity): Return a newly allocated
Kenichi Handa <handa@m17n.org>
parents:
102991
diff
changeset
|
217 } |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
218 entity = font_make_entity (); |
102991
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
219 XSETCAR (cache, entity); |
90441
d63258b13d84
(Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved to
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
220 |
d63258b13d84
(Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved to
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
221 ASET (entity, FONT_TYPE_INDEX, Qfreetype); |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
222 ASET (entity, FONT_REGISTRY_INDEX, Qiso10646_1); |
90441
d63258b13d84
(Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved to
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
223 |
95103 | 224 if (FcPatternGetString (p, FC_FOUNDRY, 0, (FcChar8 **) &str) == FcResultMatch) |
95745
bea43f586395
(ftfont_pattern_entity): Adjusted for the change of font_intern_prop.
Kenichi Handa <handa@m17n.org>
parents:
95698
diff
changeset
|
225 ASET (entity, FONT_FOUNDRY_INDEX, font_intern_prop (str, strlen (str), 1)); |
95103 | 226 if (FcPatternGetString (p, FC_FAMILY, 0, (FcChar8 **) &str) == FcResultMatch) |
95745
bea43f586395
(ftfont_pattern_entity): Adjusted for the change of font_intern_prop.
Kenichi Handa <handa@m17n.org>
parents:
95698
diff
changeset
|
227 ASET (entity, FONT_FAMILY_INDEX, font_intern_prop (str, strlen (str), 1)); |
90441
d63258b13d84
(Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved to
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
228 if (FcPatternGetInteger (p, FC_WEIGHT, 0, &numeric) == FcResultMatch) |
90474
8627c9321afb
(ftfont_pattern_entity): Use the numeric value 100 for
Kenichi Handa <handa@m17n.org>
parents:
90464
diff
changeset
|
229 { |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
230 if (numeric >= FC_WEIGHT_REGULAR && numeric < FC_WEIGHT_MEDIUM) |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
231 numeric = FC_WEIGHT_MEDIUM; |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
232 FONT_SET_STYLE (entity, FONT_WEIGHT_INDEX, make_number (numeric)); |
90474
8627c9321afb
(ftfont_pattern_entity): Use the numeric value 100 for
Kenichi Handa <handa@m17n.org>
parents:
90464
diff
changeset
|
233 } |
90441
d63258b13d84
(Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved to
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
234 if (FcPatternGetInteger (p, FC_SLANT, 0, &numeric) == FcResultMatch) |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
235 { |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
236 numeric += 100; |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
237 FONT_SET_STYLE (entity, FONT_SLANT_INDEX, make_number (numeric)); |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
238 } |
90441
d63258b13d84
(Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved to
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
239 if (FcPatternGetInteger (p, FC_WIDTH, 0, &numeric) == FcResultMatch) |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
240 { |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
241 FONT_SET_STYLE (entity, FONT_WIDTH_INDEX, make_number (numeric)); |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
242 } |
90441
d63258b13d84
(Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved to
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
243 if (FcPatternGetDouble (p, FC_PIXEL_SIZE, 0, &dbl) == FcResultMatch) |
102944
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
244 { |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
245 ASET (entity, FONT_SIZE_INDEX, make_number (dbl)); |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
246 } |
90441
d63258b13d84
(Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved to
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
247 else |
d63258b13d84
(Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved to
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
248 ASET (entity, FONT_SIZE_INDEX, make_number (0)); |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
249 if (FcPatternGetInteger (p, FC_SPACING, 0, &numeric) == FcResultMatch) |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
250 ASET (entity, FONT_SPACING_INDEX, make_number (numeric)); |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
251 if (FcPatternGetDouble (p, FC_DPI, 0, &dbl) == FcResultMatch) |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
252 { |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
253 int dpi = dbl; |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
254 ASET (entity, FONT_DPI_INDEX, make_number (dpi)); |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
255 } |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
256 if (FcPatternGetBool (p, FC_SCALABLE, 0, &b) == FcResultMatch |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
257 && b == FcTrue) |
102991
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
258 { |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
259 ASET (entity, FONT_SIZE_INDEX, make_number (0)); |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
260 ASET (entity, FONT_AVGWIDTH_INDEX, make_number (0)); |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
261 } |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
262 else |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
263 { |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
264 /* As this font is not scalable, parhaps this is a BDF or PCF |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
265 font. */ |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
266 FT_Face ft_face; |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
267 |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
268 ASET (entity, FONT_ADSTYLE_INDEX, get_adstyle_property (p)); |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
269 if ((ft_library || FT_Init_FreeType (&ft_library) == 0) |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
270 && FT_New_Face (ft_library, file, index, &ft_face) == 0) |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
271 { |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
272 BDF_PropertyRec rec; |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
273 |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
274 if (FT_Get_BDF_Property (ft_face, "AVERAGE_WIDTH", &rec) == 0 |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
275 && rec.type == BDF_PROPERTY_TYPE_INTEGER) |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
276 ASET (entity, FONT_AVGWIDTH_INDEX, make_number (rec.u.integer)); |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
277 FT_Done_Face (ft_face); |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
278 } |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
279 } |
90441
d63258b13d84
(Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved to
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
280 |
96076
bd3f48456ac7
(ftfont_pattern_entity): New arg extra. Caller changed.
Kenichi Handa <handa@m17n.org>
parents:
95805
diff
changeset
|
281 ASET (entity, FONT_EXTRA_INDEX, Fcopy_sequence (extra)); |
102991
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
282 font_put_extra (entity, QCfont_entity, key); |
90441
d63258b13d84
(Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved to
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
283 return entity; |
d63258b13d84
(Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved to
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
284 } |
d63258b13d84
(Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved to
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
285 |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
286 |
90464
4702b592db4c
(Qmonospace, Qsans_serif, Qserif, Qmono, Qsans)
Kenichi Handa <handa@m17n.org>
parents:
90450
diff
changeset
|
287 static Lisp_Object ftfont_generic_family_list; |
4702b592db4c
(Qmonospace, Qsans_serif, Qserif, Qmono, Qsans)
Kenichi Handa <handa@m17n.org>
parents:
90450
diff
changeset
|
288 |
4702b592db4c
(Qmonospace, Qsans_serif, Qserif, Qmono, Qsans)
Kenichi Handa <handa@m17n.org>
parents:
90450
diff
changeset
|
289 static Lisp_Object |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
290 ftfont_resolve_generic_family (Lisp_Object family, FcPattern *pattern) |
90464
4702b592db4c
(Qmonospace, Qsans_serif, Qserif, Qmono, Qsans)
Kenichi Handa <handa@m17n.org>
parents:
90450
diff
changeset
|
291 { |
95182
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
292 Lisp_Object slot; |
96429
5ee216cdf0e3
(fc_charset_table): New member lang.
Kenichi Handa <handa@m17n.org>
parents:
96076
diff
changeset
|
293 FcPattern *match; |
95182
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
294 FcResult result; |
97826 | 295 FcLangSet *langset; |
90464
4702b592db4c
(Qmonospace, Qsans_serif, Qserif, Qmono, Qsans)
Kenichi Handa <handa@m17n.org>
parents:
90450
diff
changeset
|
296 |
95182
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
297 family = Fintern (Fdowncase (SYMBOL_NAME (family)), Qnil); |
90464
4702b592db4c
(Qmonospace, Qsans_serif, Qserif, Qmono, Qsans)
Kenichi Handa <handa@m17n.org>
parents:
90450
diff
changeset
|
298 if (EQ (family, Qmono)) |
4702b592db4c
(Qmonospace, Qsans_serif, Qserif, Qmono, Qsans)
Kenichi Handa <handa@m17n.org>
parents:
90450
diff
changeset
|
299 family = Qmonospace; |
4702b592db4c
(Qmonospace, Qsans_serif, Qserif, Qmono, Qsans)
Kenichi Handa <handa@m17n.org>
parents:
90450
diff
changeset
|
300 else if (EQ (family, Qsans) || EQ (family, Qsans__serif)) |
4702b592db4c
(Qmonospace, Qsans_serif, Qserif, Qmono, Qsans)
Kenichi Handa <handa@m17n.org>
parents:
90450
diff
changeset
|
301 family = Qsans_serif; |
4702b592db4c
(Qmonospace, Qsans_serif, Qserif, Qmono, Qsans)
Kenichi Handa <handa@m17n.org>
parents:
90450
diff
changeset
|
302 slot = assq_no_quit (family, ftfont_generic_family_list); |
4702b592db4c
(Qmonospace, Qsans_serif, Qserif, Qmono, Qsans)
Kenichi Handa <handa@m17n.org>
parents:
90450
diff
changeset
|
303 if (! CONSP (slot)) |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
304 return Qnil; |
95182
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
305 if (! EQ (XCDR (slot), Qt)) |
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
306 return XCDR (slot); |
96429
5ee216cdf0e3
(fc_charset_table): New member lang.
Kenichi Handa <handa@m17n.org>
parents:
96076
diff
changeset
|
307 pattern = FcPatternDuplicate (pattern); |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
308 if (! pattern) |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
309 goto err; |
96592
0ef6933bf3bd
(ftfont_resolve_generic_family): Remove foundry from
Andreas Schwab <schwab@suse.de>
parents:
96568
diff
changeset
|
310 FcPatternDel (pattern, FC_FOUNDRY); |
96429
5ee216cdf0e3
(fc_charset_table): New member lang.
Kenichi Handa <handa@m17n.org>
parents:
96076
diff
changeset
|
311 FcPatternDel (pattern, FC_FAMILY); |
5ee216cdf0e3
(fc_charset_table): New member lang.
Kenichi Handa <handa@m17n.org>
parents:
96076
diff
changeset
|
312 FcPatternAddString (pattern, FC_FAMILY, SYMBOL_FcChar8 (family)); |
97826 | 313 if (FcPatternGetLangSet (pattern, FC_LANG, 0, &langset) != FcResultMatch) |
314 { | |
315 /* This is to avoid the effect of locale. */ | |
316 langset = FcLangSetCreate (); | |
317 FcLangSetAdd (langset, "en"); | |
318 FcPatternAddLangSet (pattern, FC_LANG, langset); | |
319 FcLangSetDestroy (langset); | |
320 } | |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
321 FcConfigSubstitute (NULL, pattern, FcMatchPattern); |
95182
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
322 FcDefaultSubstitute (pattern); |
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
323 match = FcFontMatch (NULL, pattern, &result); |
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
324 if (match) |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
325 { |
95182
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
326 FcChar8 *fam; |
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
327 |
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
328 if (FcPatternGetString (match, FC_FAMILY, 0, &fam) == FcResultMatch) |
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
329 family = intern ((char *) fam); |
90464
4702b592db4c
(Qmonospace, Qsans_serif, Qserif, Qmono, Qsans)
Kenichi Handa <handa@m17n.org>
parents:
90450
diff
changeset
|
330 } |
95182
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
331 else |
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
332 family = Qnil; |
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
333 XSETCDR (slot, family); |
100161
f26bd5948e57
(ftfont_resolve_generic_family): Avoid using uninitialized var.
Chong Yidong <cyd@stupidchicken.com>
parents:
100159
diff
changeset
|
334 if (match) FcPatternDestroy (match); |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
335 err: |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
336 if (pattern) FcPatternDestroy (pattern); |
95182
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
337 return family; |
90464
4702b592db4c
(Qmonospace, Qsans_serif, Qserif, Qmono, Qsans)
Kenichi Handa <handa@m17n.org>
parents:
90450
diff
changeset
|
338 } |
4702b592db4c
(Qmonospace, Qsans_serif, Qserif, Qmono, Qsans)
Kenichi Handa <handa@m17n.org>
parents:
90450
diff
changeset
|
339 |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
340 struct ftfont_cache_data |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
341 { |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
342 FT_Face ft_face; |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
343 FcCharSet *fc_charset; |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
344 }; |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
345 |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
346 static Lisp_Object |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
347 ftfont_lookup_cache (Lisp_Object key, enum ftfont_cache_for cache_for) |
95103 | 348 { |
102944
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
349 Lisp_Object cache, val, entity; |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
350 struct ftfont_cache_data *cache_data; |
95103 | 351 |
102944
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
352 if (FONT_ENTITY_P (key)) |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
353 { |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
354 entity = key; |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
355 val = assq_no_quit (QCfont_entity, AREF (entity, FONT_EXTRA_INDEX)); |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
356 xassert (CONSP (val)); |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
357 key = XCDR (val); |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
358 } |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
359 else |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
360 entity = Qnil; |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
361 |
102991
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
362 if (NILP (ft_face_cache)) |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
363 cache = Qnil; |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
364 else |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
365 cache = Fgethash (key, ft_face_cache, Qnil); |
95103 | 366 if (NILP (cache)) |
367 { | |
102991
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
368 if (NILP (ft_face_cache)) |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
369 { |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
370 Lisp_Object args[2]; |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
371 |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
372 args[0] = QCtest; |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
373 args[1] = Qequal; |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
374 ft_face_cache = Fmake_hash_table (2, args); |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
375 } |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
376 cache_data = xmalloc (sizeof (struct ftfont_cache_data)); |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
377 cache_data->ft_face = NULL; |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
378 cache_data->fc_charset = NULL; |
95103 | 379 val = make_save_value (NULL, 0); |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
380 XSAVE_VALUE (val)->integer = 0; |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
381 XSAVE_VALUE (val)->pointer = cache_data; |
102991
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
382 cache = Fcons (Qnil, val); |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
383 Fputhash (key, cache, ft_face_cache); |
95103 | 384 } |
385 else | |
386 { | |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
387 val = XCDR (cache); |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
388 cache_data = XSAVE_VALUE (val)->pointer; |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
389 } |
102991
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
390 |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
391 if (cache_for == FTFONT_CACHE_FOR_ENTITY) |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
392 return cache; |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
393 |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
394 if (cache_for == FTFONT_CACHE_FOR_FACE |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
395 ? ! cache_data->ft_face : ! cache_data->fc_charset) |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
396 { |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
397 char *filename = (char *) SDATA (XCAR (key)); |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
398 int index = XINT (XCDR (key)); |
95103 | 399 |
102991
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
400 if (cache_for == FTFONT_CACHE_FOR_FACE) |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
401 { |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
402 if (! ft_library |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
403 && FT_Init_FreeType (&ft_library) != 0) |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
404 return Qnil; |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
405 if (FT_New_Face (ft_library, filename, index, &cache_data->ft_face) |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
406 != 0) |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
407 return Qnil; |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
408 } |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
409 else |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
410 { |
102944
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
411 FcPattern *pat = NULL; |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
412 FcFontSet *fontset = NULL; |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
413 FcObjectSet *objset = NULL; |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
414 FcCharSet *charset = NULL; |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
415 |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
416 pat = FcPatternBuild (0, FC_FILE, FcTypeString, (FcChar8 *) filename, |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
417 FC_INDEX, FcTypeInteger, index, NULL); |
102944
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
418 if (! pat) |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
419 goto finish; |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
420 objset = FcObjectSetBuild (FC_CHARSET, FC_STYLE, NULL); |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
421 if (! objset) |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
422 goto finish; |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
423 fontset = FcFontList (NULL, pat, objset); |
102944
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
424 if (! fontset) |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
425 goto finish; |
102991
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
426 if (fontset && fontset->nfont > 0 |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
427 && (FcPatternGetCharSet (fontset->fonts[0], FC_CHARSET, 0, |
101284
4c2b48d0a379
(ftfont_lookup_cache): Check the return value of FcFontList.
Kenichi Handa <handa@m17n.org>
parents:
100951
diff
changeset
|
428 &charset) |
102991
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
429 == FcResultMatch)) |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
430 cache_data->fc_charset = FcCharSetCopy (charset); |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
431 else |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
432 cache_data->fc_charset = FcCharSetCreate (); |
102944
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
433 |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
434 finish: |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
435 if (fontset) |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
436 FcFontSetDestroy (fontset); |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
437 if (objset) |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
438 FcObjectSetDestroy (objset); |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
439 if (pat) |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
440 FcPatternDestroy (pat); |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
441 } |
95103 | 442 } |
443 return cache; | |
444 } | |
445 | |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
446 FcCharSet * |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
447 ftfont_get_fc_charset (Lisp_Object entity) |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
448 { |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
449 Lisp_Object val, cache; |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
450 struct ftfont_cache_data *cache_data; |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
451 |
102991
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
452 cache = ftfont_lookup_cache (entity, FTFONT_CACHE_FOR_CHARSET); |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
453 val = XCDR (cache); |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
454 cache_data = XSAVE_VALUE (val)->pointer; |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
455 return cache_data->fc_charset; |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
456 } |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
457 |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
458 #ifdef HAVE_LIBOTF |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
459 static OTF * |
109364
89a16701cde1
Convert old-style definitions
Andreas Schwab <schwab@linux-m68k.org>
parents:
109165
diff
changeset
|
460 ftfont_get_otf (struct ftfont_info *ftfont_info) |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
461 { |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
462 OTF *otf; |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
463 |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
464 if (ftfont_info->otf) |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
465 return ftfont_info->otf; |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
466 if (! ftfont_info->maybe_otf) |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
467 return NULL; |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
468 otf = OTF_open_ft_face (ftfont_info->ft_size->face); |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
469 if (! otf || OTF_get_table (otf, "head") < 0) |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
470 { |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
471 if (otf) |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
472 OTF_close (otf); |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
473 ftfont_info->maybe_otf = 0; |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
474 return NULL; |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
475 } |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
476 ftfont_info->otf = otf; |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
477 return otf; |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
478 } |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
479 #endif /* HAVE_LIBOTF */ |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
480 |
109100
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
109081
diff
changeset
|
481 static Lisp_Object ftfont_get_cache (FRAME_PTR); |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
109081
diff
changeset
|
482 static Lisp_Object ftfont_list (Lisp_Object, Lisp_Object); |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
109081
diff
changeset
|
483 static Lisp_Object ftfont_match (Lisp_Object, Lisp_Object); |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
109081
diff
changeset
|
484 static Lisp_Object ftfont_list_family (Lisp_Object); |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
109081
diff
changeset
|
485 static Lisp_Object ftfont_open (FRAME_PTR, Lisp_Object, int); |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
109081
diff
changeset
|
486 static void ftfont_close (FRAME_PTR, struct font *); |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
109081
diff
changeset
|
487 static int ftfont_has_char (Lisp_Object, int); |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
109081
diff
changeset
|
488 static unsigned ftfont_encode_char (struct font *, int); |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
109081
diff
changeset
|
489 static int ftfont_text_extents (struct font *, unsigned *, int, |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
109081
diff
changeset
|
490 struct font_metrics *); |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
109081
diff
changeset
|
491 static int ftfont_get_bitmap (struct font *, unsigned, |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
109081
diff
changeset
|
492 struct font_bitmap *, int); |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
109081
diff
changeset
|
493 static int ftfont_anchor_point (struct font *, unsigned, int, |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
109081
diff
changeset
|
494 int *, int *); |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
109081
diff
changeset
|
495 static Lisp_Object ftfont_otf_capability (struct font *); |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
109081
diff
changeset
|
496 static Lisp_Object ftfont_shape (Lisp_Object); |
102773
b9b8c6b17d2d
Conditionalize prototyping and use of ftfont_variation_glyphs.
Chong Yidong <cyd@stupidchicken.com>
parents:
101943
diff
changeset
|
497 |
b9b8c6b17d2d
Conditionalize prototyping and use of ftfont_variation_glyphs.
Chong Yidong <cyd@stupidchicken.com>
parents:
101943
diff
changeset
|
498 #ifdef HAVE_OTF_GET_VARIATION_GLYPHS |
109100
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
109081
diff
changeset
|
499 static int ftfont_variation_glyphs (struct font *, int c, |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
109081
diff
changeset
|
500 unsigned variations[256]); |
102773
b9b8c6b17d2d
Conditionalize prototyping and use of ftfont_variation_glyphs.
Chong Yidong <cyd@stupidchicken.com>
parents:
101943
diff
changeset
|
501 #endif /* HAVE_OTF_GET_VARIATION_GLYPHS */ |
90400 | 502 |
503 struct font_driver ftfont_driver = | |
504 { | |
90697
444b40002533
(ftfont_driver): Initialize ftfont_driver.type by 0.
Kenichi Handa <handa@m17n.org>
parents:
90680
diff
changeset
|
505 0, /* Qfreetype */ |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
506 0, /* case insensitive */ |
90400 | 507 ftfont_get_cache, |
508 ftfont_list, | |
90565
258e759bcffa
(ftfont_driver): Set ftfont_driver.match to
Kenichi Handa <handa@m17n.org>
parents:
90555
diff
changeset
|
509 ftfont_match, |
90400 | 510 ftfont_list_family, |
100792
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
511 NULL, /* free_entity */ |
90400 | 512 ftfont_open, |
513 ftfont_close, | |
514 /* We can't draw a text without device dependent functions. */ | |
100792
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
515 NULL, /* prepare_face */ |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
516 NULL, /* done_face */ |
90400 | 517 ftfont_has_char, |
518 ftfont_encode_char, | |
519 ftfont_text_extents, | |
520 /* We can't draw a text without device dependent functions. */ | |
100792
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
521 NULL, /* draw */ |
90400 | 522 ftfont_get_bitmap, |
100792
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
523 NULL, /* get_bitmap */ |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
524 NULL, /* free_bitmap */ |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
525 NULL, /* get_outline */ |
90400 | 526 ftfont_anchor_point, |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
527 #ifdef HAVE_LIBOTF |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
528 ftfont_otf_capability, |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
529 #else /* not HAVE_LIBOTF */ |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
530 NULL, |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
531 #endif /* not HAVE_LIBOTF */ |
100792
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
532 NULL, /* otf_drive */ |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
533 NULL, /* start_for_frame */ |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
534 NULL, /* end_for_frame */ |
91308
9b6270bcd1a7
(ftfont_driver): Set ftfont_shape in ftfont_driver only
Kenichi Handa <handa@m17n.org>
parents:
91294
diff
changeset
|
535 #if defined (HAVE_M17N_FLT) && defined (HAVE_LIBOTF) |
100792
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
536 ftfont_shape, |
91308
9b6270bcd1a7
(ftfont_driver): Set ftfont_shape in ftfont_driver only
Kenichi Handa <handa@m17n.org>
parents:
91294
diff
changeset
|
537 #else /* not (HAVE_M17N_FLT && HAVE_LIBOTF) */ |
100792
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
538 NULL, |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
539 #endif /* not (HAVE_M17N_FLT && HAVE_LIBOTF) */ |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
540 NULL, /* check */ |
102773
b9b8c6b17d2d
Conditionalize prototyping and use of ftfont_variation_glyphs.
Chong Yidong <cyd@stupidchicken.com>
parents:
101943
diff
changeset
|
541 |
102791
9874a0083028
Fix previous change. Define ftfont_variation_glyphs
Kenichi Handa <handa@m17n.org>
parents:
102773
diff
changeset
|
542 #ifdef HAVE_OTF_GET_VARIATION_GLYPHS |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
543 ftfont_variation_glyphs, |
100792
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
544 #else |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
545 NULL, |
100792
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
546 #endif |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
547 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
548 ftfont_filter_properties, /* filter_properties */ |
90400 | 549 }; |
550 | |
551 extern Lisp_Object QCname; | |
552 | |
553 static Lisp_Object | |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
554 ftfont_get_cache (FRAME_PTR f) |
90400 | 555 { |
556 return freetype_font_cache; | |
557 } | |
558 | |
95103 | 559 static int |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
560 ftfont_get_charset (Lisp_Object registry) |
95103 | 561 { |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
562 char *str = (char *) SDATA (SYMBOL_NAME (registry)); |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
563 char *re = alloca (SBYTES (SYMBOL_NAME (registry)) * 2 + 1); |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
564 Lisp_Object regexp; |
95103 | 565 int i, j; |
566 | |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
567 for (i = j = 0; i < SBYTES (SYMBOL_NAME (registry)); i++, j++) |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
568 { |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
569 if (str[i] == '.') |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
570 re[j++] = '\\'; |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
571 else if (str[i] == '*') |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
572 re[j++] = '.'; |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
573 re[j] = str[i]; |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
574 if (re[j] == '?') |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
575 re[j] = '.'; |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
576 } |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
577 re[j] = '\0'; |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
578 regexp = make_unibyte_string (re, j); |
95103 | 579 for (i = 0; fc_charset_table[i].name; i++) |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
580 if (fast_c_string_match_ignore_case (regexp, fc_charset_table[i].name) >= 0) |
95103 | 581 break; |
582 if (! fc_charset_table[i].name) | |
583 return -1; | |
584 if (! fc_charset_table[i].fc_charset) | |
585 { | |
102991
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
586 FcCharSet *charset = FcCharSetCreate (); |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
587 int *uniquifier = fc_charset_table[i].uniquifier; |
95103 | 588 |
102991
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
589 if (! charset) |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
590 return -1; |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
591 for (j = 0; uniquifier[j]; j++) |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
592 if (! FcCharSetAddChar (charset, uniquifier[j])) |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
593 { |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
594 FcCharSetDestroy (charset); |
95103 | 595 return -1; |
102991
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
596 } |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
597 fc_charset_table[i].fc_charset = charset; |
95103 | 598 } |
599 return i; | |
600 } | |
601 | |
91187
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
602 struct OpenTypeSpec |
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
603 { |
91214
998b9da240f0
(struct OpenTypeSpec): Members script_tag renamed to
Kenichi Handa <handa@m17n.org>
parents:
91191
diff
changeset
|
604 Lisp_Object script; |
998b9da240f0
(struct OpenTypeSpec): Members script_tag renamed to
Kenichi Handa <handa@m17n.org>
parents:
91191
diff
changeset
|
605 unsigned int script_tag, langsys_tag; |
91187
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
606 int nfeatures[2]; |
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
607 unsigned int *features[2]; |
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
608 }; |
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
609 |
91191
5bce041b93dc
(OTF_SYM_TAG, OTF_TAG_STR): Fix argument names.
Kenichi Handa <handa@m17n.org>
parents:
91189
diff
changeset
|
610 #define OTF_SYM_TAG(SYM, TAG) \ |
91187
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
611 do { \ |
91191
5bce041b93dc
(OTF_SYM_TAG, OTF_TAG_STR): Fix argument names.
Kenichi Handa <handa@m17n.org>
parents:
91189
diff
changeset
|
612 unsigned char *p = SDATA (SYMBOL_NAME (SYM)); \ |
5bce041b93dc
(OTF_SYM_TAG, OTF_TAG_STR): Fix argument names.
Kenichi Handa <handa@m17n.org>
parents:
91189
diff
changeset
|
613 TAG = (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]; \ |
91187
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
614 } while (0) |
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
615 |
91191
5bce041b93dc
(OTF_SYM_TAG, OTF_TAG_STR): Fix argument names.
Kenichi Handa <handa@m17n.org>
parents:
91189
diff
changeset
|
616 #define OTF_TAG_STR(TAG, P) \ |
91187
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
617 do { \ |
91191
5bce041b93dc
(OTF_SYM_TAG, OTF_TAG_STR): Fix argument names.
Kenichi Handa <handa@m17n.org>
parents:
91189
diff
changeset
|
618 (P)[0] = (char) (TAG >> 24); \ |
5bce041b93dc
(OTF_SYM_TAG, OTF_TAG_STR): Fix argument names.
Kenichi Handa <handa@m17n.org>
parents:
91189
diff
changeset
|
619 (P)[1] = (char) ((TAG >> 16) & 0xFF); \ |
5bce041b93dc
(OTF_SYM_TAG, OTF_TAG_STR): Fix argument names.
Kenichi Handa <handa@m17n.org>
parents:
91189
diff
changeset
|
620 (P)[2] = (char) ((TAG >> 8) & 0xFF); \ |
5bce041b93dc
(OTF_SYM_TAG, OTF_TAG_STR): Fix argument names.
Kenichi Handa <handa@m17n.org>
parents:
91189
diff
changeset
|
621 (P)[3] = (char) (TAG & 0xFF); \ |
91214
998b9da240f0
(struct OpenTypeSpec): Members script_tag renamed to
Kenichi Handa <handa@m17n.org>
parents:
91191
diff
changeset
|
622 (P)[4] = '\0'; \ |
91187
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
623 } while (0) |
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
624 |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
625 #define OTF_TAG_SYM(SYM, TAG) \ |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
626 do { \ |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
627 char str[5]; \ |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
628 \ |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
629 OTF_TAG_STR (TAG, str); \ |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
630 (SYM) = font_intern_prop (str, 4, 1); \ |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
631 } while (0) |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
632 |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
633 |
91187
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
634 static struct OpenTypeSpec * |
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
635 ftfont_get_open_type_spec (Lisp_Object otf_spec) |
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
636 { |
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
637 struct OpenTypeSpec *spec = malloc (sizeof (struct OpenTypeSpec)); |
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
638 Lisp_Object val; |
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
639 int i, j, negative; |
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
640 |
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
641 if (! spec) |
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
642 return NULL; |
91214
998b9da240f0
(struct OpenTypeSpec): Members script_tag renamed to
Kenichi Handa <handa@m17n.org>
parents:
91191
diff
changeset
|
643 spec->script = XCAR (otf_spec); |
93588
917824e47986
(ftfont_get_open_type_spec): Check spec->script, not val.
Jason Rumney <jasonr@gnu.org>
parents:
92407
diff
changeset
|
644 if (! NILP (spec->script)) |
91214
998b9da240f0
(struct OpenTypeSpec): Members script_tag renamed to
Kenichi Handa <handa@m17n.org>
parents:
91191
diff
changeset
|
645 { |
998b9da240f0
(struct OpenTypeSpec): Members script_tag renamed to
Kenichi Handa <handa@m17n.org>
parents:
91191
diff
changeset
|
646 OTF_SYM_TAG (spec->script, spec->script_tag); |
998b9da240f0
(struct OpenTypeSpec): Members script_tag renamed to
Kenichi Handa <handa@m17n.org>
parents:
91191
diff
changeset
|
647 val = assq_no_quit (spec->script, Votf_script_alist); |
998b9da240f0
(struct OpenTypeSpec): Members script_tag renamed to
Kenichi Handa <handa@m17n.org>
parents:
91191
diff
changeset
|
648 if (CONSP (val) && SYMBOLP (XCDR (val))) |
998b9da240f0
(struct OpenTypeSpec): Members script_tag renamed to
Kenichi Handa <handa@m17n.org>
parents:
91191
diff
changeset
|
649 spec->script = XCDR (val); |
998b9da240f0
(struct OpenTypeSpec): Members script_tag renamed to
Kenichi Handa <handa@m17n.org>
parents:
91191
diff
changeset
|
650 else |
998b9da240f0
(struct OpenTypeSpec): Members script_tag renamed to
Kenichi Handa <handa@m17n.org>
parents:
91191
diff
changeset
|
651 spec->script = Qnil; |
998b9da240f0
(struct OpenTypeSpec): Members script_tag renamed to
Kenichi Handa <handa@m17n.org>
parents:
91191
diff
changeset
|
652 } |
91187
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
653 else |
91214
998b9da240f0
(struct OpenTypeSpec): Members script_tag renamed to
Kenichi Handa <handa@m17n.org>
parents:
91191
diff
changeset
|
654 spec->script_tag = 0x44464C54; /* "DFLT" */ |
91187
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
655 otf_spec = XCDR (otf_spec); |
107237 | 656 spec->langsys_tag = 0; |
657 if (! NILP (otf_spec)) | |
658 { | |
659 val = XCAR (otf_spec); | |
660 if (! NILP (val)) | |
661 OTF_SYM_TAG (val, spec->langsys_tag); | |
662 otf_spec = XCDR (otf_spec); | |
663 } | |
91187
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
664 spec->nfeatures[0] = spec->nfeatures[1] = 0; |
107237 | 665 for (i = 0; i < 2 && ! NILP (otf_spec); i++, otf_spec = XCDR (otf_spec)) |
91187
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
666 { |
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
667 Lisp_Object len; |
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
668 |
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
669 val = XCAR (otf_spec); |
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
670 if (NILP (val)) |
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
671 continue; |
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
672 len = Flength (val); |
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
673 spec->features[i] = malloc (sizeof (int) * XINT (len)); |
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
674 if (! spec->features[i]) |
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
675 { |
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
676 if (i > 0 && spec->features[0]) |
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
677 free (spec->features[0]); |
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
678 free (spec); |
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
679 return NULL; |
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
680 } |
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
681 for (j = 0, negative = 0; CONSP (val); val = XCDR (val)) |
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
682 { |
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
683 if (NILP (XCAR (val))) |
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
684 negative = 1; |
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
685 else |
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
686 { |
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
687 unsigned int tag; |
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
688 |
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
689 OTF_SYM_TAG (XCAR (val), tag); |
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
690 spec->features[i][j++] = negative ? tag & 0x80000000 : tag; |
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
691 } |
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
692 } |
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
693 spec->nfeatures[i] = j; |
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
694 } |
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
695 return spec; |
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
696 } |
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
697 |
109100
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
109081
diff
changeset
|
698 static FcPattern *ftfont_spec_pattern (Lisp_Object, char *, |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
109081
diff
changeset
|
699 struct OpenTypeSpec **, |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
109081
diff
changeset
|
700 char **langname); |
95103 | 701 |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
702 static FcPattern * |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
703 ftfont_spec_pattern (Lisp_Object spec, char *otlayout, struct OpenTypeSpec **otspec, char **langname) |
90400 | 704 { |
95103 | 705 Lisp_Object tmp, extra; |
90400 | 706 FcPattern *pattern = NULL; |
707 FcCharSet *charset = NULL; | |
708 FcLangSet *langset = NULL; | |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
709 int n; |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
710 int dpi = -1; |
90500
60e0667ab709
(ftfont_list): Handle properties dpi, spacing, and
Kenichi Handa <handa@m17n.org>
parents:
90480
diff
changeset
|
711 int scalable = -1; |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
712 Lisp_Object script = Qnil; |
95103 | 713 Lisp_Object registry; |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
714 int fc_charset_idx; |
90400 | 715 |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
716 if ((n = FONT_SLANT_NUMERIC (spec)) >= 0 |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
717 && n < 100) |
90480
908d27653432
(ftfont_list): Use assq_no_quit, not Fassq. Don't
Kenichi Handa <handa@m17n.org>
parents:
90474
diff
changeset
|
718 /* Fontconfig doesn't support reverse-italic/obligue. */ |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
719 return NULL; |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
720 |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
721 if (INTEGERP (AREF (spec, FONT_DPI_INDEX))) |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
722 dpi = XINT (AREF (spec, FONT_DPI_INDEX)); |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
723 if (INTEGERP (AREF (spec, FONT_AVGWIDTH_INDEX)) |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
724 && XINT (AREF (spec, FONT_AVGWIDTH_INDEX)) == 0) |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
725 scalable = 1; |
90480
908d27653432
(ftfont_list): Use assq_no_quit, not Fassq. Don't
Kenichi Handa <handa@m17n.org>
parents:
90474
diff
changeset
|
726 |
95103 | 727 registry = AREF (spec, FONT_REGISTRY_INDEX); |
728 if (NILP (registry) | |
95698
d87a51f8851f
(ftfont_spec_pattern): Accept the registry `ascii-0'.
Kenichi Handa <handa@m17n.org>
parents:
95464
diff
changeset
|
729 || EQ (registry, Qascii_0) |
95103 | 730 || EQ (registry, Qiso10646_1) |
100308
611f0256259c
(fc_charset_table): Add "unicode-sip".
Kenichi Handa <handa@m17n.org>
parents:
100239
diff
changeset
|
731 || EQ (registry, Qunicode_bmp)) |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
732 fc_charset_idx = -1; |
95103 | 733 else |
90400 | 734 { |
96429
5ee216cdf0e3
(fc_charset_table): New member lang.
Kenichi Handa <handa@m17n.org>
parents:
96076
diff
changeset
|
735 FcChar8 *lang; |
5ee216cdf0e3
(fc_charset_table): New member lang.
Kenichi Handa <handa@m17n.org>
parents:
96076
diff
changeset
|
736 |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
737 fc_charset_idx = ftfont_get_charset (registry); |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
738 if (fc_charset_idx < 0) |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
739 return NULL; |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
740 charset = fc_charset_table[fc_charset_idx].fc_charset; |
103887
427b644c9e3b
(ftfont_spec_pattern): New arg langname. Caller
Kenichi Handa <handa@m17n.org>
parents:
103591
diff
changeset
|
741 *langname = fc_charset_table[fc_charset_idx].lang; |
427b644c9e3b
(ftfont_spec_pattern): New arg langname. Caller
Kenichi Handa <handa@m17n.org>
parents:
103591
diff
changeset
|
742 lang = (FcChar8 *) *langname; |
96429
5ee216cdf0e3
(fc_charset_table): New member lang.
Kenichi Handa <handa@m17n.org>
parents:
96076
diff
changeset
|
743 if (lang) |
5ee216cdf0e3
(fc_charset_table): New member lang.
Kenichi Handa <handa@m17n.org>
parents:
96076
diff
changeset
|
744 { |
5ee216cdf0e3
(fc_charset_table): New member lang.
Kenichi Handa <handa@m17n.org>
parents:
96076
diff
changeset
|
745 langset = FcLangSetCreate (); |
5ee216cdf0e3
(fc_charset_table): New member lang.
Kenichi Handa <handa@m17n.org>
parents:
96076
diff
changeset
|
746 if (! langset) |
5ee216cdf0e3
(fc_charset_table): New member lang.
Kenichi Handa <handa@m17n.org>
parents:
96076
diff
changeset
|
747 goto err; |
5ee216cdf0e3
(fc_charset_table): New member lang.
Kenichi Handa <handa@m17n.org>
parents:
96076
diff
changeset
|
748 FcLangSetAdd (langset, lang); |
5ee216cdf0e3
(fc_charset_table): New member lang.
Kenichi Handa <handa@m17n.org>
parents:
96076
diff
changeset
|
749 } |
90400 | 750 } |
751 | |
91187
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
752 otlayout[0] = '\0'; |
90565
258e759bcffa
(ftfont_driver): Set ftfont_driver.match to
Kenichi Handa <handa@m17n.org>
parents:
90555
diff
changeset
|
753 for (extra = AREF (spec, FONT_EXTRA_INDEX); |
258e759bcffa
(ftfont_driver): Set ftfont_driver.match to
Kenichi Handa <handa@m17n.org>
parents:
90555
diff
changeset
|
754 CONSP (extra); extra = XCDR (extra)) |
90400 | 755 { |
90565
258e759bcffa
(ftfont_driver): Set ftfont_driver.match to
Kenichi Handa <handa@m17n.org>
parents:
90555
diff
changeset
|
756 Lisp_Object key, val; |
90510
69dc5ab6d693
(ftfont_list): Handle QCotf property.
Kenichi Handa <handa@m17n.org>
parents:
90500
diff
changeset
|
757 |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
758 key = XCAR (XCAR (extra)), val = XCDR (XCAR (extra)); |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
759 if (EQ (key, QCdpi)) |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
760 dpi = XINT (val); |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
761 else if (EQ (key, QClang)) |
90400 | 762 { |
96429
5ee216cdf0e3
(fc_charset_table): New member lang.
Kenichi Handa <handa@m17n.org>
parents:
96076
diff
changeset
|
763 if (! langset) |
5ee216cdf0e3
(fc_charset_table): New member lang.
Kenichi Handa <handa@m17n.org>
parents:
96076
diff
changeset
|
764 langset = FcLangSetCreate (); |
90400 | 765 if (! langset) |
766 goto err; | |
90565
258e759bcffa
(ftfont_driver): Set ftfont_driver.match to
Kenichi Handa <handa@m17n.org>
parents:
90555
diff
changeset
|
767 if (SYMBOLP (val)) |
90400 | 768 { |
90565
258e759bcffa
(ftfont_driver): Set ftfont_driver.match to
Kenichi Handa <handa@m17n.org>
parents:
90555
diff
changeset
|
769 if (! FcLangSetAdd (langset, SYMBOL_FcChar8 (val))) |
90400 | 770 goto err; |
771 } | |
772 else | |
90565
258e759bcffa
(ftfont_driver): Set ftfont_driver.match to
Kenichi Handa <handa@m17n.org>
parents:
90555
diff
changeset
|
773 for (; CONSP (val); val = XCDR (val)) |
258e759bcffa
(ftfont_driver): Set ftfont_driver.match to
Kenichi Handa <handa@m17n.org>
parents:
90555
diff
changeset
|
774 if (SYMBOLP (XCAR (val)) |
258e759bcffa
(ftfont_driver): Set ftfont_driver.match to
Kenichi Handa <handa@m17n.org>
parents:
90555
diff
changeset
|
775 && ! FcLangSetAdd (langset, SYMBOL_FcChar8 (XCAR (val)))) |
258e759bcffa
(ftfont_driver): Set ftfont_driver.match to
Kenichi Handa <handa@m17n.org>
parents:
90555
diff
changeset
|
776 goto err; |
90400 | 777 } |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
778 else if (EQ (key, QCotf)) |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
779 { |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
780 *otspec = ftfont_get_open_type_spec (val); |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
781 if (! *otspec) |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
782 return NULL; |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
783 strcat (otlayout, "otlayout:"); |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
784 OTF_TAG_STR ((*otspec)->script_tag, otlayout + 9); |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
785 script = (*otspec)->script; |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
786 } |
90565
258e759bcffa
(ftfont_driver): Set ftfont_driver.match to
Kenichi Handa <handa@m17n.org>
parents:
90555
diff
changeset
|
787 else if (EQ (key, QCscript)) |
258e759bcffa
(ftfont_driver): Set ftfont_driver.match to
Kenichi Handa <handa@m17n.org>
parents:
90555
diff
changeset
|
788 script = val; |
258e759bcffa
(ftfont_driver): Set ftfont_driver.match to
Kenichi Handa <handa@m17n.org>
parents:
90555
diff
changeset
|
789 else if (EQ (key, QCscalable)) |
258e759bcffa
(ftfont_driver): Set ftfont_driver.match to
Kenichi Handa <handa@m17n.org>
parents:
90555
diff
changeset
|
790 scalable = ! NILP (val); |
90400 | 791 } |
792 | |
90565
258e759bcffa
(ftfont_driver): Set ftfont_driver.match to
Kenichi Handa <handa@m17n.org>
parents:
90555
diff
changeset
|
793 if (! NILP (script) && ! charset) |
258e759bcffa
(ftfont_driver): Set ftfont_driver.match to
Kenichi Handa <handa@m17n.org>
parents:
90555
diff
changeset
|
794 { |
258e759bcffa
(ftfont_driver): Set ftfont_driver.match to
Kenichi Handa <handa@m17n.org>
parents:
90555
diff
changeset
|
795 Lisp_Object chars = assq_no_quit (script, Vscript_representative_chars); |
258e759bcffa
(ftfont_driver): Set ftfont_driver.match to
Kenichi Handa <handa@m17n.org>
parents:
90555
diff
changeset
|
796 |
97908
464a00cca3cf
(ftfont_spec_pattern): Don't create a charset of the
Kenichi Handa <handa@m17n.org>
parents:
97826
diff
changeset
|
797 if (CONSP (chars) && CONSP (CDR (chars))) |
90565
258e759bcffa
(ftfont_driver): Set ftfont_driver.match to
Kenichi Handa <handa@m17n.org>
parents:
90555
diff
changeset
|
798 { |
258e759bcffa
(ftfont_driver): Set ftfont_driver.match to
Kenichi Handa <handa@m17n.org>
parents:
90555
diff
changeset
|
799 charset = FcCharSetCreate (); |
258e759bcffa
(ftfont_driver): Set ftfont_driver.match to
Kenichi Handa <handa@m17n.org>
parents:
90555
diff
changeset
|
800 if (! charset) |
258e759bcffa
(ftfont_driver): Set ftfont_driver.match to
Kenichi Handa <handa@m17n.org>
parents:
90555
diff
changeset
|
801 goto err; |
258e759bcffa
(ftfont_driver): Set ftfont_driver.match to
Kenichi Handa <handa@m17n.org>
parents:
90555
diff
changeset
|
802 for (chars = XCDR (chars); CONSP (chars); chars = XCDR (chars)) |
258e759bcffa
(ftfont_driver): Set ftfont_driver.match to
Kenichi Handa <handa@m17n.org>
parents:
90555
diff
changeset
|
803 if (CHARACTERP (XCAR (chars)) |
258e759bcffa
(ftfont_driver): Set ftfont_driver.match to
Kenichi Handa <handa@m17n.org>
parents:
90555
diff
changeset
|
804 && ! FcCharSetAddChar (charset, XUINT (XCAR (chars)))) |
258e759bcffa
(ftfont_driver): Set ftfont_driver.match to
Kenichi Handa <handa@m17n.org>
parents:
90555
diff
changeset
|
805 goto err; |
258e759bcffa
(ftfont_driver): Set ftfont_driver.match to
Kenichi Handa <handa@m17n.org>
parents:
90555
diff
changeset
|
806 } |
258e759bcffa
(ftfont_driver): Set ftfont_driver.match to
Kenichi Handa <handa@m17n.org>
parents:
90555
diff
changeset
|
807 } |
258e759bcffa
(ftfont_driver): Set ftfont_driver.match to
Kenichi Handa <handa@m17n.org>
parents:
90555
diff
changeset
|
808 |
96076
bd3f48456ac7
(ftfont_pattern_entity): New arg extra. Caller changed.
Kenichi Handa <handa@m17n.org>
parents:
95805
diff
changeset
|
809 pattern = FcPatternCreate (); |
90464
4702b592db4c
(Qmonospace, Qsans_serif, Qserif, Qmono, Qsans)
Kenichi Handa <handa@m17n.org>
parents:
90450
diff
changeset
|
810 if (! pattern) |
4702b592db4c
(Qmonospace, Qsans_serif, Qserif, Qmono, Qsans)
Kenichi Handa <handa@m17n.org>
parents:
90450
diff
changeset
|
811 goto err; |
4702b592db4c
(Qmonospace, Qsans_serif, Qserif, Qmono, Qsans)
Kenichi Handa <handa@m17n.org>
parents:
90450
diff
changeset
|
812 tmp = AREF (spec, FONT_FOUNDRY_INDEX); |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
813 if (! NILP (tmp) |
90464
4702b592db4c
(Qmonospace, Qsans_serif, Qserif, Qmono, Qsans)
Kenichi Handa <handa@m17n.org>
parents:
90450
diff
changeset
|
814 && ! FcPatternAddString (pattern, FC_FOUNDRY, SYMBOL_FcChar8 (tmp))) |
4702b592db4c
(Qmonospace, Qsans_serif, Qserif, Qmono, Qsans)
Kenichi Handa <handa@m17n.org>
parents:
90450
diff
changeset
|
815 goto err; |
95182
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
816 tmp = AREF (spec, FONT_FAMILY_INDEX); |
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
817 if (! NILP (tmp) |
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
818 && ! FcPatternAddString (pattern, FC_FAMILY, SYMBOL_FcChar8 (tmp))) |
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
819 goto err; |
90400 | 820 if (charset |
821 && ! FcPatternAddCharSet (pattern, FC_CHARSET, charset)) | |
822 goto err; | |
823 if (langset | |
824 && ! FcPatternAddLangSet (pattern, FC_LANG, langset)) | |
825 goto err; | |
90500
60e0667ab709
(ftfont_list): Handle properties dpi, spacing, and
Kenichi Handa <handa@m17n.org>
parents:
90480
diff
changeset
|
826 if (dpi >= 0 |
60e0667ab709
(ftfont_list): Handle properties dpi, spacing, and
Kenichi Handa <handa@m17n.org>
parents:
90480
diff
changeset
|
827 && ! FcPatternAddDouble (pattern, FC_DPI, dpi)) |
60e0667ab709
(ftfont_list): Handle properties dpi, spacing, and
Kenichi Handa <handa@m17n.org>
parents:
90480
diff
changeset
|
828 goto err; |
60e0667ab709
(ftfont_list): Handle properties dpi, spacing, and
Kenichi Handa <handa@m17n.org>
parents:
90480
diff
changeset
|
829 if (scalable >= 0 |
90522 | 830 && ! FcPatternAddBool (pattern, FC_SCALABLE, scalable ? FcTrue : FcFalse)) |
90500
60e0667ab709
(ftfont_list): Handle properties dpi, spacing, and
Kenichi Handa <handa@m17n.org>
parents:
90480
diff
changeset
|
831 goto err; |
96429
5ee216cdf0e3
(fc_charset_table): New member lang.
Kenichi Handa <handa@m17n.org>
parents:
96076
diff
changeset
|
832 |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
833 goto finish; |
90400 | 834 |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
835 err: |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
836 /* We come here because of unexpected error in fontconfig API call |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
837 (usually insufficient memory). */ |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
838 if (pattern) |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
839 { |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
840 FcPatternDestroy (pattern); |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
841 pattern = NULL; |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
842 } |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
843 if (*otspec) |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
844 { |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
845 if ((*otspec)->nfeatures[0] > 0) |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
846 free ((*otspec)->features[0]); |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
847 if ((*otspec)->nfeatures[1] > 0) |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
848 free ((*otspec)->features[1]); |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
849 free (*otspec); |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
850 *otspec = NULL; |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
851 } |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
852 |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
853 finish: |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
854 if (langset) FcLangSetDestroy (langset); |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
855 if (charset && fc_charset_idx < 0) FcCharSetDestroy (charset); |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
856 return pattern; |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
857 } |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
858 |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
859 static Lisp_Object |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
860 ftfont_list (Lisp_Object frame, Lisp_Object spec) |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
861 { |
102944
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
862 Lisp_Object val = Qnil, family, adstyle; |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
863 int i; |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
864 FcPattern *pattern; |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
865 FcFontSet *fontset = NULL; |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
866 FcObjectSet *objset = NULL; |
97908
464a00cca3cf
(ftfont_spec_pattern): Don't create a charset of the
Kenichi Handa <handa@m17n.org>
parents:
97826
diff
changeset
|
867 FcCharSet *charset; |
464a00cca3cf
(ftfont_spec_pattern): Don't create a charset of the
Kenichi Handa <handa@m17n.org>
parents:
97826
diff
changeset
|
868 Lisp_Object chars = Qnil; |
464a00cca3cf
(ftfont_spec_pattern): Don't create a charset of the
Kenichi Handa <handa@m17n.org>
parents:
97826
diff
changeset
|
869 FcResult result; |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
870 char otlayout[15]; /* For "otlayout:XXXX" */ |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
871 struct OpenTypeSpec *otspec = NULL; |
95358
9c54d4f00cf6
(ftfont_spec_pattern): Don't set FC_SPACING to pattern.
Kenichi Handa <handa@m17n.org>
parents:
95229
diff
changeset
|
872 int spacing = -1; |
103887
427b644c9e3b
(ftfont_spec_pattern): New arg langname. Caller
Kenichi Handa <handa@m17n.org>
parents:
103591
diff
changeset
|
873 char *langname = NULL; |
95464
de4cb7ab40db
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
95433
diff
changeset
|
874 |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
875 if (! fc_initialized) |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
876 { |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
877 FcInit (); |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
878 fc_initialized = 1; |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
879 } |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
880 |
103887
427b644c9e3b
(ftfont_spec_pattern): New arg langname. Caller
Kenichi Handa <handa@m17n.org>
parents:
103591
diff
changeset
|
881 pattern = ftfont_spec_pattern (spec, otlayout, &otspec, &langname); |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
882 if (! pattern) |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
883 return Qnil; |
97908
464a00cca3cf
(ftfont_spec_pattern): Don't create a charset of the
Kenichi Handa <handa@m17n.org>
parents:
97826
diff
changeset
|
884 if (FcPatternGetCharSet (pattern, FC_CHARSET, 0, &charset) != FcResultMatch) |
464a00cca3cf
(ftfont_spec_pattern): Don't create a charset of the
Kenichi Handa <handa@m17n.org>
parents:
97826
diff
changeset
|
885 { |
464a00cca3cf
(ftfont_spec_pattern): Don't create a charset of the
Kenichi Handa <handa@m17n.org>
parents:
97826
diff
changeset
|
886 val = assq_no_quit (QCscript, AREF (spec, FONT_EXTRA_INDEX)); |
464a00cca3cf
(ftfont_spec_pattern): Don't create a charset of the
Kenichi Handa <handa@m17n.org>
parents:
97826
diff
changeset
|
887 if (! NILP (val)) |
464a00cca3cf
(ftfont_spec_pattern): Don't create a charset of the
Kenichi Handa <handa@m17n.org>
parents:
97826
diff
changeset
|
888 { |
464a00cca3cf
(ftfont_spec_pattern): Don't create a charset of the
Kenichi Handa <handa@m17n.org>
parents:
97826
diff
changeset
|
889 val = assq_no_quit (XCDR (val), Vscript_representative_chars); |
464a00cca3cf
(ftfont_spec_pattern): Don't create a charset of the
Kenichi Handa <handa@m17n.org>
parents:
97826
diff
changeset
|
890 if (CONSP (val) && VECTORP (XCDR (val))) |
464a00cca3cf
(ftfont_spec_pattern): Don't create a charset of the
Kenichi Handa <handa@m17n.org>
parents:
97826
diff
changeset
|
891 chars = XCDR (val); |
464a00cca3cf
(ftfont_spec_pattern): Don't create a charset of the
Kenichi Handa <handa@m17n.org>
parents:
97826
diff
changeset
|
892 } |
464a00cca3cf
(ftfont_spec_pattern): Don't create a charset of the
Kenichi Handa <handa@m17n.org>
parents:
97826
diff
changeset
|
893 val = Qnil; |
464a00cca3cf
(ftfont_spec_pattern): Don't create a charset of the
Kenichi Handa <handa@m17n.org>
parents:
97826
diff
changeset
|
894 } |
95358
9c54d4f00cf6
(ftfont_spec_pattern): Don't set FC_SPACING to pattern.
Kenichi Handa <handa@m17n.org>
parents:
95229
diff
changeset
|
895 if (INTEGERP (AREF (spec, FONT_SPACING_INDEX))) |
9c54d4f00cf6
(ftfont_spec_pattern): Don't set FC_SPACING to pattern.
Kenichi Handa <handa@m17n.org>
parents:
95229
diff
changeset
|
896 spacing = XINT (AREF (spec, FONT_SPACING_INDEX)); |
95182
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
897 family = AREF (spec, FONT_FAMILY_INDEX); |
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
898 if (! NILP (family)) |
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
899 { |
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
900 Lisp_Object resolved; |
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
901 |
96429
5ee216cdf0e3
(fc_charset_table): New member lang.
Kenichi Handa <handa@m17n.org>
parents:
96076
diff
changeset
|
902 resolved = ftfont_resolve_generic_family (family, pattern); |
95182
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
903 if (! NILP (resolved)) |
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
904 { |
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
905 FcPatternDel (pattern, FC_FAMILY); |
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
906 if (! FcPatternAddString (pattern, FC_FAMILY, |
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
907 SYMBOL_FcChar8 (resolved))) |
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
908 goto err; |
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
909 } |
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
910 } |
102944
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
911 adstyle = AREF (spec, FONT_ADSTYLE_INDEX); |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
912 if (! NILP (adstyle) && SBYTES (SYMBOL_NAME (adstyle)) == 0) |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
913 adstyle = Qnil; |
90464
4702b592db4c
(Qmonospace, Qsans_serif, Qserif, Qmono, Qsans)
Kenichi Handa <handa@m17n.org>
parents:
90450
diff
changeset
|
914 objset = FcObjectSetBuild (FC_FOUNDRY, FC_FAMILY, FC_WEIGHT, FC_SLANT, |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
915 FC_WIDTH, FC_PIXEL_SIZE, FC_SPACING, FC_SCALABLE, |
102944
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
916 FC_STYLE, FC_FILE, FC_INDEX, |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
917 #ifdef FC_CAPABILITY |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
918 FC_CAPABILITY, |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
919 #endif /* FC_CAPABILITY */ |
96076
bd3f48456ac7
(ftfont_pattern_entity): New arg extra. Caller changed.
Kenichi Handa <handa@m17n.org>
parents:
95805
diff
changeset
|
920 #ifdef FC_FONTFORMAT |
bd3f48456ac7
(ftfont_pattern_entity): New arg extra. Caller changed.
Kenichi Handa <handa@m17n.org>
parents:
95805
diff
changeset
|
921 FC_FONTFORMAT, |
bd3f48456ac7
(ftfont_pattern_entity): New arg extra. Caller changed.
Kenichi Handa <handa@m17n.org>
parents:
95805
diff
changeset
|
922 #endif |
90680
254cfd053f9c
(ftfont_pattern_entity): Check if FC_FONTFORMAT is
Kenichi Handa <handa@m17n.org>
parents:
90676
diff
changeset
|
923 NULL); |
90464
4702b592db4c
(Qmonospace, Qsans_serif, Qserif, Qmono, Qsans)
Kenichi Handa <handa@m17n.org>
parents:
90450
diff
changeset
|
924 if (! objset) |
4702b592db4c
(Qmonospace, Qsans_serif, Qserif, Qmono, Qsans)
Kenichi Handa <handa@m17n.org>
parents:
90450
diff
changeset
|
925 goto err; |
97908
464a00cca3cf
(ftfont_spec_pattern): Don't create a charset of the
Kenichi Handa <handa@m17n.org>
parents:
97826
diff
changeset
|
926 if (! NILP (chars)) |
464a00cca3cf
(ftfont_spec_pattern): Don't create a charset of the
Kenichi Handa <handa@m17n.org>
parents:
97826
diff
changeset
|
927 FcObjectSetAdd (objset, FC_CHARSET); |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
928 |
95182
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
929 fontset = FcFontList (NULL, pattern, objset); |
97908
464a00cca3cf
(ftfont_spec_pattern): Don't create a charset of the
Kenichi Handa <handa@m17n.org>
parents:
97826
diff
changeset
|
930 if (! fontset || fontset->nfont == 0) |
464a00cca3cf
(ftfont_spec_pattern): Don't create a charset of the
Kenichi Handa <handa@m17n.org>
parents:
97826
diff
changeset
|
931 goto finish; |
95698
d87a51f8851f
(ftfont_spec_pattern): Accept the registry `ascii-0'.
Kenichi Handa <handa@m17n.org>
parents:
95464
diff
changeset
|
932 #if 0 |
d87a51f8851f
(ftfont_spec_pattern): Accept the registry `ascii-0'.
Kenichi Handa <handa@m17n.org>
parents:
95464
diff
changeset
|
933 /* Need fix because this finds any fonts. */ |
d87a51f8851f
(ftfont_spec_pattern): Accept the registry `ascii-0'.
Kenichi Handa <handa@m17n.org>
parents:
95464
diff
changeset
|
934 if (fontset->nfont == 0 && ! NILP (family)) |
d87a51f8851f
(ftfont_spec_pattern): Accept the registry `ascii-0'.
Kenichi Handa <handa@m17n.org>
parents:
95464
diff
changeset
|
935 { |
d87a51f8851f
(ftfont_spec_pattern): Accept the registry `ascii-0'.
Kenichi Handa <handa@m17n.org>
parents:
95464
diff
changeset
|
936 /* Try maching with configuration. For instance, the |
d87a51f8851f
(ftfont_spec_pattern): Accept the registry `ascii-0'.
Kenichi Handa <handa@m17n.org>
parents:
95464
diff
changeset
|
937 configuration may specify "Nimbus Mono L" as an alias of |
d87a51f8851f
(ftfont_spec_pattern): Accept the registry `ascii-0'.
Kenichi Handa <handa@m17n.org>
parents:
95464
diff
changeset
|
938 "Courier". */ |
d87a51f8851f
(ftfont_spec_pattern): Accept the registry `ascii-0'.
Kenichi Handa <handa@m17n.org>
parents:
95464
diff
changeset
|
939 FcPattern *pat = FcPatternBuild (0, FC_FAMILY, FcTypeString, |
d87a51f8851f
(ftfont_spec_pattern): Accept the registry `ascii-0'.
Kenichi Handa <handa@m17n.org>
parents:
95464
diff
changeset
|
940 SYMBOL_FcChar8 (family), NULL); |
d87a51f8851f
(ftfont_spec_pattern): Accept the registry `ascii-0'.
Kenichi Handa <handa@m17n.org>
parents:
95464
diff
changeset
|
941 FcChar8 *fam; |
d87a51f8851f
(ftfont_spec_pattern): Accept the registry `ascii-0'.
Kenichi Handa <handa@m17n.org>
parents:
95464
diff
changeset
|
942 |
d87a51f8851f
(ftfont_spec_pattern): Accept the registry `ascii-0'.
Kenichi Handa <handa@m17n.org>
parents:
95464
diff
changeset
|
943 if (FcConfigSubstitute (NULL, pat, FcMatchPattern) == FcTrue) |
d87a51f8851f
(ftfont_spec_pattern): Accept the registry `ascii-0'.
Kenichi Handa <handa@m17n.org>
parents:
95464
diff
changeset
|
944 { |
d87a51f8851f
(ftfont_spec_pattern): Accept the registry `ascii-0'.
Kenichi Handa <handa@m17n.org>
parents:
95464
diff
changeset
|
945 for (i = 0; |
d87a51f8851f
(ftfont_spec_pattern): Accept the registry `ascii-0'.
Kenichi Handa <handa@m17n.org>
parents:
95464
diff
changeset
|
946 FcPatternGetString (pat, FC_FAMILY, i, &fam) == FcResultMatch; |
d87a51f8851f
(ftfont_spec_pattern): Accept the registry `ascii-0'.
Kenichi Handa <handa@m17n.org>
parents:
95464
diff
changeset
|
947 i++) |
d87a51f8851f
(ftfont_spec_pattern): Accept the registry `ascii-0'.
Kenichi Handa <handa@m17n.org>
parents:
95464
diff
changeset
|
948 { |
d87a51f8851f
(ftfont_spec_pattern): Accept the registry `ascii-0'.
Kenichi Handa <handa@m17n.org>
parents:
95464
diff
changeset
|
949 FcPatternDel (pattern, FC_FAMILY); |
d87a51f8851f
(ftfont_spec_pattern): Accept the registry `ascii-0'.
Kenichi Handa <handa@m17n.org>
parents:
95464
diff
changeset
|
950 FcPatternAddString (pattern, FC_FAMILY, fam); |
d87a51f8851f
(ftfont_spec_pattern): Accept the registry `ascii-0'.
Kenichi Handa <handa@m17n.org>
parents:
95464
diff
changeset
|
951 FcFontSetDestroy (fontset); |
d87a51f8851f
(ftfont_spec_pattern): Accept the registry `ascii-0'.
Kenichi Handa <handa@m17n.org>
parents:
95464
diff
changeset
|
952 fontset = FcFontList (NULL, pattern, objset); |
101284
4c2b48d0a379
(ftfont_lookup_cache): Check the return value of FcFontList.
Kenichi Handa <handa@m17n.org>
parents:
100951
diff
changeset
|
953 if (fontset && fontset->nfont > 0) |
95698
d87a51f8851f
(ftfont_spec_pattern): Accept the registry `ascii-0'.
Kenichi Handa <handa@m17n.org>
parents:
95464
diff
changeset
|
954 break; |
d87a51f8851f
(ftfont_spec_pattern): Accept the registry `ascii-0'.
Kenichi Handa <handa@m17n.org>
parents:
95464
diff
changeset
|
955 } |
d87a51f8851f
(ftfont_spec_pattern): Accept the registry `ascii-0'.
Kenichi Handa <handa@m17n.org>
parents:
95464
diff
changeset
|
956 } |
d87a51f8851f
(ftfont_spec_pattern): Accept the registry `ascii-0'.
Kenichi Handa <handa@m17n.org>
parents:
95464
diff
changeset
|
957 } |
d87a51f8851f
(ftfont_spec_pattern): Accept the registry `ascii-0'.
Kenichi Handa <handa@m17n.org>
parents:
95464
diff
changeset
|
958 #endif |
95182
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
959 for (i = 0; i < fontset->nfont; i++) |
90441
d63258b13d84
(Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved to
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
960 { |
95182
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
961 Lisp_Object entity; |
90474
8627c9321afb
(ftfont_pattern_entity): Use the numeric value 100 for
Kenichi Handa <handa@m17n.org>
parents:
90464
diff
changeset
|
962 |
95358
9c54d4f00cf6
(ftfont_spec_pattern): Don't set FC_SPACING to pattern.
Kenichi Handa <handa@m17n.org>
parents:
95229
diff
changeset
|
963 if (spacing >= 0) |
9c54d4f00cf6
(ftfont_spec_pattern): Don't set FC_SPACING to pattern.
Kenichi Handa <handa@m17n.org>
parents:
95229
diff
changeset
|
964 { |
9c54d4f00cf6
(ftfont_spec_pattern): Don't set FC_SPACING to pattern.
Kenichi Handa <handa@m17n.org>
parents:
95229
diff
changeset
|
965 int this; |
9c54d4f00cf6
(ftfont_spec_pattern): Don't set FC_SPACING to pattern.
Kenichi Handa <handa@m17n.org>
parents:
95229
diff
changeset
|
966 |
9c54d4f00cf6
(ftfont_spec_pattern): Don't set FC_SPACING to pattern.
Kenichi Handa <handa@m17n.org>
parents:
95229
diff
changeset
|
967 if ((FcPatternGetInteger (fontset->fonts[i], FC_SPACING, 0, &this) |
9c54d4f00cf6
(ftfont_spec_pattern): Don't set FC_SPACING to pattern.
Kenichi Handa <handa@m17n.org>
parents:
95229
diff
changeset
|
968 == FcResultMatch) |
9c54d4f00cf6
(ftfont_spec_pattern): Don't set FC_SPACING to pattern.
Kenichi Handa <handa@m17n.org>
parents:
95229
diff
changeset
|
969 && spacing != this) |
9c54d4f00cf6
(ftfont_spec_pattern): Don't set FC_SPACING to pattern.
Kenichi Handa <handa@m17n.org>
parents:
95229
diff
changeset
|
970 continue; |
9c54d4f00cf6
(ftfont_spec_pattern): Don't set FC_SPACING to pattern.
Kenichi Handa <handa@m17n.org>
parents:
95229
diff
changeset
|
971 } |
9c54d4f00cf6
(ftfont_spec_pattern): Don't set FC_SPACING to pattern.
Kenichi Handa <handa@m17n.org>
parents:
95229
diff
changeset
|
972 |
90516
43ea66432bf9
(ftfont_list): Pay attention to the case that
Kenichi Handa <handa@m17n.org>
parents:
90514
diff
changeset
|
973 #ifdef FC_CAPABILITY |
95182
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
974 if (otlayout[0]) |
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
975 { |
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
976 FcChar8 *this; |
90510
69dc5ab6d693
(ftfont_list): Handle QCotf property.
Kenichi Handa <handa@m17n.org>
parents:
90500
diff
changeset
|
977 |
97908
464a00cca3cf
(ftfont_spec_pattern): Don't create a charset of the
Kenichi Handa <handa@m17n.org>
parents:
97826
diff
changeset
|
978 if (FcPatternGetString (fontset->fonts[i], FC_CAPABILITY, 0, &this) |
464a00cca3cf
(ftfont_spec_pattern): Don't create a charset of the
Kenichi Handa <handa@m17n.org>
parents:
97826
diff
changeset
|
979 != FcResultMatch |
95182
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
980 || ! strstr ((char *) this, otlayout)) |
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
981 continue; |
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
982 } |
90516
43ea66432bf9
(ftfont_list): Pay attention to the case that
Kenichi Handa <handa@m17n.org>
parents:
90514
diff
changeset
|
983 #endif /* FC_CAPABILITY */ |
91187
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
984 #ifdef HAVE_LIBOTF |
95182
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
985 if (otspec) |
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
986 { |
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
987 FcChar8 *file; |
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
988 OTF *otf; |
91187
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
989 |
95182
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
990 if (FcPatternGetString (fontset->fonts[i], FC_FILE, 0, &file) |
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
991 != FcResultMatch) |
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
992 continue; |
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
993 otf = OTF_open ((char *) file); |
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
994 if (! otf) |
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
995 continue; |
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
996 if (OTF_check_features (otf, 1, |
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
997 otspec->script_tag, otspec->langsys_tag, |
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
998 otspec->features[0], |
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
999 otspec->nfeatures[0]) != 1 |
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
1000 || OTF_check_features (otf, 0, |
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
1001 otspec->script_tag, otspec->langsys_tag, |
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
1002 otspec->features[1], |
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
1003 otspec->nfeatures[1]) != 1) |
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
1004 continue; |
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
1005 } |
91187
96e18e1645a1
(struct OpenTypeSpec): New struct.
Kenichi Handa <handa@m17n.org>
parents:
91162
diff
changeset
|
1006 #endif /* HAVE_LIBOTF */ |
97908
464a00cca3cf
(ftfont_spec_pattern): Don't create a charset of the
Kenichi Handa <handa@m17n.org>
parents:
97826
diff
changeset
|
1007 if (VECTORP (chars)) |
464a00cca3cf
(ftfont_spec_pattern): Don't create a charset of the
Kenichi Handa <handa@m17n.org>
parents:
97826
diff
changeset
|
1008 { |
464a00cca3cf
(ftfont_spec_pattern): Don't create a charset of the
Kenichi Handa <handa@m17n.org>
parents:
97826
diff
changeset
|
1009 int j; |
464a00cca3cf
(ftfont_spec_pattern): Don't create a charset of the
Kenichi Handa <handa@m17n.org>
parents:
97826
diff
changeset
|
1010 |
464a00cca3cf
(ftfont_spec_pattern): Don't create a charset of the
Kenichi Handa <handa@m17n.org>
parents:
97826
diff
changeset
|
1011 if (FcPatternGetCharSet (fontset->fonts[i], FC_CHARSET, 0, &charset) |
464a00cca3cf
(ftfont_spec_pattern): Don't create a charset of the
Kenichi Handa <handa@m17n.org>
parents:
97826
diff
changeset
|
1012 != FcResultMatch) |
464a00cca3cf
(ftfont_spec_pattern): Don't create a charset of the
Kenichi Handa <handa@m17n.org>
parents:
97826
diff
changeset
|
1013 continue; |
464a00cca3cf
(ftfont_spec_pattern): Don't create a charset of the
Kenichi Handa <handa@m17n.org>
parents:
97826
diff
changeset
|
1014 for (j = 0; j < ASIZE (chars); j++) |
464a00cca3cf
(ftfont_spec_pattern): Don't create a charset of the
Kenichi Handa <handa@m17n.org>
parents:
97826
diff
changeset
|
1015 if (NATNUMP (AREF (chars, j)) |
464a00cca3cf
(ftfont_spec_pattern): Don't create a charset of the
Kenichi Handa <handa@m17n.org>
parents:
97826
diff
changeset
|
1016 && FcCharSetHasChar (charset, XFASTINT (AREF (chars, j)))) |
464a00cca3cf
(ftfont_spec_pattern): Don't create a charset of the
Kenichi Handa <handa@m17n.org>
parents:
97826
diff
changeset
|
1017 break; |
464a00cca3cf
(ftfont_spec_pattern): Don't create a charset of the
Kenichi Handa <handa@m17n.org>
parents:
97826
diff
changeset
|
1018 if (j == ASIZE (chars)) |
464a00cca3cf
(ftfont_spec_pattern): Don't create a charset of the
Kenichi Handa <handa@m17n.org>
parents:
97826
diff
changeset
|
1019 continue; |
464a00cca3cf
(ftfont_spec_pattern): Don't create a charset of the
Kenichi Handa <handa@m17n.org>
parents:
97826
diff
changeset
|
1020 } |
103887
427b644c9e3b
(ftfont_spec_pattern): New arg langname. Caller
Kenichi Handa <handa@m17n.org>
parents:
103591
diff
changeset
|
1021 if (! NILP (adstyle) || langname) |
102944
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
1022 { |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
1023 Lisp_Object this_adstyle = get_adstyle_property (fontset->fonts[i]); |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
1024 |
103887
427b644c9e3b
(ftfont_spec_pattern): New arg langname. Caller
Kenichi Handa <handa@m17n.org>
parents:
103591
diff
changeset
|
1025 if (! NILP (adstyle) |
427b644c9e3b
(ftfont_spec_pattern): New arg langname. Caller
Kenichi Handa <handa@m17n.org>
parents:
103591
diff
changeset
|
1026 && (NILP (this_adstyle) |
427b644c9e3b
(ftfont_spec_pattern): New arg langname. Caller
Kenichi Handa <handa@m17n.org>
parents:
103591
diff
changeset
|
1027 || xstrcasecmp (SDATA (SYMBOL_NAME (adstyle)), |
427b644c9e3b
(ftfont_spec_pattern): New arg langname. Caller
Kenichi Handa <handa@m17n.org>
parents:
103591
diff
changeset
|
1028 SDATA (SYMBOL_NAME (this_adstyle))) != 0)) |
427b644c9e3b
(ftfont_spec_pattern): New arg langname. Caller
Kenichi Handa <handa@m17n.org>
parents:
103591
diff
changeset
|
1029 continue; |
427b644c9e3b
(ftfont_spec_pattern): New arg langname. Caller
Kenichi Handa <handa@m17n.org>
parents:
103591
diff
changeset
|
1030 if (langname |
427b644c9e3b
(ftfont_spec_pattern): New arg langname. Caller
Kenichi Handa <handa@m17n.org>
parents:
103591
diff
changeset
|
1031 && ! NILP (this_adstyle) |
427b644c9e3b
(ftfont_spec_pattern): New arg langname. Caller
Kenichi Handa <handa@m17n.org>
parents:
103591
diff
changeset
|
1032 && xstrcasecmp (langname, SDATA (SYMBOL_NAME (this_adstyle)))) |
102944
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
1033 continue; |
44a517fa4d12
(Qja, Qko): New variables.
Kenichi Handa <handa@m17n.org>
parents:
102877
diff
changeset
|
1034 } |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1035 entity = ftfont_pattern_entity (fontset->fonts[i], |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1036 AREF (spec, FONT_EXTRA_INDEX)); |
95182
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
1037 if (! NILP (entity)) |
06ff64b07841
(ftfont_resolve_generic_family): Renamed from
Kenichi Handa <handa@m17n.org>
parents:
95103
diff
changeset
|
1038 val = Fcons (entity, val); |
90400 | 1039 } |
97908
464a00cca3cf
(ftfont_spec_pattern): Don't create a charset of the
Kenichi Handa <handa@m17n.org>
parents:
97826
diff
changeset
|
1040 val = Fnreverse (val); |
90400 | 1041 goto finish; |
1042 | |
1043 err: | |
1044 /* We come here because of unexpected error in fontconfig API call | |
90464
4702b592db4c
(Qmonospace, Qsans_serif, Qserif, Qmono, Qsans)
Kenichi Handa <handa@m17n.org>
parents:
90450
diff
changeset
|
1045 (usually insufficient memory). */ |
90400 | 1046 val = Qnil; |
1047 | |
1048 finish: | |
103546
941b1ddcbe2e
Change font_add_log to FONT_ADD_LOG.
Kenichi Handa <handa@m17n.org>
parents:
103011
diff
changeset
|
1049 FONT_ADD_LOG ("ftfont-list", spec, val); |
90400 | 1050 if (objset) FcObjectSetDestroy (objset); |
1051 if (fontset) FcFontSetDestroy (fontset); | |
1052 if (pattern) FcPatternDestroy (pattern); | |
1053 return val; | |
1054 } | |
1055 | |
1056 static Lisp_Object | |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
1057 ftfont_match (Lisp_Object frame, Lisp_Object spec) |
90565
258e759bcffa
(ftfont_driver): Set ftfont_driver.match to
Kenichi Handa <handa@m17n.org>
parents:
90555
diff
changeset
|
1058 { |
100159
9dae5597651b
(ftfont_match): Initialize entity variable.
Chong Yidong <cyd@stupidchicken.com>
parents:
99108
diff
changeset
|
1059 Lisp_Object entity = Qnil; |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1060 FcPattern *pattern, *match = NULL; |
90565
258e759bcffa
(ftfont_driver): Set ftfont_driver.match to
Kenichi Handa <handa@m17n.org>
parents:
90555
diff
changeset
|
1061 FcResult result; |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1062 char otlayout[15]; /* For "otlayout:XXXX" */ |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1063 struct OpenTypeSpec *otspec = NULL; |
103887
427b644c9e3b
(ftfont_spec_pattern): New arg langname. Caller
Kenichi Handa <handa@m17n.org>
parents:
103591
diff
changeset
|
1064 char *langname = NULL; |
90565
258e759bcffa
(ftfont_driver): Set ftfont_driver.match to
Kenichi Handa <handa@m17n.org>
parents:
90555
diff
changeset
|
1065 |
258e759bcffa
(ftfont_driver): Set ftfont_driver.match to
Kenichi Handa <handa@m17n.org>
parents:
90555
diff
changeset
|
1066 if (! fc_initialized) |
258e759bcffa
(ftfont_driver): Set ftfont_driver.match to
Kenichi Handa <handa@m17n.org>
parents:
90555
diff
changeset
|
1067 { |
258e759bcffa
(ftfont_driver): Set ftfont_driver.match to
Kenichi Handa <handa@m17n.org>
parents:
90555
diff
changeset
|
1068 FcInit (); |
258e759bcffa
(ftfont_driver): Set ftfont_driver.match to
Kenichi Handa <handa@m17n.org>
parents:
90555
diff
changeset
|
1069 fc_initialized = 1; |
258e759bcffa
(ftfont_driver): Set ftfont_driver.match to
Kenichi Handa <handa@m17n.org>
parents:
90555
diff
changeset
|
1070 } |
258e759bcffa
(ftfont_driver): Set ftfont_driver.match to
Kenichi Handa <handa@m17n.org>
parents:
90555
diff
changeset
|
1071 |
103887
427b644c9e3b
(ftfont_spec_pattern): New arg langname. Caller
Kenichi Handa <handa@m17n.org>
parents:
103591
diff
changeset
|
1072 pattern = ftfont_spec_pattern (spec, otlayout, &otspec, &langname); |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1073 if (! pattern) |
90565
258e759bcffa
(ftfont_driver): Set ftfont_driver.match to
Kenichi Handa <handa@m17n.org>
parents:
90555
diff
changeset
|
1074 return Qnil; |
258e759bcffa
(ftfont_driver): Set ftfont_driver.match to
Kenichi Handa <handa@m17n.org>
parents:
90555
diff
changeset
|
1075 |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1076 if (INTEGERP (AREF (spec, FONT_SIZE_INDEX))) |
90565
258e759bcffa
(ftfont_driver): Set ftfont_driver.match to
Kenichi Handa <handa@m17n.org>
parents:
90555
diff
changeset
|
1077 { |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1078 FcValue value; |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1079 |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1080 value.type = FcTypeDouble; |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1081 value.u.d = XINT (AREF (spec, FONT_SIZE_INDEX)); |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1082 FcPatternAdd (pattern, FC_PIXEL_SIZE, value, FcFalse); |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1083 } |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1084 if (FcConfigSubstitute (NULL, pattern, FcMatchPattern) == FcTrue) |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1085 { |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1086 FcDefaultSubstitute (pattern); |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1087 match = FcFontMatch (NULL, pattern, &result); |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1088 if (match) |
92301
c10a8c811515
(ftfont_match): Explicitly set pixelsize in pattern.
Kenichi Handa <handa@m17n.org>
parents:
91870
diff
changeset
|
1089 { |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1090 entity = ftfont_pattern_entity (match, AREF (spec, FONT_EXTRA_INDEX)); |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1091 FcPatternDestroy (match); |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1092 if (! NILP (AREF (spec, FONT_FAMILY_INDEX)) |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1093 && NILP (assq_no_quit (AREF (spec, FONT_FAMILY_INDEX), |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1094 ftfont_generic_family_list)) |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1095 && NILP (Fstring_equal (AREF (spec, FONT_FAMILY_INDEX), |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1096 AREF (entity, FONT_FAMILY_INDEX)))) |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1097 entity = Qnil; |
92301
c10a8c811515
(ftfont_match): Explicitly set pixelsize in pattern.
Kenichi Handa <handa@m17n.org>
parents:
91870
diff
changeset
|
1098 } |
90565
258e759bcffa
(ftfont_driver): Set ftfont_driver.match to
Kenichi Handa <handa@m17n.org>
parents:
90555
diff
changeset
|
1099 } |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1100 FcPatternDestroy (pattern); |
90565
258e759bcffa
(ftfont_driver): Set ftfont_driver.match to
Kenichi Handa <handa@m17n.org>
parents:
90555
diff
changeset
|
1101 |
103546
941b1ddcbe2e
Change font_add_log to FONT_ADD_LOG.
Kenichi Handa <handa@m17n.org>
parents:
103011
diff
changeset
|
1102 FONT_ADD_LOG ("ftfont-match", spec, entity); |
90565
258e759bcffa
(ftfont_driver): Set ftfont_driver.match to
Kenichi Handa <handa@m17n.org>
parents:
90555
diff
changeset
|
1103 return entity; |
258e759bcffa
(ftfont_driver): Set ftfont_driver.match to
Kenichi Handa <handa@m17n.org>
parents:
90555
diff
changeset
|
1104 } |
258e759bcffa
(ftfont_driver): Set ftfont_driver.match to
Kenichi Handa <handa@m17n.org>
parents:
90555
diff
changeset
|
1105 |
258e759bcffa
(ftfont_driver): Set ftfont_driver.match to
Kenichi Handa <handa@m17n.org>
parents:
90555
diff
changeset
|
1106 static Lisp_Object |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
1107 ftfont_list_family (Lisp_Object frame) |
90400 | 1108 { |
100163
88dfb64d3e71
(ftfont_list_family): Initialize list var earlier.
Chong Yidong <cyd@stupidchicken.com>
parents:
100161
diff
changeset
|
1109 Lisp_Object list = Qnil; |
90400 | 1110 FcPattern *pattern = NULL; |
1111 FcFontSet *fontset = NULL; | |
1112 FcObjectSet *objset = NULL; | |
1113 int i; | |
1114 | |
1115 if (! fc_initialized) | |
1116 { | |
1117 FcInit (); | |
1118 fc_initialized = 1; | |
1119 } | |
1120 | |
1121 pattern = FcPatternCreate (); | |
1122 if (! pattern) | |
1123 goto finish; | |
90464
4702b592db4c
(Qmonospace, Qsans_serif, Qserif, Qmono, Qsans)
Kenichi Handa <handa@m17n.org>
parents:
90450
diff
changeset
|
1124 objset = FcObjectSetBuild (FC_FAMILY, NULL); |
90400 | 1125 if (! objset) |
1126 goto finish; | |
1127 fontset = FcFontList (NULL, pattern, objset); | |
1128 if (! fontset) | |
1129 goto finish; | |
1130 | |
1131 for (i = 0; i < fontset->nfont; i++) | |
1132 { | |
1133 FcPattern *pat = fontset->fonts[i]; | |
1134 FcChar8 *str; | |
1135 | |
1136 if (FcPatternGetString (pat, FC_FAMILY, 0, &str) == FcResultMatch) | |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1137 list = Fcons (intern ((char *) str), list); |
90400 | 1138 } |
1139 | |
1140 finish: | |
1141 if (objset) FcObjectSetDestroy (objset); | |
1142 if (fontset) FcFontSetDestroy (fontset); | |
1143 if (pattern) FcPatternDestroy (pattern); | |
1144 | |
1145 return list; | |
1146 } | |
1147 | |
1148 | |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1149 static Lisp_Object |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
1150 ftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) |
90400 | 1151 { |
1152 struct ftfont_info *ftfont_info; | |
1153 struct font *font; | |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1154 struct ftfont_cache_data *cache_data; |
90400 | 1155 FT_Face ft_face; |
1156 FT_Size ft_size; | |
1157 FT_UInt size; | |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1158 Lisp_Object val, filename, index, cache, font_object; |
95103 | 1159 int scalable; |
90400 | 1160 int spacing; |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1161 char name[256]; |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1162 int i, len; |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1163 int upEM; |
90400 | 1164 |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1165 val = assq_no_quit (QCfont_entity, AREF (entity, FONT_EXTRA_INDEX)); |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1166 if (! CONSP (val)) |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1167 return Qnil; |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1168 val = XCDR (val); |
102991
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
1169 cache = ftfont_lookup_cache (entity, FTFONT_CACHE_FOR_FACE); |
95103 | 1170 if (NILP (cache)) |
1171 return Qnil; | |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1172 filename = XCAR (val); |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1173 index = XCDR (val); |
95103 | 1174 val = XCDR (cache); |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1175 cache_data = XSAVE_VALUE (XCDR (cache))->pointer; |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1176 ft_face = cache_data->ft_face; |
95103 | 1177 if (XSAVE_VALUE (val)->integer > 0) |
90400 | 1178 { |
95103 | 1179 /* FT_Face in this cache is already used by the different size. */ |
90400 | 1180 if (FT_New_Size (ft_face, &ft_size) != 0) |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1181 return Qnil; |
90400 | 1182 if (FT_Activate_Size (ft_size) != 0) |
1183 { | |
1184 FT_Done_Size (ft_size); | |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1185 return Qnil; |
90400 | 1186 } |
95103 | 1187 } |
1188 XSAVE_VALUE (val)->integer++; | |
90400 | 1189 size = XINT (AREF (entity, FONT_SIZE_INDEX)); |
1190 if (size == 0) | |
1191 size = pixel_size; | |
1192 if (FT_Set_Pixel_Sizes (ft_face, size, size) != 0) | |
1193 { | |
1194 if (XSAVE_VALUE (val)->integer == 0) | |
1195 FT_Done_Face (ft_face); | |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1196 return Qnil; |
90400 | 1197 } |
1198 | |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1199 font_object = font_make_object (VECSIZE (struct ftfont_info), entity, size); |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1200 ASET (font_object, FONT_TYPE_INDEX, Qfreetype); |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1201 len = font_unparse_xlfd (entity, size, name, 256); |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1202 if (len > 0) |
100552
d8bfaced209a
(ftfont_open): Genarate a multibyte string if given
Kenichi Handa <handa@m17n.org>
parents:
100308
diff
changeset
|
1203 ASET (font_object, FONT_NAME_INDEX, make_string (name, len)); |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1204 len = font_unparse_fcname (entity, size, name, 256); |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1205 if (len > 0) |
100552
d8bfaced209a
(ftfont_open): Genarate a multibyte string if given
Kenichi Handa <handa@m17n.org>
parents:
100308
diff
changeset
|
1206 ASET (font_object, FONT_FULLNAME_INDEX, make_string (name, len)); |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1207 else |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1208 ASET (font_object, FONT_FULLNAME_INDEX, |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1209 AREF (font_object, FONT_NAME_INDEX)); |
95103 | 1210 ASET (font_object, FONT_FILE_INDEX, filename); |
96429
5ee216cdf0e3
(fc_charset_table): New member lang.
Kenichi Handa <handa@m17n.org>
parents:
96076
diff
changeset
|
1211 ASET (font_object, FONT_FORMAT_INDEX, ftfont_font_format (NULL, filename)); |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1212 font = XFONT_OBJECT (font_object); |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1213 ftfont_info = (struct ftfont_info *) font; |
95103 | 1214 ftfont_info->ft_size = ft_face->size; |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1215 ftfont_info->index = XINT (index); |
91162
2b263ef46651
(ftfont_open): Set members maybe_otf and otf of
Kenichi Handa <handa@m17n.org>
parents:
91137
diff
changeset
|
1216 #ifdef HAVE_LIBOTF |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1217 ftfont_info->maybe_otf = ft_face->face_flags & FT_FACE_FLAG_SFNT; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1218 ftfont_info->otf = NULL; |
91162
2b263ef46651
(ftfont_open): Set members maybe_otf and otf of
Kenichi Handa <handa@m17n.org>
parents:
91137
diff
changeset
|
1219 #endif /* HAVE_LIBOTF */ |
106539
e5416066efd1
(struct ftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106085
diff
changeset
|
1220 /* This means that there's no need of transformation. */ |
e5416066efd1
(struct ftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106085
diff
changeset
|
1221 ftfont_info->matrix.xx = 0; |
90400 | 1222 font->pixel_size = size; |
1223 font->driver = &ftfont_driver; | |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1224 font->encoding_charset = font->repertory_charset = -1; |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1225 |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1226 upEM = ft_face->units_per_EM; |
95103 | 1227 scalable = (INTEGERP (AREF (entity, FONT_AVGWIDTH_INDEX)) |
1228 && XINT (AREF (entity, FONT_AVGWIDTH_INDEX)) == 0); | |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1229 if (scalable) |
90555
45553626fa76
(ftfont_open): Set font->font.full_name and
Kenichi Handa <handa@m17n.org>
parents:
90524
diff
changeset
|
1230 { |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1231 font->ascent = ft_face->ascender * size / upEM; |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1232 font->descent = - ft_face->descender * size / upEM; |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1233 font->height = ft_face->height * size / upEM; |
90555
45553626fa76
(ftfont_open): Set font->font.full_name and
Kenichi Handa <handa@m17n.org>
parents:
90524
diff
changeset
|
1234 } |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1235 else |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1236 { |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1237 font->ascent = ft_face->size->metrics.ascender >> 6; |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1238 font->descent = - ft_face->size->metrics.descender >> 6; |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1239 font->height = ft_face->size->metrics.height >> 6; |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1240 } |
95103 | 1241 if (INTEGERP (AREF (entity, FONT_SPACING_INDEX))) |
1242 spacing = XINT (AREF (entity, FONT_SPACING_INDEX)); | |
1243 else | |
90555
45553626fa76
(ftfont_open): Set font->font.full_name and
Kenichi Handa <handa@m17n.org>
parents:
90524
diff
changeset
|
1244 spacing = FC_PROPORTIONAL; |
109081
bcae1f83a33e
Check FC_DUAL too. For such fonts, check width one by one.
Kenichi Handa <handa@etlken>
parents:
108493
diff
changeset
|
1245 if (spacing != FC_PROPORTIONAL && spacing != FC_DUAL) |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1246 font->min_width = font->average_width = font->space_width |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1247 = (scalable ? ft_face->max_advance_width * size / upEM |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1248 : ft_face->size->metrics.max_advance >> 6); |
90400 | 1249 else |
1250 { | |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1251 int n; |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1252 |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1253 font->min_width = font->average_width = font->space_width = 0; |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1254 for (i = 32, n = 0; i < 127; i++) |
102859
c8428ec4532f
(ftfont_open): Fix checking of the return value of
Kenichi Handa <handa@m17n.org>
parents:
102791
diff
changeset
|
1255 if (FT_Load_Char (ft_face, i, FT_LOAD_DEFAULT) == 0) |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1256 { |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1257 int this_width = ft_face->glyph->metrics.horiAdvance >> 6; |
90400 | 1258 |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1259 if (this_width > 0 |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1260 && (! font->min_width || font->min_width > this_width)) |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1261 font->min_width = this_width; |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1262 if (i == 32) |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1263 font->space_width = this_width; |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1264 font->average_width += this_width; |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1265 n++; |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1266 } |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1267 if (n > 0) |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1268 font->average_width /= n; |
90400 | 1269 } |
1270 | |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1271 font->baseline_offset = 0; |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1272 font->relative_compose = 0; |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1273 font->default_ascent = 0; |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1274 font->vertical_centering = 0; |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1275 if (scalable) |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1276 { |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1277 font->underline_position = -ft_face->underline_position * size / upEM; |
102859
c8428ec4532f
(ftfont_open): Fix checking of the return value of
Kenichi Handa <handa@m17n.org>
parents:
102791
diff
changeset
|
1278 font->underline_thickness = ft_face->underline_thickness * size / upEM; |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1279 } |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1280 else |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1281 { |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1282 font->underline_position = -1; |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1283 font->underline_thickness = 0; |
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1284 } |
90555
45553626fa76
(ftfont_open): Set font->font.full_name and
Kenichi Handa <handa@m17n.org>
parents:
90524
diff
changeset
|
1285 |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1286 return font_object; |
90400 | 1287 } |
1288 | |
1289 static void | |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
1290 ftfont_close (FRAME_PTR f, struct font *font) |
90400 | 1291 { |
1292 struct ftfont_info *ftfont_info = (struct ftfont_info *) font; | |
95103 | 1293 Lisp_Object val, cache; |
90400 | 1294 |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1295 val = Fcons (font->props[FONT_FILE_INDEX], make_number (ftfont_info->index)); |
102991
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
1296 cache = ftfont_lookup_cache (val, FTFONT_CACHE_FOR_FACE); |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1297 xassert (CONSP (cache)); |
95103 | 1298 val = XCDR (cache); |
90400 | 1299 (XSAVE_VALUE (val)->integer)--; |
1300 if (XSAVE_VALUE (val)->integer == 0) | |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1301 { |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1302 struct ftfont_cache_data *cache_data = XSAVE_VALUE (val)->pointer; |
95103 | 1303 |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1304 FT_Done_Face (cache_data->ft_face); |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1305 #ifdef HAVE_LIBOTF |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1306 if (ftfont_info->otf) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1307 OTF_close (ftfont_info->otf); |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1308 #endif |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1309 cache_data->ft_face = NULL; |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1310 } |
90400 | 1311 else |
1312 FT_Done_Size (ftfont_info->ft_size); | |
1313 } | |
1314 | |
95464
de4cb7ab40db
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
95433
diff
changeset
|
1315 static int |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
1316 ftfont_has_char (Lisp_Object font, int c) |
90400 | 1317 { |
102991
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
1318 struct charset *cs = NULL; |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
1319 |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
1320 if (EQ (AREF (font, FONT_ADSTYLE_INDEX), Qja) |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
1321 && charset_jisx0208 >= 0) |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
1322 cs = CHARSET_FROM_ID (charset_jisx0208); |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
1323 else if (EQ (AREF (font, FONT_ADSTYLE_INDEX), Qko) |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
1324 && charset_ksc5601 >= 0) |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
1325 cs = CHARSET_FROM_ID (charset_ksc5601); |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
1326 if (cs) |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
1327 return (ENCODE_CHAR (cs, c) != CHARSET_INVALID_CODE (cs)); |
18e317a87f12
(Qja, Qko): Don't make them static.
Kenichi Handa <handa@m17n.org>
parents:
102945
diff
changeset
|
1328 |
101556
7f8b5730cfa5
(ftfont_has_char): If the arg FONT is a font-object,
Kenichi Handa <handa@m17n.org>
parents:
101284
diff
changeset
|
1329 if (FONT_ENTITY_P (font)) |
7f8b5730cfa5
(ftfont_has_char): If the arg FONT is a font-object,
Kenichi Handa <handa@m17n.org>
parents:
101284
diff
changeset
|
1330 { |
7f8b5730cfa5
(ftfont_has_char): If the arg FONT is a font-object,
Kenichi Handa <handa@m17n.org>
parents:
101284
diff
changeset
|
1331 FcCharSet *charset = ftfont_get_fc_charset (font); |
90400 | 1332 |
101556
7f8b5730cfa5
(ftfont_has_char): If the arg FONT is a font-object,
Kenichi Handa <handa@m17n.org>
parents:
101284
diff
changeset
|
1333 return (FcCharSetHasChar (charset, c) == FcTrue); |
7f8b5730cfa5
(ftfont_has_char): If the arg FONT is a font-object,
Kenichi Handa <handa@m17n.org>
parents:
101284
diff
changeset
|
1334 } |
7f8b5730cfa5
(ftfont_has_char): If the arg FONT is a font-object,
Kenichi Handa <handa@m17n.org>
parents:
101284
diff
changeset
|
1335 else |
7f8b5730cfa5
(ftfont_has_char): If the arg FONT is a font-object,
Kenichi Handa <handa@m17n.org>
parents:
101284
diff
changeset
|
1336 { |
7f8b5730cfa5
(ftfont_has_char): If the arg FONT is a font-object,
Kenichi Handa <handa@m17n.org>
parents:
101284
diff
changeset
|
1337 struct ftfont_info *ftfont_info; |
7f8b5730cfa5
(ftfont_has_char): If the arg FONT is a font-object,
Kenichi Handa <handa@m17n.org>
parents:
101284
diff
changeset
|
1338 |
7f8b5730cfa5
(ftfont_has_char): If the arg FONT is a font-object,
Kenichi Handa <handa@m17n.org>
parents:
101284
diff
changeset
|
1339 ftfont_info = (struct ftfont_info *) XFONT_OBJECT (font); |
7f8b5730cfa5
(ftfont_has_char): If the arg FONT is a font-object,
Kenichi Handa <handa@m17n.org>
parents:
101284
diff
changeset
|
1340 return (FT_Get_Char_Index (ftfont_info->ft_size->face, (FT_ULong) c) |
7f8b5730cfa5
(ftfont_has_char): If the arg FONT is a font-object,
Kenichi Handa <handa@m17n.org>
parents:
101284
diff
changeset
|
1341 != 0); |
7f8b5730cfa5
(ftfont_has_char): If the arg FONT is a font-object,
Kenichi Handa <handa@m17n.org>
parents:
101284
diff
changeset
|
1342 } |
90400 | 1343 } |
1344 | |
1345 static unsigned | |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
1346 ftfont_encode_char (struct font *font, int c) |
90400 | 1347 { |
1348 struct ftfont_info *ftfont_info = (struct ftfont_info *) font; | |
1349 FT_Face ft_face = ftfont_info->ft_size->face; | |
1350 FT_ULong charcode = c; | |
1351 FT_UInt code = FT_Get_Char_Index (ft_face, charcode); | |
1352 | |
91271
fed5211f4809
(ftfont_encode_char): Use the macro FONT_INVALID_CODE.
Kenichi Handa <handa@m17n.org>
parents:
91249
diff
changeset
|
1353 return (code > 0 ? code : FONT_INVALID_CODE); |
90400 | 1354 } |
1355 | |
1356 static int | |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
1357 ftfont_text_extents (struct font *font, unsigned int *code, int nglyphs, struct font_metrics *metrics) |
90400 | 1358 { |
1359 struct ftfont_info *ftfont_info = (struct ftfont_info *) font; | |
1360 FT_Face ft_face = ftfont_info->ft_size->face; | |
1361 int width = 0; | |
96568
ff2262b8b0f2
(ftfont_text_extents): Fix initial setting of metrics.
Kenichi Handa <handa@m17n.org>
parents:
96561
diff
changeset
|
1362 int i, first; |
90400 | 1363 |
1364 if (ftfont_info->ft_size != ft_face->size) | |
1365 FT_Activate_Size (ftfont_info->ft_size); | |
1366 if (metrics) | |
109165
750db9f3e6d8
Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
Andreas Schwab <schwab@linux-m68k.org>
parents:
109126
diff
changeset
|
1367 memset (metrics, 0, sizeof (struct font_metrics)); |
96568
ff2262b8b0f2
(ftfont_text_extents): Fix initial setting of metrics.
Kenichi Handa <handa@m17n.org>
parents:
96561
diff
changeset
|
1368 for (i = 0, first = 1; i < nglyphs; i++) |
90400 | 1369 { |
1370 if (FT_Load_Glyph (ft_face, code[i], FT_LOAD_DEFAULT) == 0) | |
1371 { | |
1372 FT_Glyph_Metrics *m = &ft_face->glyph->metrics; | |
1373 | |
96568
ff2262b8b0f2
(ftfont_text_extents): Fix initial setting of metrics.
Kenichi Handa <handa@m17n.org>
parents:
96561
diff
changeset
|
1374 if (first) |
ff2262b8b0f2
(ftfont_text_extents): Fix initial setting of metrics.
Kenichi Handa <handa@m17n.org>
parents:
96561
diff
changeset
|
1375 { |
ff2262b8b0f2
(ftfont_text_extents): Fix initial setting of metrics.
Kenichi Handa <handa@m17n.org>
parents:
96561
diff
changeset
|
1376 if (metrics) |
ff2262b8b0f2
(ftfont_text_extents): Fix initial setting of metrics.
Kenichi Handa <handa@m17n.org>
parents:
96561
diff
changeset
|
1377 { |
ff2262b8b0f2
(ftfont_text_extents): Fix initial setting of metrics.
Kenichi Handa <handa@m17n.org>
parents:
96561
diff
changeset
|
1378 metrics->lbearing = m->horiBearingX >> 6; |
ff2262b8b0f2
(ftfont_text_extents): Fix initial setting of metrics.
Kenichi Handa <handa@m17n.org>
parents:
96561
diff
changeset
|
1379 metrics->rbearing = (m->horiBearingX + m->width) >> 6; |
ff2262b8b0f2
(ftfont_text_extents): Fix initial setting of metrics.
Kenichi Handa <handa@m17n.org>
parents:
96561
diff
changeset
|
1380 metrics->ascent = m->horiBearingY >> 6; |
102877
3f976a2deab1
(ftfont_text_extents): Fix calculation of metrics->descent.
Kenichi Handa <handa@m17n.org>
parents:
102859
diff
changeset
|
1381 metrics->descent = (m->height - m->horiBearingY) >> 6; |
96568
ff2262b8b0f2
(ftfont_text_extents): Fix initial setting of metrics.
Kenichi Handa <handa@m17n.org>
parents:
96561
diff
changeset
|
1382 } |
ff2262b8b0f2
(ftfont_text_extents): Fix initial setting of metrics.
Kenichi Handa <handa@m17n.org>
parents:
96561
diff
changeset
|
1383 first = 0; |
ff2262b8b0f2
(ftfont_text_extents): Fix initial setting of metrics.
Kenichi Handa <handa@m17n.org>
parents:
96561
diff
changeset
|
1384 } |
90400 | 1385 if (metrics) |
1386 { | |
1387 if (metrics->lbearing > width + (m->horiBearingX >> 6)) | |
1388 metrics->lbearing = width + (m->horiBearingX >> 6); | |
1389 if (metrics->rbearing | |
1390 < width + ((m->horiBearingX + m->width) >> 6)) | |
1391 metrics->rbearing | |
1392 = width + ((m->horiBearingX + m->width) >> 6); | |
1393 if (metrics->ascent < (m->horiBearingY >> 6)) | |
1394 metrics->ascent = m->horiBearingY >> 6; | |
102877
3f976a2deab1
(ftfont_text_extents): Fix calculation of metrics->descent.
Kenichi Handa <handa@m17n.org>
parents:
102859
diff
changeset
|
1395 if (metrics->descent > ((m->height - m->horiBearingY) >> 6)) |
3f976a2deab1
(ftfont_text_extents): Fix calculation of metrics->descent.
Kenichi Handa <handa@m17n.org>
parents:
102859
diff
changeset
|
1396 metrics->descent = (m->height - m->horiBearingY) >> 6; |
90400 | 1397 } |
1398 width += m->horiAdvance >> 6; | |
1399 } | |
1400 else | |
1401 { | |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1402 width += font->space_width; |
90400 | 1403 } |
1404 } | |
1405 if (metrics) | |
1406 metrics->width = width; | |
1407 | |
1408 return width; | |
1409 } | |
1410 | |
1411 static int | |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
1412 ftfont_get_bitmap (struct font *font, unsigned int code, struct font_bitmap *bitmap, int bits_per_pixel) |
90400 | 1413 { |
1414 struct ftfont_info *ftfont_info = (struct ftfont_info *) font; | |
1415 FT_Face ft_face = ftfont_info->ft_size->face; | |
1416 FT_Int32 load_flags = FT_LOAD_RENDER; | |
1417 | |
1418 if (ftfont_info->ft_size != ft_face->size) | |
1419 FT_Activate_Size (ftfont_info->ft_size); | |
1420 if (bits_per_pixel == 1) | |
1421 { | |
1422 #ifdef FT_LOAD_TARGET_MONO | |
1423 load_flags |= FT_LOAD_TARGET_MONO; | |
1424 #else | |
1425 load_flags |= FT_LOAD_MONOCHROME; | |
1426 #endif | |
1427 } | |
1428 else if (bits_per_pixel != 8) | |
1429 /* We don't support such a rendering. */ | |
1430 return -1; | |
1431 | |
1432 if (FT_Load_Glyph (ft_face, code, load_flags) != 0) | |
1433 return -1; | |
91108
6da57551efb7
(ftfont_get_bitmap): Set bitmap->bits_per_pixel.
Kenichi Handa <handa@m17n.org>
parents:
90963
diff
changeset
|
1434 bitmap->bits_per_pixel |
6da57551efb7
(ftfont_get_bitmap): Set bitmap->bits_per_pixel.
Kenichi Handa <handa@m17n.org>
parents:
90963
diff
changeset
|
1435 = (ft_face->glyph->bitmap.pixel_mode == FT_PIXEL_MODE_MONO ? 1 |
6da57551efb7
(ftfont_get_bitmap): Set bitmap->bits_per_pixel.
Kenichi Handa <handa@m17n.org>
parents:
90963
diff
changeset
|
1436 : ft_face->glyph->bitmap.pixel_mode == FT_PIXEL_MODE_GRAY ? 8 |
6da57551efb7
(ftfont_get_bitmap): Set bitmap->bits_per_pixel.
Kenichi Handa <handa@m17n.org>
parents:
90963
diff
changeset
|
1437 : ft_face->glyph->bitmap.pixel_mode == FT_PIXEL_MODE_LCD ? 8 |
6da57551efb7
(ftfont_get_bitmap): Set bitmap->bits_per_pixel.
Kenichi Handa <handa@m17n.org>
parents:
90963
diff
changeset
|
1438 : ft_face->glyph->bitmap.pixel_mode == FT_PIXEL_MODE_LCD_V ? 8 |
6da57551efb7
(ftfont_get_bitmap): Set bitmap->bits_per_pixel.
Kenichi Handa <handa@m17n.org>
parents:
90963
diff
changeset
|
1439 : -1); |
6da57551efb7
(ftfont_get_bitmap): Set bitmap->bits_per_pixel.
Kenichi Handa <handa@m17n.org>
parents:
90963
diff
changeset
|
1440 if (bitmap->bits_per_pixel < 0) |
6da57551efb7
(ftfont_get_bitmap): Set bitmap->bits_per_pixel.
Kenichi Handa <handa@m17n.org>
parents:
90963
diff
changeset
|
1441 /* We don't suport that kind of pixel mode. */ |
6da57551efb7
(ftfont_get_bitmap): Set bitmap->bits_per_pixel.
Kenichi Handa <handa@m17n.org>
parents:
90963
diff
changeset
|
1442 return -1; |
90400 | 1443 bitmap->rows = ft_face->glyph->bitmap.rows; |
1444 bitmap->width = ft_face->glyph->bitmap.width; | |
1445 bitmap->pitch = ft_face->glyph->bitmap.pitch; | |
1446 bitmap->buffer = ft_face->glyph->bitmap.buffer; | |
1447 bitmap->left = ft_face->glyph->bitmap_left; | |
1448 bitmap->top = ft_face->glyph->bitmap_top; | |
1449 bitmap->advance = ft_face->glyph->metrics.horiAdvance >> 6; | |
1450 bitmap->extra = NULL; | |
1451 | |
1452 return 0; | |
1453 } | |
1454 | |
1455 static int | |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
1456 ftfont_anchor_point (struct font *font, unsigned int code, int index, int *x, int *y) |
90400 | 1457 { |
1458 struct ftfont_info *ftfont_info = (struct ftfont_info *) font; | |
1459 FT_Face ft_face = ftfont_info->ft_size->face; | |
1460 | |
1461 if (ftfont_info->ft_size != ft_face->size) | |
1462 FT_Activate_Size (ftfont_info->ft_size); | |
1463 if (FT_Load_Glyph (ft_face, code, FT_LOAD_DEFAULT) != 0) | |
1464 return -1; | |
1465 if (ft_face->glyph->format != FT_GLYPH_FORMAT_OUTLINE) | |
1466 return -1; | |
1467 if (index >= ft_face->glyph->outline.n_points) | |
1468 return -1; | |
1469 *x = ft_face->glyph->outline.points[index].x; | |
1470 *y = ft_face->glyph->outline.points[index].y; | |
1471 return 0; | |
1472 } | |
1473 | |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1474 #ifdef HAVE_LIBOTF |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1475 |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1476 static Lisp_Object |
109364
89a16701cde1
Convert old-style definitions
Andreas Schwab <schwab@linux-m68k.org>
parents:
109165
diff
changeset
|
1477 ftfont_otf_features (OTF_GSUB_GPOS *gsub_gpos) |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1478 { |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1479 Lisp_Object scripts, langsyses, features, sym; |
98787
22ff4ff011f4
(ftfont_otf_features): Fix indexing
Kenichi Handa <handa@m17n.org>
parents:
98656
diff
changeset
|
1480 int i, j, k, l; |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1481 |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1482 for (scripts = Qnil, i = gsub_gpos->ScriptList.ScriptCount - 1; i >= 0; i--) |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1483 { |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1484 OTF_Script *otf_script = gsub_gpos->ScriptList.Script + i; |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1485 |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1486 for (langsyses = Qnil, j = otf_script->LangSysCount - 1; j >= -1; j--) |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1487 { |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1488 OTF_LangSys *otf_langsys; |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1489 |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1490 if (j >= 0) |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1491 otf_langsys = otf_script->LangSys + j; |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1492 else if (otf_script->DefaultLangSysOffset) |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1493 otf_langsys = &otf_script->DefaultLangSys; |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1494 else |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1495 break; |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1496 |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1497 for (features = Qnil, k = otf_langsys->FeatureCount - 1; k >= 0; k--) |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1498 { |
98787
22ff4ff011f4
(ftfont_otf_features): Fix indexing
Kenichi Handa <handa@m17n.org>
parents:
98656
diff
changeset
|
1499 l = otf_langsys->FeatureIndex[k]; |
99108
411ea0d5dade
(ftfont_otf_features): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
98787
diff
changeset
|
1500 if (l >= gsub_gpos->FeatureList.FeatureCount) |
98787
22ff4ff011f4
(ftfont_otf_features): Fix indexing
Kenichi Handa <handa@m17n.org>
parents:
98656
diff
changeset
|
1501 continue; |
22ff4ff011f4
(ftfont_otf_features): Fix indexing
Kenichi Handa <handa@m17n.org>
parents:
98656
diff
changeset
|
1502 OTF_TAG_SYM (sym, gsub_gpos->FeatureList.Feature[l].FeatureTag); |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1503 features = Fcons (sym, features); |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1504 } |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1505 if (j >= 0) |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1506 OTF_TAG_SYM (sym, otf_script->LangSysRecord[j].LangSysTag); |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1507 else |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1508 sym = Qnil; |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1509 langsyses = Fcons (Fcons (sym, features), langsyses); |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1510 } |
101943
97c9e9322753
Remove spurious semicolons.
Juanma Barranquero <lekktu@gmail.com>
parents:
101556
diff
changeset
|
1511 |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1512 OTF_TAG_SYM (sym, gsub_gpos->ScriptList.Script[i].ScriptTag); |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1513 scripts = Fcons (Fcons (sym, langsyses), scripts); |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1514 } |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1515 return scripts; |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1516 |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1517 } |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1518 |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1519 |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1520 static Lisp_Object |
109364
89a16701cde1
Convert old-style definitions
Andreas Schwab <schwab@linux-m68k.org>
parents:
109165
diff
changeset
|
1521 ftfont_otf_capability (struct font *font) |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1522 { |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1523 struct ftfont_info *ftfont_info = (struct ftfont_info *) font; |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1524 OTF *otf = ftfont_get_otf (ftfont_info); |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1525 Lisp_Object gsub_gpos; |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1526 |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1527 if (! otf) |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1528 return Qnil; |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1529 gsub_gpos = Fcons (Qnil, Qnil); |
99108
411ea0d5dade
(ftfont_otf_features): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
98787
diff
changeset
|
1530 if (OTF_get_table (otf, "GSUB") == 0 |
411ea0d5dade
(ftfont_otf_features): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
98787
diff
changeset
|
1531 && otf->gsub->FeatureList.FeatureCount > 0) |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1532 XSETCAR (gsub_gpos, ftfont_otf_features (otf->gsub)); |
99108
411ea0d5dade
(ftfont_otf_features): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
98787
diff
changeset
|
1533 if (OTF_get_table (otf, "GPOS") == 0 |
411ea0d5dade
(ftfont_otf_features): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
98787
diff
changeset
|
1534 && otf->gpos->FeatureList.FeatureCount > 0) |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1535 XSETCDR (gsub_gpos, ftfont_otf_features (otf->gpos)); |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1536 return gsub_gpos; |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1537 } |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
1538 |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1539 #ifdef HAVE_M17N_FLT |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1540 |
108493
e5f3704cf67a
ftfont.c: Fix incorrect parentheses of #if condition for definining M17N_FLT_USE_NEW_FEATURE.
Kenichi Handa <handa@etlken>
parents:
108347
diff
changeset
|
1541 #if (((LIBOTF_MAJOR_VERSION > 1) || (LIBOTF_RELEASE_NUMBER >= 10)) \ |
e5f3704cf67a
ftfont.c: Fix incorrect parentheses of #if condition for definining M17N_FLT_USE_NEW_FEATURE.
Kenichi Handa <handa@etlken>
parents:
108347
diff
changeset
|
1542 && ((M17NLIB_MAJOR_VERSION > 1) || (M17NLIB_MINOR_VERSION >= 6))) |
108347
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1543 /* We can use the new feature of libotf and m17n-flt to handle the |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1544 character encoding scheme introduced in Unicode 5.1 and 5.2 for |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1545 some Agian scripts. */ |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1546 #define M17N_FLT_USE_NEW_FEATURE |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1547 #endif |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1548 |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1549 struct MFLTFontFT |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1550 { |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1551 MFLTFont flt_font; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1552 struct font *font; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1553 FT_Face ft_face; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1554 OTF *otf; |
106539
e5416066efd1
(struct ftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106085
diff
changeset
|
1555 FT_Matrix *matrix; |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1556 }; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1557 |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1558 static int |
109364
89a16701cde1
Convert old-style definitions
Andreas Schwab <schwab@linux-m68k.org>
parents:
109165
diff
changeset
|
1559 ftfont_get_glyph_id (MFLTFont *font, MFLTGlyphString *gstring, |
89a16701cde1
Convert old-style definitions
Andreas Schwab <schwab@linux-m68k.org>
parents:
109165
diff
changeset
|
1560 int from, int to) |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1561 { |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1562 struct MFLTFontFT *flt_font_ft = (struct MFLTFontFT *) font; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1563 FT_Face ft_face = flt_font_ft->ft_face; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1564 MFLTGlyph *g; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1565 |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1566 for (g = gstring->glyphs + from; from < to; g++, from++) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1567 if (! g->encoded) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1568 { |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1569 FT_UInt code = FT_Get_Char_Index (ft_face, g->code); |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1570 |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1571 g->code = code > 0 ? code : FONT_INVALID_CODE; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1572 g->encoded = 1; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1573 } |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1574 return 0; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1575 } |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1576 |
106539
e5416066efd1
(struct ftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106085
diff
changeset
|
1577 /* Operators for 26.6 fixed fractional pixel format */ |
e5416066efd1
(struct ftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106085
diff
changeset
|
1578 |
e5416066efd1
(struct ftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106085
diff
changeset
|
1579 #define FLOOR(x) ((x) & -64) |
e5416066efd1
(struct ftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106085
diff
changeset
|
1580 #define CEIL(x) (((x)+63) & -64) |
e5416066efd1
(struct ftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106085
diff
changeset
|
1581 #define ROUND(x) (((x)+32) & -64) |
e5416066efd1
(struct ftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106085
diff
changeset
|
1582 |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1583 static int |
109364
89a16701cde1
Convert old-style definitions
Andreas Schwab <schwab@linux-m68k.org>
parents:
109165
diff
changeset
|
1584 ftfont_get_metrics (MFLTFont *font, MFLTGlyphString *gstring, |
89a16701cde1
Convert old-style definitions
Andreas Schwab <schwab@linux-m68k.org>
parents:
109165
diff
changeset
|
1585 int from, int to) |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1586 { |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1587 struct MFLTFontFT *flt_font_ft = (struct MFLTFontFT *) font; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1588 FT_Face ft_face = flt_font_ft->ft_face; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1589 MFLTGlyph *g; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1590 |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1591 for (g = gstring->glyphs + from; from < to; g++, from++) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1592 if (! g->measured) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1593 { |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1594 if (g->code != FONT_INVALID_CODE) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1595 { |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1596 FT_Glyph_Metrics *m; |
106539
e5416066efd1
(struct ftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106085
diff
changeset
|
1597 int lbearing, rbearing, ascent, descent, xadv; |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1598 |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1599 if (FT_Load_Glyph (ft_face, g->code, FT_LOAD_DEFAULT) != 0) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1600 abort (); |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1601 m = &ft_face->glyph->metrics; |
106539
e5416066efd1
(struct ftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106085
diff
changeset
|
1602 if (flt_font_ft->matrix) |
e5416066efd1
(struct ftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106085
diff
changeset
|
1603 { |
e5416066efd1
(struct ftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106085
diff
changeset
|
1604 FT_Vector v[4]; |
e5416066efd1
(struct ftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106085
diff
changeset
|
1605 int i; |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1606 |
106539
e5416066efd1
(struct ftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106085
diff
changeset
|
1607 v[0].x = v[1].x = m->horiBearingX; |
e5416066efd1
(struct ftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106085
diff
changeset
|
1608 v[2].x = v[3].x = m->horiBearingX + m->width; |
e5416066efd1
(struct ftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106085
diff
changeset
|
1609 v[0].y = v[2].y = m->horiBearingY; |
e5416066efd1
(struct ftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106085
diff
changeset
|
1610 v[1].y = v[3].y = m->horiBearingY - m->height; |
e5416066efd1
(struct ftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106085
diff
changeset
|
1611 for (i = 0; i < 4; i++) |
e5416066efd1
(struct ftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106085
diff
changeset
|
1612 FT_Vector_Transform (v + i, flt_font_ft->matrix); |
e5416066efd1
(struct ftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106085
diff
changeset
|
1613 g->lbearing = v[0].x < v[1].x ? FLOOR (v[0].x) : FLOOR (v[1].x); |
e5416066efd1
(struct ftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106085
diff
changeset
|
1614 g->rbearing = v[2].x > v[3].x ? CEIL (v[2].x) : CEIL (v[3].x); |
e5416066efd1
(struct ftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106085
diff
changeset
|
1615 g->ascent = v[0].y > v[2].y ? CEIL (v[0].y) : CEIL (v[2].y); |
e5416066efd1
(struct ftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106085
diff
changeset
|
1616 g->descent = v[1].y < v[3].y ? - FLOOR (v[1].y) : - FLOOR (v[3].y); |
e5416066efd1
(struct ftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106085
diff
changeset
|
1617 } |
e5416066efd1
(struct ftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106085
diff
changeset
|
1618 else |
e5416066efd1
(struct ftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106085
diff
changeset
|
1619 { |
e5416066efd1
(struct ftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106085
diff
changeset
|
1620 g->lbearing = FLOOR (m->horiBearingX); |
e5416066efd1
(struct ftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106085
diff
changeset
|
1621 g->rbearing = CEIL (m->horiBearingX + m->width); |
e5416066efd1
(struct ftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106085
diff
changeset
|
1622 g->ascent = CEIL (m->horiBearingY); |
e5416066efd1
(struct ftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106085
diff
changeset
|
1623 g->descent = - FLOOR (m->horiBearingY - m->height); |
e5416066efd1
(struct ftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106085
diff
changeset
|
1624 } |
e5416066efd1
(struct ftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106085
diff
changeset
|
1625 g->xadv = ROUND (ft_face->glyph->advance.x); |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1626 } |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1627 else |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1628 { |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1629 g->lbearing = 0; |
94931
37f386db63ed
(ftfont_pattern_entity): Argument FRAME removed. Make
Kenichi Handa <handa@m17n.org>
parents:
93588
diff
changeset
|
1630 g->rbearing = g->xadv = flt_font_ft->font->space_width << 6; |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1631 g->ascent = flt_font_ft->font->ascent << 6; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1632 g->descent = flt_font_ft->font->descent << 6; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1633 } |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1634 g->yadv = 0; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1635 g->measured = 1; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1636 } |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1637 return 0; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1638 } |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1639 |
95464
de4cb7ab40db
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
95433
diff
changeset
|
1640 static int |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1641 ftfont_check_otf (MFLTFont *font, MFLTOtfSpec *spec) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1642 { |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1643 struct MFLTFontFT *flt_font_ft = (struct MFLTFontFT *) font; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1644 OTF *otf = flt_font_ft->otf; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1645 OTF_Tag *tags; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1646 int i, n, negative; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1647 |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1648 for (i = 0; i < 2; i++) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1649 { |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1650 if (! spec->features[i]) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1651 continue; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1652 for (n = 0; spec->features[i][n]; n++); |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1653 tags = alloca (sizeof (OTF_Tag) * n); |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1654 for (n = 0, negative = 0; spec->features[i][n]; n++) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1655 { |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1656 if (spec->features[i][n] == 0xFFFFFFFF) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1657 negative = 1; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1658 else if (negative) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1659 tags[n - 1] = spec->features[i][n] | 0x80000000; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1660 else |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1661 tags[n] = spec->features[i][n]; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1662 } |
108347
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1663 #ifdef M17N_FLT_USE_NEW_FEATURE |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1664 if (OTF_check_features (otf, i == 0, spec->script, spec->langsys, |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1665 tags, n - negative) != 1) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1666 return 0; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1667 #else /* not M17N_FLT_USE_NEW_FEATURE */ |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1668 if (n - negative > 0 |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1669 && OTF_check_features (otf, i == 0, spec->script, spec->langsys, |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1670 tags, n - negative) != 1) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1671 return 0; |
108347
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1672 #endif /* not M17N_FLT_USE_NEW_FEATURE */ |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1673 } |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1674 return 1; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1675 } |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1676 |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1677 #define DEVICE_DELTA(table, size) \ |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1678 (((size) >= (table).StartSize && (size) <= (table).EndSize) \ |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1679 ? (table).DeltaValue[(size) - (table).StartSize] << 6 \ |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1680 : 0) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1681 |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1682 static void |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1683 adjust_anchor (FT_Face ft_face, OTF_Anchor *anchor, |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1684 unsigned code, int x_ppem, int y_ppem, int *x, int *y) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1685 { |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1686 if (anchor->AnchorFormat == 2) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1687 { |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1688 FT_Outline *outline; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1689 int ap = anchor->f.f1.AnchorPoint; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1690 |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1691 FT_Load_Glyph (ft_face, (FT_UInt) code, FT_LOAD_MONOCHROME); |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1692 outline = &ft_face->glyph->outline; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1693 if (ap < outline->n_points) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1694 { |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1695 *x = outline->points[ap].x << 6; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1696 *y = outline->points[ap].y << 6; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1697 } |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1698 } |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1699 else if (anchor->AnchorFormat == 3) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1700 { |
96840 | 1701 if (anchor->f.f2.XDeviceTable.offset |
1702 && anchor->f.f2.XDeviceTable.DeltaValue) | |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1703 *x += DEVICE_DELTA (anchor->f.f2.XDeviceTable, x_ppem); |
96840 | 1704 if (anchor->f.f2.YDeviceTable.offset |
1705 && anchor->f.f2.YDeviceTable.DeltaValue) | |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1706 *y += DEVICE_DELTA (anchor->f.f2.YDeviceTable, y_ppem); |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1707 } |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1708 } |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1709 |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1710 static OTF_GlyphString otf_gstring; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
1711 |
100792
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
1712 static void |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
1713 setup_otf_gstring (int size) |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
1714 { |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
1715 if (otf_gstring.size == 0) |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
1716 { |
103556
246d16550b8d
Don't dereference NULL upon failed malloc and realloc.
Jim Meyering <jim@meyering.net>
parents:
103546
diff
changeset
|
1717 otf_gstring.glyphs = (OTF_Glyph *) xmalloc (sizeof (OTF_Glyph) * size); |
100792
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
1718 otf_gstring.size = size; |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
1719 } |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
1720 else if (otf_gstring.size < size) |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
1721 { |
103556
246d16550b8d
Don't dereference NULL upon failed malloc and realloc.
Jim Meyering <jim@meyering.net>
parents:
103546
diff
changeset
|
1722 otf_gstring.glyphs = xrealloc (otf_gstring.glyphs, |
246d16550b8d
Don't dereference NULL upon failed malloc and realloc.
Jim Meyering <jim@meyering.net>
parents:
103546
diff
changeset
|
1723 sizeof (OTF_Glyph) * size); |
100792
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
1724 otf_gstring.size = size; |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
1725 } |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
1726 otf_gstring.used = size; |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
1727 memset (otf_gstring.glyphs, 0, sizeof (OTF_Glyph) * size); |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
1728 } |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
1729 |
108347
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1730 #ifdef M17N_FLT_USE_NEW_FEATURE |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1731 |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1732 /* Pack 32-bit OTF tag (0x7F7F7F7F) into 28-bit (0x0FFFFFFF). */ |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1733 #define PACK_OTF_TAG(TAG) \ |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1734 ((((TAG) & 0x7F000000) >> 3) \ |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1735 | (((TAG) & 0x7F0000) >> 2) \ |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1736 | (((TAG) & 0x7F00) >> 1) \ |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1737 | ((TAG) & 0x7F)) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1738 |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1739 /* Assuming that FONT is an OpenType font, apply OpenType features |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1740 specified in SPEC on glyphs between FROM and TO of IN, and record |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1741 the lastly applied feature in each glyph of IN. If OUT is not |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1742 NULL, append the resulting glyphs to OUT while storing glyph |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1743 position adjustment information in ADJUSTMENT. */ |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1744 |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1745 static int |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1746 ftfont_drive_otf (font, spec, in, from, to, out, adjustment) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1747 MFLTFont *font; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1748 MFLTOtfSpec *spec; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1749 MFLTGlyphString *in; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1750 int from, to; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1751 MFLTGlyphString *out; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1752 MFLTGlyphAdjustment *adjustment; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1753 { |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1754 struct MFLTFontFT *flt_font_ft = (struct MFLTFontFT *) font; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1755 FT_Face ft_face = flt_font_ft->ft_face; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1756 OTF *otf = flt_font_ft->otf; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1757 int len = to - from; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1758 int i, j, gidx; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1759 OTF_Glyph *otfg; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1760 char script[5], *langsys = NULL; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1761 char *gsub_features = NULL, *gpos_features = NULL; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1762 OTF_Feature *features; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1763 |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1764 if (len == 0) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1765 return from; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1766 OTF_tag_name (spec->script, script); |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1767 if (spec->langsys) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1768 { |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1769 langsys = alloca (5); |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1770 OTF_tag_name (spec->langsys, langsys); |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1771 } |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1772 for (i = 0; i < 2; i++) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1773 { |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1774 char *p; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1775 |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1776 if (spec->features[i] && spec->features[i][1] != 0xFFFFFFFF) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1777 { |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1778 for (j = 0; spec->features[i][j]; j++); |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1779 if (i == 0) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1780 p = gsub_features = alloca (6 * j); |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1781 else |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1782 p = gpos_features = alloca (6 * j); |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1783 for (j = 0; spec->features[i][j]; j++) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1784 { |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1785 if (spec->features[i][j] == 0xFFFFFFFF) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1786 *p++ = '*', *p++ = ','; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1787 else |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1788 { |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1789 OTF_tag_name (spec->features[i][j], p); |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1790 p[4] = ','; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1791 p += 5; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1792 } |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1793 } |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1794 *--p = '\0'; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1795 } |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1796 } |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1797 |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1798 setup_otf_gstring (len); |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1799 for (i = 0; i < len; i++) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1800 { |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1801 otf_gstring.glyphs[i].c = in->glyphs[from + i].c; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1802 otf_gstring.glyphs[i].glyph_id = in->glyphs[from + i].code; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1803 } |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1804 |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1805 OTF_drive_gdef (otf, &otf_gstring); |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1806 gidx = out ? out->used : from; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1807 |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1808 if (gsub_features && out) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1809 { |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1810 if (OTF_drive_gsub_with_log (otf, &otf_gstring, script, langsys, |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1811 gsub_features) < 0) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1812 goto simple_copy; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1813 if (out->allocated < out->used + otf_gstring.used) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1814 return -2; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1815 features = otf->gsub->FeatureList.Feature; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1816 for (i = 0, otfg = otf_gstring.glyphs; i < otf_gstring.used; ) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1817 { |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1818 MFLTGlyph *g; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1819 int min_from, max_to; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1820 int j; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1821 int feature_idx = otfg->positioning_type >> 4; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1822 |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1823 g = out->glyphs + out->used; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1824 *g = in->glyphs[from + otfg->f.index.from]; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1825 if (g->code != otfg->glyph_id) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1826 { |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1827 g->c = 0; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1828 g->code = otfg->glyph_id; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1829 g->measured = 0; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1830 } |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1831 out->used++; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1832 min_from = g->from; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1833 max_to = g->to; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1834 if (otfg->f.index.from < otfg->f.index.to) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1835 { |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1836 /* OTFG substitutes multiple glyphs in IN. */ |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1837 for (j = from + otfg->f.index.from + 1; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1838 j <= from + otfg->f.index.to; j++) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1839 { |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1840 if (min_from > in->glyphs[j].from) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1841 min_from = in->glyphs[j].from; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1842 if (max_to < in->glyphs[j].to) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1843 max_to = in->glyphs[j].to; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1844 } |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1845 g->from = min_from; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1846 g->to = max_to; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1847 } |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1848 if (feature_idx) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1849 { |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1850 unsigned int tag = features[feature_idx - 1].FeatureTag; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1851 tag = PACK_OTF_TAG (tag); |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1852 g->internal = (g->internal & ~0x1FFFFFFF) | tag; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1853 } |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1854 for (i++, otfg++; (i < otf_gstring.used |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1855 && otfg->f.index.from == otfg[-1].f.index.from); |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1856 i++, otfg++) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1857 { |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1858 g = out->glyphs + out->used; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1859 *g = in->glyphs[from + otfg->f.index.to]; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1860 if (g->code != otfg->glyph_id) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1861 { |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1862 g->c = 0; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1863 g->code = otfg->glyph_id; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1864 g->measured = 0; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1865 } |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1866 feature_idx = otfg->positioning_type >> 4; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1867 if (feature_idx) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1868 { |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1869 unsigned int tag = features[feature_idx - 1].FeatureTag; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1870 tag = PACK_OTF_TAG (tag); |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1871 g->internal = (g->internal & ~0x1FFFFFFF) | tag; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1872 } |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1873 out->used++; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1874 } |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1875 } |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1876 } |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1877 else if (gsub_features) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1878 { |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1879 /* Just for checking which features will be applied. */ |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1880 if (OTF_drive_gsub_with_log (otf, &otf_gstring, script, langsys, |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1881 gsub_features) < 0) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1882 goto simple_copy; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1883 features = otf->gsub->FeatureList.Feature; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1884 for (i = 0, otfg = otf_gstring.glyphs; i < otf_gstring.used; i++, |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1885 otfg++) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1886 { |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1887 int feature_idx = otfg->positioning_type >> 4; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1888 |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1889 if (feature_idx) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1890 { |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1891 unsigned int tag = features[feature_idx - 1].FeatureTag; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1892 tag = PACK_OTF_TAG (tag); |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1893 for (j = otfg->f.index.from; j <= otfg->f.index.to; j++) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1894 { |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1895 MFLTGlyph *g = in->glyphs + (from + j); |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1896 g->internal = (g->internal & ~0x1FFFFFFF) | tag; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1897 } |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1898 } |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1899 } |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1900 } |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1901 else if (out) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1902 { |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1903 if (out->allocated < out->used + len) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1904 return -2; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1905 for (i = 0; i < len; i++) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1906 out->glyphs[out->used++] = in->glyphs[from + i]; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1907 } |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1908 |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1909 if (gpos_features && out) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1910 { |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1911 MFLTGlyph *base = NULL, *mark = NULL, *g; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1912 int x_ppem, y_ppem, x_scale, y_scale; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1913 |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1914 if (OTF_drive_gpos_with_log (otf, &otf_gstring, script, langsys, |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1915 gpos_features) < 0) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1916 return to; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1917 features = otf->gpos->FeatureList.Feature; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1918 x_ppem = ft_face->size->metrics.x_ppem; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1919 y_ppem = ft_face->size->metrics.y_ppem; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1920 x_scale = ft_face->size->metrics.x_scale; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1921 y_scale = ft_face->size->metrics.y_scale; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1922 |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1923 for (i = 0, otfg = otf_gstring.glyphs, g = out->glyphs + gidx; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1924 i < otf_gstring.used; i++, otfg++, g++) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1925 { |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1926 MFLTGlyph *prev; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1927 int feature_idx = otfg->positioning_type >> 4; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1928 |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1929 if (feature_idx) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1930 { |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1931 unsigned int tag = features[feature_idx - 1].FeatureTag; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1932 tag = PACK_OTF_TAG (tag); |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1933 g->internal = (g->internal & ~0x1FFFFFFF) | tag; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1934 } |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1935 |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1936 if (! otfg->glyph_id) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1937 continue; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1938 switch (otfg->positioning_type & 0xF) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1939 { |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1940 case 0: |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1941 break; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1942 case 1: /* Single */ |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1943 case 2: /* Pair */ |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1944 { |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1945 int format = otfg->f.f1.format; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1946 |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1947 if (format & OTF_XPlacement) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1948 adjustment[i].xoff |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1949 = otfg->f.f1.value->XPlacement * x_scale / 0x10000; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1950 if (format & OTF_XPlaDevice) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1951 adjustment[i].xoff |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1952 += DEVICE_DELTA (otfg->f.f1.value->XPlaDevice, x_ppem); |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1953 if (format & OTF_YPlacement) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1954 adjustment[i].yoff |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1955 = - (otfg->f.f1.value->YPlacement * y_scale / 0x10000); |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1956 if (format & OTF_YPlaDevice) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1957 adjustment[i].yoff |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1958 -= DEVICE_DELTA (otfg->f.f1.value->YPlaDevice, y_ppem); |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1959 if (format & OTF_XAdvance) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1960 adjustment[i].xadv |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1961 += otfg->f.f1.value->XAdvance * x_scale / 0x10000; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1962 if (format & OTF_XAdvDevice) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1963 adjustment[i].xadv |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1964 += DEVICE_DELTA (otfg->f.f1.value->XAdvDevice, x_ppem); |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1965 if (format & OTF_YAdvance) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1966 adjustment[i].yadv |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1967 += otfg->f.f1.value->YAdvance * y_scale / 0x10000; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1968 if (format & OTF_YAdvDevice) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1969 adjustment[i].yadv |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1970 += DEVICE_DELTA (otfg->f.f1.value->YAdvDevice, y_ppem); |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1971 adjustment[i].set = 1; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1972 } |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1973 break; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1974 case 3: /* Cursive */ |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1975 /* Not yet supported. */ |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1976 break; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1977 case 4: /* Mark-to-Base */ |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1978 case 5: /* Mark-to-Ligature */ |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1979 if (! base) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1980 break; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1981 prev = base; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1982 goto label_adjust_anchor; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1983 default: /* i.e. case 6 Mark-to-Mark */ |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1984 if (! mark) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1985 break; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1986 prev = mark; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1987 |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1988 label_adjust_anchor: |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1989 { |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1990 int base_x, base_y, mark_x, mark_y; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1991 int this_from, this_to; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1992 |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1993 base_x = otfg->f.f4.base_anchor->XCoordinate * x_scale / 0x10000; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1994 base_y = otfg->f.f4.base_anchor->YCoordinate * y_scale / 0x10000; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1995 mark_x = otfg->f.f4.mark_anchor->XCoordinate * x_scale / 0x10000; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1996 mark_y = otfg->f.f4.mark_anchor->YCoordinate * y_scale / 0x10000; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1997 |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1998 if (otfg->f.f4.base_anchor->AnchorFormat != 1) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
1999 adjust_anchor (ft_face, otfg->f.f4.base_anchor, |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2000 prev->code, x_ppem, y_ppem, &base_x, &base_y); |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2001 if (otfg->f.f4.mark_anchor->AnchorFormat != 1) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2002 adjust_anchor (ft_face, otfg->f.f4.mark_anchor, g->code, |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2003 x_ppem, y_ppem, &mark_x, &mark_y); |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2004 adjustment[i].xoff = (base_x - mark_x); |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2005 adjustment[i].yoff = - (base_y - mark_y); |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2006 adjustment[i].back = (g - prev); |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2007 adjustment[i].xadv = 0; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2008 adjustment[i].advance_is_absolute = 1; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2009 adjustment[i].set = 1; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2010 this_from = g->from; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2011 this_to = g->to; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2012 for (j = 0; prev + j < g; j++) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2013 { |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2014 if (this_from > prev[j].from) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2015 this_from = prev[j].from; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2016 if (this_to < prev[j].to) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2017 this_to = prev[j].to; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2018 } |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2019 for (; prev <= g; prev++) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2020 { |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2021 prev->from = this_from; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2022 prev->to = this_to; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2023 } |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2024 } |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2025 } |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2026 if (otfg->GlyphClass == OTF_GlyphClass0) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2027 base = mark = g; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2028 else if (otfg->GlyphClass == OTF_GlyphClassMark) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2029 mark = g; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2030 else |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2031 base = g; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2032 } |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2033 } |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2034 else if (gpos_features) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2035 { |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2036 if (OTF_drive_gpos_with_log (otf, &otf_gstring, script, langsys, |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2037 gpos_features) < 0) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2038 return to; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2039 features = otf->gpos->FeatureList.Feature; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2040 for (i = 0, otfg = otf_gstring.glyphs; i < otf_gstring.used; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2041 i++, otfg++) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2042 if (otfg->positioning_type & 0xF) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2043 { |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2044 int feature_idx = otfg->positioning_type >> 4; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2045 |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2046 if (feature_idx) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2047 { |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2048 unsigned int tag = features[feature_idx - 1].FeatureTag; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2049 tag = PACK_OTF_TAG (tag); |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2050 for (j = otfg->f.index.from; j <= otfg->f.index.to; j++) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2051 { |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2052 MFLTGlyph *g = in->glyphs + (from + j); |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2053 g->internal = (g->internal & ~0x1FFFFFFF) | tag; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2054 } |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2055 } |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2056 } |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2057 } |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2058 return to; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2059 |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2060 simple_copy: |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2061 if (! out) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2062 return to; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2063 if (out->allocated < out->used + len) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2064 return -2; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2065 font->get_metrics (font, in, from, to); |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2066 memcpy (out->glyphs + out->used, in->glyphs + from, |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2067 sizeof (MFLTGlyph) * len); |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2068 out->used += len; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2069 return to; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2070 } |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2071 |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2072 static int |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2073 ftfont_try_otf (MFLTFont *font, MFLTOtfSpec *spec, |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2074 MFLTGlyphString *in, int from, int to) |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2075 { |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2076 return ftfont_drive_otf (font, spec, in, from, to, NULL, NULL); |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2077 } |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2078 |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2079 #else /* not M17N_FLT_USE_NEW_FEATURE */ |
100792
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2080 |
95464
de4cb7ab40db
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
95433
diff
changeset
|
2081 static int |
109364
89a16701cde1
Convert old-style definitions
Andreas Schwab <schwab@linux-m68k.org>
parents:
109165
diff
changeset
|
2082 ftfont_drive_otf (MFLTFont *font, MFLTOtfSpec *spec, MFLTGlyphString *in, |
89a16701cde1
Convert old-style definitions
Andreas Schwab <schwab@linux-m68k.org>
parents:
109165
diff
changeset
|
2083 int from, int to, |
89a16701cde1
Convert old-style definitions
Andreas Schwab <schwab@linux-m68k.org>
parents:
109165
diff
changeset
|
2084 MFLTGlyphString *out, MFLTGlyphAdjustment *adjustment) |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2085 { |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2086 struct MFLTFontFT *flt_font_ft = (struct MFLTFontFT *) font; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2087 FT_Face ft_face = flt_font_ft->ft_face; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2088 OTF *otf = flt_font_ft->otf; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2089 int len = to - from; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2090 int i, j, gidx; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2091 OTF_Glyph *otfg; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2092 char script[5], *langsys = NULL; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2093 char *gsub_features = NULL, *gpos_features = NULL; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2094 |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2095 if (len == 0) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2096 return from; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2097 OTF_tag_name (spec->script, script); |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2098 if (spec->langsys) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2099 { |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2100 langsys = alloca (5); |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2101 OTF_tag_name (spec->langsys, langsys); |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2102 } |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2103 for (i = 0; i < 2; i++) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2104 { |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2105 char *p; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2106 |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2107 if (spec->features[i] && spec->features[i][1] != 0xFFFFFFFF) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2108 { |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2109 for (j = 0; spec->features[i][j]; j++); |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2110 if (i == 0) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2111 p = gsub_features = alloca (6 * j); |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2112 else |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2113 p = gpos_features = alloca (6 * j); |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2114 for (j = 0; spec->features[i][j]; j++) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2115 { |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2116 if (spec->features[i][j] == 0xFFFFFFFF) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2117 *p++ = '*', *p++ = ','; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2118 else |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2119 { |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2120 OTF_tag_name (spec->features[i][j], p); |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2121 p[4] = ','; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2122 p += 5; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2123 } |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2124 } |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2125 *--p = '\0'; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2126 } |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2127 } |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2128 |
100792
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2129 setup_otf_gstring (len); |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2130 for (i = 0; i < len; i++) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2131 { |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2132 otf_gstring.glyphs[i].c = in->glyphs[from + i].c; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2133 otf_gstring.glyphs[i].glyph_id = in->glyphs[from + i].code; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2134 } |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2135 |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2136 OTF_drive_gdef (otf, &otf_gstring); |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2137 gidx = out->used; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2138 |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2139 if (gsub_features) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2140 { |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2141 if (OTF_drive_gsub (otf, &otf_gstring, script, langsys, gsub_features) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2142 < 0) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2143 goto simple_copy; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2144 if (out->allocated < out->used + otf_gstring.used) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2145 return -2; |
91294
299c64a7a9fb
(ftfont_drive_otf): Fix setting of FROM and TO slots of
Kenichi Handa <handa@m17n.org>
parents:
91271
diff
changeset
|
2146 for (i = 0, otfg = otf_gstring.glyphs; i < otf_gstring.used; ) |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2147 { |
91294
299c64a7a9fb
(ftfont_drive_otf): Fix setting of FROM and TO slots of
Kenichi Handa <handa@m17n.org>
parents:
91271
diff
changeset
|
2148 MFLTGlyph *g; |
299c64a7a9fb
(ftfont_drive_otf): Fix setting of FROM and TO slots of
Kenichi Handa <handa@m17n.org>
parents:
91271
diff
changeset
|
2149 int min_from, max_to; |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2150 int j; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2151 |
91294
299c64a7a9fb
(ftfont_drive_otf): Fix setting of FROM and TO slots of
Kenichi Handa <handa@m17n.org>
parents:
91271
diff
changeset
|
2152 g = out->glyphs + out->used; |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2153 *g = in->glyphs[from + otfg->f.index.from]; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2154 if (g->code != otfg->glyph_id) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2155 { |
91294
299c64a7a9fb
(ftfont_drive_otf): Fix setting of FROM and TO slots of
Kenichi Handa <handa@m17n.org>
parents:
91271
diff
changeset
|
2156 g->c = 0; |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2157 g->code = otfg->glyph_id; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2158 g->measured = 0; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2159 } |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2160 out->used++; |
91294
299c64a7a9fb
(ftfont_drive_otf): Fix setting of FROM and TO slots of
Kenichi Handa <handa@m17n.org>
parents:
91271
diff
changeset
|
2161 min_from = g->from; |
299c64a7a9fb
(ftfont_drive_otf): Fix setting of FROM and TO slots of
Kenichi Handa <handa@m17n.org>
parents:
91271
diff
changeset
|
2162 max_to = g->to; |
299c64a7a9fb
(ftfont_drive_otf): Fix setting of FROM and TO slots of
Kenichi Handa <handa@m17n.org>
parents:
91271
diff
changeset
|
2163 if (otfg->f.index.from < otfg->f.index.to) |
299c64a7a9fb
(ftfont_drive_otf): Fix setting of FROM and TO slots of
Kenichi Handa <handa@m17n.org>
parents:
91271
diff
changeset
|
2164 { |
299c64a7a9fb
(ftfont_drive_otf): Fix setting of FROM and TO slots of
Kenichi Handa <handa@m17n.org>
parents:
91271
diff
changeset
|
2165 /* OTFG substitutes multiple glyphs in IN. */ |
299c64a7a9fb
(ftfont_drive_otf): Fix setting of FROM and TO slots of
Kenichi Handa <handa@m17n.org>
parents:
91271
diff
changeset
|
2166 for (j = from + otfg->f.index.from + 1; |
299c64a7a9fb
(ftfont_drive_otf): Fix setting of FROM and TO slots of
Kenichi Handa <handa@m17n.org>
parents:
91271
diff
changeset
|
2167 j <= from + otfg->f.index.to; j++) |
299c64a7a9fb
(ftfont_drive_otf): Fix setting of FROM and TO slots of
Kenichi Handa <handa@m17n.org>
parents:
91271
diff
changeset
|
2168 { |
299c64a7a9fb
(ftfont_drive_otf): Fix setting of FROM and TO slots of
Kenichi Handa <handa@m17n.org>
parents:
91271
diff
changeset
|
2169 if (min_from > in->glyphs[j].from) |
299c64a7a9fb
(ftfont_drive_otf): Fix setting of FROM and TO slots of
Kenichi Handa <handa@m17n.org>
parents:
91271
diff
changeset
|
2170 min_from = in->glyphs[j].from; |
299c64a7a9fb
(ftfont_drive_otf): Fix setting of FROM and TO slots of
Kenichi Handa <handa@m17n.org>
parents:
91271
diff
changeset
|
2171 if (max_to < in->glyphs[j].to) |
299c64a7a9fb
(ftfont_drive_otf): Fix setting of FROM and TO slots of
Kenichi Handa <handa@m17n.org>
parents:
91271
diff
changeset
|
2172 max_to = in->glyphs[j].to; |
299c64a7a9fb
(ftfont_drive_otf): Fix setting of FROM and TO slots of
Kenichi Handa <handa@m17n.org>
parents:
91271
diff
changeset
|
2173 } |
299c64a7a9fb
(ftfont_drive_otf): Fix setting of FROM and TO slots of
Kenichi Handa <handa@m17n.org>
parents:
91271
diff
changeset
|
2174 g->from = min_from; |
299c64a7a9fb
(ftfont_drive_otf): Fix setting of FROM and TO slots of
Kenichi Handa <handa@m17n.org>
parents:
91271
diff
changeset
|
2175 g->to = max_to; |
299c64a7a9fb
(ftfont_drive_otf): Fix setting of FROM and TO slots of
Kenichi Handa <handa@m17n.org>
parents:
91271
diff
changeset
|
2176 } |
299c64a7a9fb
(ftfont_drive_otf): Fix setting of FROM and TO slots of
Kenichi Handa <handa@m17n.org>
parents:
91271
diff
changeset
|
2177 for (i++, otfg++; (i < otf_gstring.used |
299c64a7a9fb
(ftfont_drive_otf): Fix setting of FROM and TO slots of
Kenichi Handa <handa@m17n.org>
parents:
91271
diff
changeset
|
2178 && otfg->f.index.from == otfg[-1].f.index.from); |
299c64a7a9fb
(ftfont_drive_otf): Fix setting of FROM and TO slots of
Kenichi Handa <handa@m17n.org>
parents:
91271
diff
changeset
|
2179 i++, otfg++) |
299c64a7a9fb
(ftfont_drive_otf): Fix setting of FROM and TO slots of
Kenichi Handa <handa@m17n.org>
parents:
91271
diff
changeset
|
2180 { |
299c64a7a9fb
(ftfont_drive_otf): Fix setting of FROM and TO slots of
Kenichi Handa <handa@m17n.org>
parents:
91271
diff
changeset
|
2181 g = out->glyphs + out->used; |
299c64a7a9fb
(ftfont_drive_otf): Fix setting of FROM and TO slots of
Kenichi Handa <handa@m17n.org>
parents:
91271
diff
changeset
|
2182 *g = in->glyphs[from + otfg->f.index.to]; |
299c64a7a9fb
(ftfont_drive_otf): Fix setting of FROM and TO slots of
Kenichi Handa <handa@m17n.org>
parents:
91271
diff
changeset
|
2183 if (g->code != otfg->glyph_id) |
299c64a7a9fb
(ftfont_drive_otf): Fix setting of FROM and TO slots of
Kenichi Handa <handa@m17n.org>
parents:
91271
diff
changeset
|
2184 { |
299c64a7a9fb
(ftfont_drive_otf): Fix setting of FROM and TO slots of
Kenichi Handa <handa@m17n.org>
parents:
91271
diff
changeset
|
2185 g->c = 0; |
299c64a7a9fb
(ftfont_drive_otf): Fix setting of FROM and TO slots of
Kenichi Handa <handa@m17n.org>
parents:
91271
diff
changeset
|
2186 g->code = otfg->glyph_id; |
299c64a7a9fb
(ftfont_drive_otf): Fix setting of FROM and TO slots of
Kenichi Handa <handa@m17n.org>
parents:
91271
diff
changeset
|
2187 g->measured = 0; |
299c64a7a9fb
(ftfont_drive_otf): Fix setting of FROM and TO slots of
Kenichi Handa <handa@m17n.org>
parents:
91271
diff
changeset
|
2188 } |
299c64a7a9fb
(ftfont_drive_otf): Fix setting of FROM and TO slots of
Kenichi Handa <handa@m17n.org>
parents:
91271
diff
changeset
|
2189 out->used++; |
299c64a7a9fb
(ftfont_drive_otf): Fix setting of FROM and TO slots of
Kenichi Handa <handa@m17n.org>
parents:
91271
diff
changeset
|
2190 } |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2191 } |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2192 } |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2193 else |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2194 { |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2195 if (out->allocated < out->used + len) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2196 return -2; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2197 for (i = 0; i < len; i++) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2198 out->glyphs[out->used++] = in->glyphs[from + i]; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2199 } |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2200 |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2201 if (gpos_features) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2202 { |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2203 MFLTGlyph *base = NULL, *mark = NULL, *g; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2204 int x_ppem, y_ppem, x_scale, y_scale; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2205 |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2206 if (OTF_drive_gpos (otf, &otf_gstring, script, langsys, gpos_features) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2207 < 0) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2208 return to; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2209 |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2210 x_ppem = ft_face->size->metrics.x_ppem; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2211 y_ppem = ft_face->size->metrics.y_ppem; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2212 x_scale = ft_face->size->metrics.x_scale; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2213 y_scale = ft_face->size->metrics.y_scale; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2214 |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2215 for (i = 0, otfg = otf_gstring.glyphs, g = out->glyphs + gidx; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2216 i < otf_gstring.used; i++, otfg++, g++) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2217 { |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2218 MFLTGlyph *prev; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2219 |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2220 if (! otfg->glyph_id) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2221 continue; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2222 switch (otfg->positioning_type) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2223 { |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2224 case 0: |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2225 break; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2226 case 1: /* Single */ |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2227 case 2: /* Pair */ |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2228 { |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2229 int format = otfg->f.f1.format; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2230 |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2231 if (format & OTF_XPlacement) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2232 adjustment[i].xoff |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2233 = otfg->f.f1.value->XPlacement * x_scale / 0x10000; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2234 if (format & OTF_XPlaDevice) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2235 adjustment[i].xoff |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2236 += DEVICE_DELTA (otfg->f.f1.value->XPlaDevice, x_ppem); |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2237 if (format & OTF_YPlacement) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2238 adjustment[i].yoff |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2239 = - (otfg->f.f1.value->YPlacement * y_scale / 0x10000); |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2240 if (format & OTF_YPlaDevice) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2241 adjustment[i].yoff |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2242 -= DEVICE_DELTA (otfg->f.f1.value->YPlaDevice, y_ppem); |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2243 if (format & OTF_XAdvance) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2244 adjustment[i].xadv |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2245 += otfg->f.f1.value->XAdvance * x_scale / 0x10000; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2246 if (format & OTF_XAdvDevice) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2247 adjustment[i].xadv |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2248 += DEVICE_DELTA (otfg->f.f1.value->XAdvDevice, x_ppem); |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2249 if (format & OTF_YAdvance) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2250 adjustment[i].yadv |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2251 += otfg->f.f1.value->YAdvance * y_scale / 0x10000; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2252 if (format & OTF_YAdvDevice) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2253 adjustment[i].yadv |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2254 += DEVICE_DELTA (otfg->f.f1.value->YAdvDevice, y_ppem); |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2255 adjustment[i].set = 1; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2256 } |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2257 break; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2258 case 3: /* Cursive */ |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2259 /* Not yet supported. */ |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2260 break; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2261 case 4: /* Mark-to-Base */ |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2262 case 5: /* Mark-to-Ligature */ |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2263 if (! base) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2264 break; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2265 prev = base; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2266 goto label_adjust_anchor; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2267 default: /* i.e. case 6 Mark-to-Mark */ |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2268 if (! mark) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2269 break; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2270 prev = mark; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2271 |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2272 label_adjust_anchor: |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2273 { |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2274 int base_x, base_y, mark_x, mark_y; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2275 int this_from, this_to; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2276 |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2277 base_x = otfg->f.f4.base_anchor->XCoordinate * x_scale / 0x10000; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2278 base_y = otfg->f.f4.base_anchor->YCoordinate * y_scale / 0x10000; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2279 mark_x = otfg->f.f4.mark_anchor->XCoordinate * x_scale / 0x10000; |
101943
97c9e9322753
Remove spurious semicolons.
Juanma Barranquero <lekktu@gmail.com>
parents:
101556
diff
changeset
|
2280 mark_y = otfg->f.f4.mark_anchor->YCoordinate * y_scale / 0x10000; |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2281 |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2282 if (otfg->f.f4.base_anchor->AnchorFormat != 1) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2283 adjust_anchor (ft_face, otfg->f.f4.base_anchor, |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2284 prev->code, x_ppem, y_ppem, &base_x, &base_y); |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2285 if (otfg->f.f4.mark_anchor->AnchorFormat != 1) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2286 adjust_anchor (ft_face, otfg->f.f4.mark_anchor, g->code, |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2287 x_ppem, y_ppem, &mark_x, &mark_y); |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2288 adjustment[i].xoff = (base_x - mark_x); |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2289 adjustment[i].yoff = - (base_y - mark_y); |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2290 adjustment[i].back = (g - prev); |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2291 adjustment[i].xadv = 0; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2292 adjustment[i].advance_is_absolute = 1; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2293 adjustment[i].set = 1; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2294 this_from = g->from; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2295 this_to = g->to; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2296 for (j = 0; prev + j < g; j++) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2297 { |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2298 if (this_from > prev[j].from) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2299 this_from = prev[j].from; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2300 if (this_to < prev[j].to) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2301 this_to = prev[j].to; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2302 } |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2303 for (; prev <= g; prev++) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2304 { |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2305 prev->from = this_from; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2306 prev->to = this_to; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2307 } |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2308 } |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2309 } |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2310 if (otfg->GlyphClass == OTF_GlyphClass0) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2311 base = mark = g; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2312 else if (otfg->GlyphClass == OTF_GlyphClassMark) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2313 mark = g; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2314 else |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2315 base = g; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2316 } |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2317 } |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2318 return to; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2319 |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2320 simple_copy: |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2321 if (out->allocated < out->used + len) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2322 return -2; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2323 font->get_metrics (font, in, from, to); |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2324 memcpy (out->glyphs + out->used, in->glyphs + from, |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2325 sizeof (MFLTGlyph) * len); |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2326 out->used += len; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2327 return to; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2328 } |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2329 |
108347
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2330 #endif /* not M17N_FLT_USE_NEW_FEATURE */ |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2331 |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2332 static MFLTGlyphString gstring; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2333 |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2334 static int m17n_flt_initialized; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2335 |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2336 extern Lisp_Object QCfamily; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2337 |
98656
f2f525a089e1
* ftfont.c (ftfont_shape_by_flt): Make static.
Andreas Schwab <schwab@suse.de>
parents:
98205
diff
changeset
|
2338 static Lisp_Object |
109364
89a16701cde1
Convert old-style definitions
Andreas Schwab <schwab@linux-m68k.org>
parents:
109165
diff
changeset
|
2339 ftfont_shape_by_flt (Lisp_Object lgstring, struct font *font, |
89a16701cde1
Convert old-style definitions
Andreas Schwab <schwab@linux-m68k.org>
parents:
109165
diff
changeset
|
2340 FT_Face ft_face, OTF *otf, FT_Matrix *matrix) |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2341 { |
97826 | 2342 EMACS_UINT len = LGSTRING_GLYPH_LEN (lgstring); |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2343 EMACS_UINT i; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2344 struct MFLTFontFT flt_font_ft; |
98103
809fdcf44233
(ftfont_shape_by_flt): Use "combining" FLT for ASCII characters.
Kenichi Handa <handa@m17n.org>
parents:
97908
diff
changeset
|
2345 MFLT *flt = NULL; |
100792
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2346 int with_variation_selector = 0; |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2347 |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2348 if (! m17n_flt_initialized) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2349 { |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2350 M17N_INIT (); |
108347
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2351 #ifdef M17N_FLT_USE_NEW_FEATURE |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2352 mflt_enable_new_feature = 1; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2353 mflt_try_otf = ftfont_try_otf; |
39d09d6f8dbc
Use new features of libotf and m17n-lib if available.
Kenichi Handa <handa@etlken>
parents:
107237
diff
changeset
|
2354 #endif /* M17N_FLT_USE_NEW_FEATURE */ |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2355 m17n_flt_initialized = 1; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2356 } |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2357 |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2358 for (i = 0; i < len; i++) |
100792
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2359 { |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2360 Lisp_Object g = LGSTRING_GLYPH (lgstring, i); |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2361 int c; |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2362 |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2363 if (NILP (g)) |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2364 break; |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2365 c = LGLYPH_CHAR (g); |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2366 if (CHAR_VARIATION_SELECTOR_P (c)) |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2367 with_variation_selector++; |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2368 } |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2369 len = i; |
100792
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2370 if (with_variation_selector) |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2371 { |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2372 setup_otf_gstring (len); |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2373 for (i = 0; i < len; i++) |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2374 { |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2375 Lisp_Object g = LGSTRING_GLYPH (lgstring, i); |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2376 |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2377 otf_gstring.glyphs[i].c = LGLYPH_CHAR (g); |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2378 otf_gstring.glyphs[i].f.index.from = LGLYPH_FROM (g); |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2379 otf_gstring.glyphs[i].f.index.to = LGLYPH_TO (g); |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2380 } |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2381 OTF_drive_cmap (otf, &otf_gstring); |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2382 for (i = 0; i < otf_gstring.used; i++) |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2383 { |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2384 OTF_Glyph *otfg = otf_gstring.glyphs + i; |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2385 Lisp_Object g0 = LGSTRING_GLYPH (lgstring, otfg->f.index.from); |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2386 Lisp_Object g1 = LGSTRING_GLYPH (lgstring, otfg->f.index.to); |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2387 |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2388 LGLYPH_SET_CODE (g0, otfg->glyph_id); |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2389 LGLYPH_SET_TO (g0, LGLYPH_TO (g1)); |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2390 LGSTRING_SET_GLYPH (lgstring, i, g0); |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2391 } |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2392 if (len > otf_gstring.used) |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2393 { |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2394 len = otf_gstring.used; |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2395 LGSTRING_SET_GLYPH (lgstring, len, Qnil); |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2396 } |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2397 } |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2398 |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2399 if (gstring.allocated == 0) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2400 { |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2401 gstring.allocated = len * 2; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2402 gstring.glyph_size = sizeof (MFLTGlyph); |
103556
246d16550b8d
Don't dereference NULL upon failed malloc and realloc.
Jim Meyering <jim@meyering.net>
parents:
103546
diff
changeset
|
2403 gstring.glyphs = xmalloc (sizeof (MFLTGlyph) * gstring.allocated); |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2404 } |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2405 else if (gstring.allocated < len * 2) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2406 { |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2407 gstring.allocated = len * 2; |
103556
246d16550b8d
Don't dereference NULL upon failed malloc and realloc.
Jim Meyering <jim@meyering.net>
parents:
103546
diff
changeset
|
2408 gstring.glyphs = xrealloc (gstring.glyphs, |
246d16550b8d
Don't dereference NULL upon failed malloc and realloc.
Jim Meyering <jim@meyering.net>
parents:
103546
diff
changeset
|
2409 sizeof (MFLTGlyph) * gstring.allocated); |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2410 } |
100792
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2411 memset (gstring.glyphs, 0, sizeof (MFLTGlyph) * len); |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2412 for (i = 0; i < len; i++) |
100792
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2413 { |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2414 Lisp_Object g = LGSTRING_GLYPH (lgstring, i); |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2415 |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2416 gstring.glyphs[i].c = LGLYPH_CHAR (g); |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2417 if (with_variation_selector) |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2418 { |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2419 gstring.glyphs[i].code = LGLYPH_CODE (g); |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2420 gstring.glyphs[i].encoded = 1; |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2421 } |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2422 } |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2423 |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2424 gstring.used = len; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2425 gstring.r2l = 0; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2426 |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2427 { |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2428 Lisp_Object family = Ffont_get (LGSTRING_FONT (lgstring), QCfamily); |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2429 |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2430 if (NILP (family)) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2431 flt_font_ft.flt_font.family = Mnil; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2432 else |
95103 | 2433 flt_font_ft.flt_font.family |
98205
851824a732ae
(ftfont_shape_by_flt): Downcase family name.
Kenichi Handa <handa@m17n.org>
parents:
98103
diff
changeset
|
2434 = msymbol ((char *) SDATA (Fdowncase (SYMBOL_NAME (family)))); |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2435 } |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2436 flt_font_ft.flt_font.x_ppem = ft_face->size->metrics.x_ppem; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2437 flt_font_ft.flt_font.y_ppem = ft_face->size->metrics.y_ppem; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2438 flt_font_ft.flt_font.get_glyph_id = ftfont_get_glyph_id; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2439 flt_font_ft.flt_font.get_metrics = ftfont_get_metrics; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2440 flt_font_ft.flt_font.check_otf = ftfont_check_otf; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2441 flt_font_ft.flt_font.drive_otf = ftfont_drive_otf; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2442 flt_font_ft.flt_font.internal = NULL; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2443 flt_font_ft.font = font; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2444 flt_font_ft.ft_face = ft_face; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2445 flt_font_ft.otf = otf; |
106539
e5416066efd1
(struct ftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106085
diff
changeset
|
2446 flt_font_ft.matrix = matrix->xx != 0 ? matrix : 0; |
100239
7d98fd5b3867
(ftfont_shape_by_flt): Use "combining" flt if the
Kenichi Handa <handa@m17n.org>
parents:
100163
diff
changeset
|
2447 if (len > 1 |
7d98fd5b3867
(ftfont_shape_by_flt): Use "combining" flt if the
Kenichi Handa <handa@m17n.org>
parents:
100163
diff
changeset
|
2448 && gstring.glyphs[1].c >= 0x300 && gstring.glyphs[1].c <= 0x36F) |
98103
809fdcf44233
(ftfont_shape_by_flt): Use "combining" FLT for ASCII characters.
Kenichi Handa <handa@m17n.org>
parents:
97908
diff
changeset
|
2449 /* A little bit ad hoc. Perhaps, shaper must get script and |
809fdcf44233
(ftfont_shape_by_flt): Use "combining" FLT for ASCII characters.
Kenichi Handa <handa@m17n.org>
parents:
97908
diff
changeset
|
2450 language information, and select a proper flt for them |
809fdcf44233
(ftfont_shape_by_flt): Use "combining" FLT for ASCII characters.
Kenichi Handa <handa@m17n.org>
parents:
97908
diff
changeset
|
2451 here. */ |
809fdcf44233
(ftfont_shape_by_flt): Use "combining" FLT for ASCII characters.
Kenichi Handa <handa@m17n.org>
parents:
97908
diff
changeset
|
2452 flt = mflt_get (msymbol ("combining")); |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2453 for (i = 0; i < 3; i++) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2454 { |
98103
809fdcf44233
(ftfont_shape_by_flt): Use "combining" FLT for ASCII characters.
Kenichi Handa <handa@m17n.org>
parents:
97908
diff
changeset
|
2455 int result = mflt_run (&gstring, 0, len, &flt_font_ft.flt_font, flt); |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2456 if (result != -2) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2457 break; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2458 gstring.allocated += gstring.allocated; |
103556
246d16550b8d
Don't dereference NULL upon failed malloc and realloc.
Jim Meyering <jim@meyering.net>
parents:
103546
diff
changeset
|
2459 gstring.glyphs = xrealloc (gstring.glyphs, |
246d16550b8d
Don't dereference NULL upon failed malloc and realloc.
Jim Meyering <jim@meyering.net>
parents:
103546
diff
changeset
|
2460 sizeof (MFLTGlyph) * gstring.allocated); |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2461 } |
97826 | 2462 if (gstring.used > LGSTRING_GLYPH_LEN (lgstring)) |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2463 return Qnil; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2464 for (i = 0; i < gstring.used; i++) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2465 { |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2466 MFLTGlyph *g = gstring.glyphs + i; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2467 |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2468 g->from = LGLYPH_FROM (LGSTRING_GLYPH (lgstring, g->from)); |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2469 g->to = LGLYPH_TO (LGSTRING_GLYPH (lgstring, g->to)); |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2470 } |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2471 |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2472 for (i = 0; i < gstring.used; i++) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2473 { |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2474 Lisp_Object lglyph = LGSTRING_GLYPH (lgstring, i); |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2475 MFLTGlyph *g = gstring.glyphs + i; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2476 |
91271
fed5211f4809
(ftfont_encode_char): Use the macro FONT_INVALID_CODE.
Kenichi Handa <handa@m17n.org>
parents:
91249
diff
changeset
|
2477 if (NILP (lglyph)) |
fed5211f4809
(ftfont_encode_char): Use the macro FONT_INVALID_CODE.
Kenichi Handa <handa@m17n.org>
parents:
91249
diff
changeset
|
2478 { |
fed5211f4809
(ftfont_encode_char): Use the macro FONT_INVALID_CODE.
Kenichi Handa <handa@m17n.org>
parents:
91249
diff
changeset
|
2479 lglyph = Fmake_vector (make_number (LGLYPH_SIZE), Qnil); |
fed5211f4809
(ftfont_encode_char): Use the macro FONT_INVALID_CODE.
Kenichi Handa <handa@m17n.org>
parents:
91249
diff
changeset
|
2480 LGSTRING_SET_GLYPH (lgstring, i, lglyph); |
fed5211f4809
(ftfont_encode_char): Use the macro FONT_INVALID_CODE.
Kenichi Handa <handa@m17n.org>
parents:
91249
diff
changeset
|
2481 } |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2482 LGLYPH_SET_FROM (lglyph, g->from); |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2483 LGLYPH_SET_TO (lglyph, g->to); |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2484 LGLYPH_SET_CHAR (lglyph, g->c); |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2485 LGLYPH_SET_CODE (lglyph, g->code); |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2486 LGLYPH_SET_WIDTH (lglyph, g->xadv >> 6); |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2487 LGLYPH_SET_LBEARING (lglyph, g->lbearing >> 6); |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2488 LGLYPH_SET_RBEARING (lglyph, g->rbearing >> 6); |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2489 LGLYPH_SET_ASCENT (lglyph, g->ascent >> 6); |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2490 LGLYPH_SET_DESCENT (lglyph, g->descent >> 6); |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2491 if (g->adjusted) |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2492 { |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2493 Lisp_Object vec; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2494 |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2495 vec = Fmake_vector (make_number (3), Qnil); |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2496 ASET (vec, 0, make_number (g->xoff >> 6)); |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2497 ASET (vec, 1, make_number (g->yoff >> 6)); |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2498 ASET (vec, 2, make_number (g->xadv >> 6)); |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2499 LGLYPH_SET_ADJUSTMENT (lglyph, vec); |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2500 } |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2501 } |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2502 return make_number (i); |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2503 } |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2504 |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2505 Lisp_Object |
109364
89a16701cde1
Convert old-style definitions
Andreas Schwab <schwab@linux-m68k.org>
parents:
109165
diff
changeset
|
2506 ftfont_shape (Lisp_Object lgstring) |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2507 { |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2508 struct font *font; |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2509 struct ftfont_info *ftfont_info; |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
2510 OTF *otf; |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2511 |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2512 CHECK_FONT_GET_OBJECT (LGSTRING_FONT (lgstring), font); |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2513 ftfont_info = (struct ftfont_info *) font; |
96561
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
2514 otf = ftfont_get_otf (ftfont_info); |
d7b47f09b693
(struct ftfont_info): New member index, delete member
Kenichi Handa <handa@m17n.org>
parents:
96429
diff
changeset
|
2515 if (! otf) |
91870
5348213975e3
(ftfont_shape): Return Lispy number.
Kenichi Handa <handa@m17n.org>
parents:
91604
diff
changeset
|
2516 return make_number (0); |
106539
e5416066efd1
(struct ftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106085
diff
changeset
|
2517 return ftfont_shape_by_flt (lgstring, font, ftfont_info->ft_size->face, otf, |
e5416066efd1
(struct ftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106085
diff
changeset
|
2518 &ftfont_info->matrix); |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2519 } |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2520 |
102791
9874a0083028
Fix previous change. Define ftfont_variation_glyphs
Kenichi Handa <handa@m17n.org>
parents:
102773
diff
changeset
|
2521 #endif /* HAVE_M17N_FLT */ |
9874a0083028
Fix previous change. Define ftfont_variation_glyphs
Kenichi Handa <handa@m17n.org>
parents:
102773
diff
changeset
|
2522 |
100792
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2523 #ifdef HAVE_OTF_GET_VARIATION_GLYPHS |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2524 |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2525 static int |
109364
89a16701cde1
Convert old-style definitions
Andreas Schwab <schwab@linux-m68k.org>
parents:
109165
diff
changeset
|
2526 ftfont_variation_glyphs (struct font *font, int c, unsigned variations[256]) |
100792
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2527 { |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2528 struct ftfont_info *ftfont_info = (struct ftfont_info *) font; |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2529 OTF *otf = ftfont_get_otf (ftfont_info); |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2530 |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2531 if (! otf) |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2532 return 0; |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2533 return OTF_get_variation_glyphs (otf, c, variations); |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2534 } |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2535 |
e829a2083df5
(ftfont_driver): Set the member get_variation_glyphs to
Kenichi Handa <handa@m17n.org>
parents:
100552
diff
changeset
|
2536 #endif /* HAVE_OTF_GET_VARIATION_GLYPHS */ |
91137
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2537 #endif /* HAVE_LIBOTF */ |
00323e98bffb
Don't include Freetype headers. Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents:
91108
diff
changeset
|
2538 |
90676
c43c3837f597
(ftfont_pattern_entity): Add fontformat in a pattern.
Kenichi Handa <handa@m17n.org>
parents:
90623
diff
changeset
|
2539 Lisp_Object |
96429
5ee216cdf0e3
(fc_charset_table): New member lang.
Kenichi Handa <handa@m17n.org>
parents:
96076
diff
changeset
|
2540 ftfont_font_format (FcPattern *pattern, Lisp_Object filename) |
90676
c43c3837f597
(ftfont_pattern_entity): Add fontformat in a pattern.
Kenichi Handa <handa@m17n.org>
parents:
90623
diff
changeset
|
2541 { |
90680
254cfd053f9c
(ftfont_pattern_entity): Check if FC_FONTFORMAT is
Kenichi Handa <handa@m17n.org>
parents:
90676
diff
changeset
|
2542 FcChar8 *str; |
90676
c43c3837f597
(ftfont_pattern_entity): Add fontformat in a pattern.
Kenichi Handa <handa@m17n.org>
parents:
90623
diff
changeset
|
2543 |
90680
254cfd053f9c
(ftfont_pattern_entity): Check if FC_FONTFORMAT is
Kenichi Handa <handa@m17n.org>
parents:
90676
diff
changeset
|
2544 #ifdef FC_FONTFORMAT |
96429
5ee216cdf0e3
(fc_charset_table): New member lang.
Kenichi Handa <handa@m17n.org>
parents:
96076
diff
changeset
|
2545 if (pattern) |
95433
3ffecc48d809
(ftfont_font_format): Don't use strcasestr.
Kenichi Handa <handa@m17n.org>
parents:
95358
diff
changeset
|
2546 { |
96429
5ee216cdf0e3
(fc_charset_table): New member lang.
Kenichi Handa <handa@m17n.org>
parents:
96076
diff
changeset
|
2547 if (FcPatternGetString (pattern, FC_FONTFORMAT, 0, &str) != FcResultMatch) |
5ee216cdf0e3
(fc_charset_table): New member lang.
Kenichi Handa <handa@m17n.org>
parents:
96076
diff
changeset
|
2548 return Qnil; |
5ee216cdf0e3
(fc_charset_table): New member lang.
Kenichi Handa <handa@m17n.org>
parents:
96076
diff
changeset
|
2549 if (strcmp ((char *) str, "TrueType") == 0) |
95433
3ffecc48d809
(ftfont_font_format): Don't use strcasestr.
Kenichi Handa <handa@m17n.org>
parents:
95358
diff
changeset
|
2550 return intern ("truetype"); |
96429
5ee216cdf0e3
(fc_charset_table): New member lang.
Kenichi Handa <handa@m17n.org>
parents:
96076
diff
changeset
|
2551 if (strcmp ((char *) str, "Type 1") == 0) |
95433
3ffecc48d809
(ftfont_font_format): Don't use strcasestr.
Kenichi Handa <handa@m17n.org>
parents:
95358
diff
changeset
|
2552 return intern ("type1"); |
96429
5ee216cdf0e3
(fc_charset_table): New member lang.
Kenichi Handa <handa@m17n.org>
parents:
96076
diff
changeset
|
2553 if (strcmp ((char *) str, "PCF") == 0) |
95433
3ffecc48d809
(ftfont_font_format): Don't use strcasestr.
Kenichi Handa <handa@m17n.org>
parents:
95358
diff
changeset
|
2554 return intern ("pcf"); |
96429
5ee216cdf0e3
(fc_charset_table): New member lang.
Kenichi Handa <handa@m17n.org>
parents:
96076
diff
changeset
|
2555 if (strcmp ((char *) str, "BDF") == 0) |
95433
3ffecc48d809
(ftfont_font_format): Don't use strcasestr.
Kenichi Handa <handa@m17n.org>
parents:
95358
diff
changeset
|
2556 return intern ("bdf"); |
3ffecc48d809
(ftfont_font_format): Don't use strcasestr.
Kenichi Handa <handa@m17n.org>
parents:
95358
diff
changeset
|
2557 } |
96429
5ee216cdf0e3
(fc_charset_table): New member lang.
Kenichi Handa <handa@m17n.org>
parents:
96076
diff
changeset
|
2558 #endif /* FC_FONTFORMAT */ |
5ee216cdf0e3
(fc_charset_table): New member lang.
Kenichi Handa <handa@m17n.org>
parents:
96076
diff
changeset
|
2559 if (STRINGP (filename)) |
5ee216cdf0e3
(fc_charset_table): New member lang.
Kenichi Handa <handa@m17n.org>
parents:
96076
diff
changeset
|
2560 { |
5ee216cdf0e3
(fc_charset_table): New member lang.
Kenichi Handa <handa@m17n.org>
parents:
96076
diff
changeset
|
2561 int len = SBYTES (filename); |
5ee216cdf0e3
(fc_charset_table): New member lang.
Kenichi Handa <handa@m17n.org>
parents:
96076
diff
changeset
|
2562 |
5ee216cdf0e3
(fc_charset_table): New member lang.
Kenichi Handa <handa@m17n.org>
parents:
96076
diff
changeset
|
2563 if (len >= 4) |
5ee216cdf0e3
(fc_charset_table): New member lang.
Kenichi Handa <handa@m17n.org>
parents:
96076
diff
changeset
|
2564 { |
5ee216cdf0e3
(fc_charset_table): New member lang.
Kenichi Handa <handa@m17n.org>
parents:
96076
diff
changeset
|
2565 str = (FcChar8 *) (SDATA (filename) + len - 4); |
5ee216cdf0e3
(fc_charset_table): New member lang.
Kenichi Handa <handa@m17n.org>
parents:
96076
diff
changeset
|
2566 if (xstrcasecmp ((char *) str, ".ttf") == 0) |
5ee216cdf0e3
(fc_charset_table): New member lang.
Kenichi Handa <handa@m17n.org>
parents:
96076
diff
changeset
|
2567 return intern ("truetype"); |
5ee216cdf0e3
(fc_charset_table): New member lang.
Kenichi Handa <handa@m17n.org>
parents:
96076
diff
changeset
|
2568 if (xstrcasecmp ((char *) str, ".pfb") == 0) |
5ee216cdf0e3
(fc_charset_table): New member lang.
Kenichi Handa <handa@m17n.org>
parents:
96076
diff
changeset
|
2569 return intern ("type1"); |
5ee216cdf0e3
(fc_charset_table): New member lang.
Kenichi Handa <handa@m17n.org>
parents:
96076
diff
changeset
|
2570 if (xstrcasecmp ((char *) str, ".pcf") == 0) |
5ee216cdf0e3
(fc_charset_table): New member lang.
Kenichi Handa <handa@m17n.org>
parents:
96076
diff
changeset
|
2571 return intern ("pcf"); |
5ee216cdf0e3
(fc_charset_table): New member lang.
Kenichi Handa <handa@m17n.org>
parents:
96076
diff
changeset
|
2572 if (xstrcasecmp ((char *) str, ".bdf") == 0) |
5ee216cdf0e3
(fc_charset_table): New member lang.
Kenichi Handa <handa@m17n.org>
parents:
96076
diff
changeset
|
2573 return intern ("bdf"); |
5ee216cdf0e3
(fc_charset_table): New member lang.
Kenichi Handa <handa@m17n.org>
parents:
96076
diff
changeset
|
2574 } |
5ee216cdf0e3
(fc_charset_table): New member lang.
Kenichi Handa <handa@m17n.org>
parents:
96076
diff
changeset
|
2575 } |
90676
c43c3837f597
(ftfont_pattern_entity): Add fontformat in a pattern.
Kenichi Handa <handa@m17n.org>
parents:
90623
diff
changeset
|
2576 return intern ("unknown"); |
c43c3837f597
(ftfont_pattern_entity): Add fontformat in a pattern.
Kenichi Handa <handa@m17n.org>
parents:
90623
diff
changeset
|
2577 } |
c43c3837f597
(ftfont_pattern_entity): Add fontformat in a pattern.
Kenichi Handa <handa@m17n.org>
parents:
90623
diff
changeset
|
2578 |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2579 static const char *ftfont_booleans [] = { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2580 ":antialias", |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2581 ":hinting", |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2582 ":verticallayout", |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2583 ":autohint", |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2584 ":globaladvance", |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2585 ":outline", |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2586 ":scalable", |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2587 ":minspace", |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2588 ":embolden", |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2589 NULL, |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2590 }; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2591 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2592 static const char *ftfont_non_booleans [] = { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2593 ":family", |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2594 ":familylang", |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2595 ":style", |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2596 ":stylelang", |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2597 ":fullname", |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2598 ":fullnamelang", |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2599 ":slant", |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2600 ":weight", |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2601 ":size", |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2602 ":width", |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2603 ":aspect", |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2604 ":pixelsize", |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2605 ":spacing", |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2606 ":foundry", |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2607 ":hintstyle", |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2608 ":file", |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2609 ":index", |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2610 ":ftface", |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2611 ":rasterizer", |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2612 ":scale", |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2613 ":dpi", |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2614 ":rgba", |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2615 ":lcdfilter", |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2616 ":charset", |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2617 ":lang", |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2618 ":fontversion", |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2619 ":capability", |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2620 NULL, |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2621 }; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2622 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2623 static void |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
2624 ftfont_filter_properties (Lisp_Object font, Lisp_Object alist) |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2625 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2626 Lisp_Object it; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2627 int i; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2628 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2629 /* Set boolean values to Qt or Qnil */ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2630 for (i = 0; ftfont_booleans[i] != NULL; ++i) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2631 for (it = alist; ! NILP (it); it = XCDR (it)) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2632 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2633 Lisp_Object key = XCAR (XCAR (it)); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2634 Lisp_Object val = XCDR (XCAR (it)); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2635 char *keystr = SDATA (SYMBOL_NAME (key)); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2636 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2637 if (strcmp (ftfont_booleans[i], keystr) == 0) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2638 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2639 char *str = SYMBOLP (val) ? SDATA (SYMBOL_NAME (val)) : NULL; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2640 if (INTEGERP (val)) str = XINT (val) != 0 ? "true" : "false"; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2641 if (str == NULL) str = "true"; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2642 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2643 val = Qt; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2644 if (strcmp ("false", str) == 0 || strcmp ("False", str) == 0 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2645 || strcmp ("FALSE", str) == 0 || strcmp ("FcFalse", str) == 0 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2646 || strcmp ("off", str) == 0 || strcmp ("OFF", str) == 0 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2647 || strcmp ("Off", str) == 0) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2648 val = Qnil; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2649 Ffont_put (font, key, val); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2650 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2651 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2652 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2653 for (i = 0; ftfont_non_booleans[i] != NULL; ++i) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2654 for (it = alist; ! NILP (it); it = XCDR (it)) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2655 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2656 Lisp_Object key = XCAR (XCAR (it)); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2657 Lisp_Object val = XCDR (XCAR (it)); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2658 char *keystr = SDATA (SYMBOL_NAME (key)); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2659 if (strcmp (ftfont_non_booleans[i], keystr) == 0) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2660 Ffont_put (font, key, val); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2661 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2662 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2663 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
2664 |
90400 | 2665 void |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
2666 syms_of_ftfont (void) |
90400 | 2667 { |
90464
4702b592db4c
(Qmonospace, Qsans_serif, Qserif, Qmono, Qsans)
Kenichi Handa <handa@m17n.org>
parents:
90450
diff
changeset
|
2668 DEFSYM (Qfreetype, "freetype"); |
4702b592db4c
(Qmonospace, Qsans_serif, Qserif, Qmono, Qsans)
Kenichi Handa <handa@m17n.org>
parents:
90450
diff
changeset
|
2669 DEFSYM (Qmonospace, "monospace"); |
4702b592db4c
(Qmonospace, Qsans_serif, Qserif, Qmono, Qsans)
Kenichi Handa <handa@m17n.org>
parents:
90450
diff
changeset
|
2670 DEFSYM (Qsans_serif, "sans-serif"); |
4702b592db4c
(Qmonospace, Qsans_serif, Qserif, Qmono, Qsans)
Kenichi Handa <handa@m17n.org>
parents:
90450
diff
changeset
|
2671 DEFSYM (Qserif, "serif"); |
4702b592db4c
(Qmonospace, Qsans_serif, Qserif, Qmono, Qsans)
Kenichi Handa <handa@m17n.org>
parents:
90450
diff
changeset
|
2672 DEFSYM (Qmono, "mono"); |
4702b592db4c
(Qmonospace, Qsans_serif, Qserif, Qmono, Qsans)
Kenichi Handa <handa@m17n.org>
parents:
90450
diff
changeset
|
2673 DEFSYM (Qsans, "sans"); |
4702b592db4c
(Qmonospace, Qsans_serif, Qserif, Qmono, Qsans)
Kenichi Handa <handa@m17n.org>
parents:
90450
diff
changeset
|
2674 DEFSYM (Qsans__serif, "sans serif"); |
4702b592db4c
(Qmonospace, Qsans_serif, Qserif, Qmono, Qsans)
Kenichi Handa <handa@m17n.org>
parents:
90450
diff
changeset
|
2675 |
90400 | 2676 staticpro (&freetype_font_cache); |
90441
d63258b13d84
(Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved to
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
2677 freetype_font_cache = Fcons (Qt, Qnil); |
90400 | 2678 |
90464
4702b592db4c
(Qmonospace, Qsans_serif, Qserif, Qmono, Qsans)
Kenichi Handa <handa@m17n.org>
parents:
90450
diff
changeset
|
2679 staticpro (&ftfont_generic_family_list); |
4702b592db4c
(Qmonospace, Qsans_serif, Qserif, Qmono, Qsans)
Kenichi Handa <handa@m17n.org>
parents:
90450
diff
changeset
|
2680 ftfont_generic_family_list |
4702b592db4c
(Qmonospace, Qsans_serif, Qserif, Qmono, Qsans)
Kenichi Handa <handa@m17n.org>
parents:
90450
diff
changeset
|
2681 = Fcons (Fcons (Qmonospace, Qt), |
4702b592db4c
(Qmonospace, Qsans_serif, Qserif, Qmono, Qsans)
Kenichi Handa <handa@m17n.org>
parents:
90450
diff
changeset
|
2682 Fcons (Fcons (Qsans_serif, Qt), |
4702b592db4c
(Qmonospace, Qsans_serif, Qserif, Qmono, Qsans)
Kenichi Handa <handa@m17n.org>
parents:
90450
diff
changeset
|
2683 Fcons (Fcons (Qsans, Qt), Qnil))); |
90400 | 2684 |
95103 | 2685 staticpro (&ft_face_cache); |
2686 ft_face_cache = Qnil; | |
2687 | |
90400 | 2688 ftfont_driver.type = Qfreetype; |
2689 register_font_driver (&ftfont_driver, NULL); | |
2690 } | |
90427 | 2691 |
2692 /* arch-tag: 7cfa432c-33a6-4988-83d2-a82ed8604aca | |
2693 (do not change this comment) */ |