Comments improved.
[m17n/m17n-lib.git] / src / m17n-flt.h
1 /* m17n-flt.h -- header file for the FLT API of the m17n library.
2    Copyright (C) 2007, 2008, 2009, 2010
3      National Institute of Advanced Industrial Science and Technology (AIST)
4      Registration Number H15PRO112
5
6    This file is part of the m17n library.
7
8    The m17n library is free software; you can redistribute it and/or
9    modify it under the terms of the GNU Lesser General Public License
10    as published by the Free Software Foundation; either version 2.1 of
11    the License, or (at your option) any later version.
12
13    The m17n library is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16    Lesser General Public License for more details.
17
18    You should have received a copy of the GNU Lesser General Public
19    License along with the m17n library; if not, write to the Free
20    Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21    02111-1307, USA.  */
22
23 #ifndef _M17N_FLT_H_
24 #define _M17N_FLT_H_
25
26 #ifndef _M17N_CORE_H_
27 #include <m17n-core.h>
28 #endif
29
30 M17N_BEGIN_HEADER
31
32 #if !defined (FOR_DOXYGEN) || defined (DOXYGEN_INTERNAL_MODULE)
33
34 extern void m17n_init_flt (void);
35 #undef M17N_INIT
36 #ifdef _M17N_H_
37 #define M17N_INIT()                     \
38   do {                                  \
39     m17n_init ();                       \
40     if (merror_code == MERROR_NONE)     \
41       m17n_init_flt ();                 \
42   } while (0)
43 #else  /* not _M17N_H_ */
44 #define M17N_INIT() m17n_init_flt ()
45 #endif  /* not _M17N_H_ */
46
47 extern void m17n_fini_flt (void);
48 #undef M17N_FINI
49 #ifdef _M17N_H_
50 #define M17N_FINI()     \
51   do {                  \
52     m17n_fini_flt ();   \
53     m17n_fini ();       \
54   } while (0)
55 #else  /* not _M17N_H_ */
56 #define M17N_FINI() m17n_fini_flt ()
57 #endif  /* not _M17N_H_ */
58
59 #endif
60
61 /***en @defgroup m17nFLT FLT API
62     @brief API provided by libm17n-flt.so */
63 /***ja @defgroup m17nFLT FLT API
64     @brief libm17n-flt.so ¤¬Ä󶡤¹¤ë API */
65 /*=*/
66
67 /*** @addtogroup m17nFLT */
68 /*** @{ */
69 /*=*/
70
71 /***en
72     @brief Type of information about a glyph.
73
74     The type #MFLTGlyph is the structure that contains information
75     about a glyph.  */
76
77 /***ja
78     @brief ¥°¥ê¥Õ¤Ë´Ø¤¹¤ë¾ðÊó¤Î·¿.
79
80     ·¿ #MFLTGlyph ¤Ï¡¢¥°¥ê¥Õ¤Ë´Ø¤¹¤ë¾ðÊó¤ò³ÊǼ¤¹¤ë¹½Â¤ÂΤǤ¢¤ë¡£  */
81
82 typedef struct
83 {
84   /***en Character code (Unicode) of the glyph.  This is the sole
85       member to be set before calling the functions mflt_find () and
86       mflt_run ().  */
87   /***ja ¥°¥ê¥Õ¤Î (Unicode ¤Ë¤ª¤±¤ë) Ê¸»ú¥³¡¼¥É¡£´Ø¿ô
88       mflt_find () ¤È mflt_run ()
89       ¤ò¸Æ¤Ó½Ð¤¹Á°¥»¥Ã¥È¤¹¤Ù¤­Í£°ì¤Î¥á¥ó¥Ð¡¼¤Ç¤¢¤ë¡£  */
90   int c;
91   /***en Glyph ID of the glyph in the font.  */
92   /***ja ¥Õ¥©¥ó¥ÈÆâ¤Ë¤ª¤±¤ë¤½¤Î¥°¥ê¥Õ¤Î ID¡£  */
93   unsigned int code;
94   /***en Starting index of the run in #MFLTGlyphString that is
95       replaced by this glyph.  */
96   /***ja #MFLTGlyphString
97       ¤ÎÃæ¤Ç¡¢¤³¤Î¥°¥ê¥Õ¤Ë¤è¤Ã¤ÆÃÖ¤­´¹¤¨¤é¤ì¤ëÉôʬ¤ÎÀèƬ¤Î¥¤¥ó¥Ç¥¯¥¹¡£  */
98   int from;
99   /***en Ending index of the run in #MFLTGlyphString that is
100       replaced by this glyph.  */
101   /***ja #MFLTGlyphString
102       ¤ÎÃæ¤Ç¡¢¤³¤Î¥°¥ê¥Õ¤Ë¤è¤Ã¤ÆÃÖ¤­´¹¤¨¤é¤ì¤ëÉôʬ¤ÎËöÈø¤Î¥¤¥ó¥Ç¥¯¥¹¡£  */
103   int to;
104   /***en Advance width for horizontal layout expressed in 26.6
105       fractional pixel format.  */
106   /***ja ²£½ñ¤­»þ¤ÎÁ÷¤êÉý¤ò 26.6 fractional pixel format ¤Çɽ¸½¤·¤¿¤â¤Î¡£  */
107   int xadv;
108   /***en Advance height for vertical layout expressed in 26.6
109       fractional pixel format.  */
110   /***ja ½Ä½ñ¤­»þ¤ÎÁ÷¤ê¹â¤ò 26.6 fractional pixel format ¤Çɽ¸½¤·¤¿¤â¤Î¡£  */
111   int yadv;
112   /* @{ */
113   /***en Ink metrics of the glyph expressed in 26.6 fractional pixel
114       format.  */
115   /***ja ¤³¤Î¥°¥ê¥Õ¤Î¥¤¥ó¥¯¥á¥È¥ê¥Ã¥¯¤ò 26.6 fractional pixel format
116       ¤Çɽ¸½¤·¤¿¤â¤Î¡£  */
117   int ascent, descent, lbearing, rbearing;
118   /* @} */
119   /* @{ */
120   /***en Horizontal and vertical adjustments for the glyph positioning
121       expressed in 26.6 fractional pixel format.  */
122   /***ja ¥°¥ê¥Õ°ÌÃÖ·è¤á¤ÎºÝ¤Î¿åÊ¿¡¦¿âľĴÀ°Ãͤò¡¢
123       26.6 fractional pixel format ¤Çɽ¸½¤·¤¿¤â¤Î¡£  */
124   int xoff, yoff;
125   /* @} */
126   /***en Flag to tell whether the member \<code\> has already been set
127       to a glyph ID in the font.  */
128   /***ja ¥á¥ó¥Ð¡¼ \<code\> ¤Ë´û¤Ë¥°¥ê¥Õ ID
129       ¤¬¥»¥Ã¥È¤µ¤ì¤Æ¤¤¤ë¤«Èݤ«¤ò¼¨¤¹¥Õ¥é¥°¡£  */
130   unsigned encoded : 1;
131   /***en Flag to tell if the metrics of the glyph (members \<xadv\> thru
132       \<rbearing\>) are already calculated.  */
133   /***ja ¥á¥ó¥Ð¡¼ \<xadv\> ¤«¤é \<rbearing\>
134       ¤Þ¤Ç¤Î³Æ¥á¥È¥ê¥Ã¥¯¤¬´û¤Ë·×»»ºÑ¤«Èݤ«¤ò¼¨¤¹¥Õ¥é¥°¡£  */
135   unsigned measured : 1;
136   /***en Flag to tell if the metrics of the glyph is adjusted,
137       i.e. \<xadv\> or \<yadv\> is different from the normal size, or
138       \<xoff\> or \<yoff\> is nonzero.  */
139   /***ja ¥°¥ê¥Õ¤Î¥á¥È¥ê¥Ã¥¯¤¬Ä´À°ºÑ¤ß¤«Èݤ«¡¢
140       ¤¹¤Ê¤ï¤Á°Ê²¼¤Î¤¦¤Á1¤Ä°Ê¾å¤¬À®Î©¤·¤Æ¤¤¤ë¤³¤È¤ò¼¨¤¹¥Õ¥é¥°¡£
141       \<xadv\> ¤¬É¸½à¤ÎÃͤȰۤʤ롢
142       \<yadv\> ¤¬É¸½à¤ÎÃͤȰۤʤ롢
143       \<xoff\> ¤¬¥¼¥í¤Ç¤Ê¤¤¡¢
144       \<yoff\> ¤¬¥¼¥í¤Ç¤Ê¤¤¡£  */
145   unsigned adjusted : 1;
146   /***en For m17n-lib's internal use only.  */
147   /***ja m17n-lib ÆâÉôºî¶ÈÍÑ¡£  */
148   unsigned internal : 30;
149
150   /* Arbitrary data can follow.  */
151 } MFLTGlyph;
152
153 /*=*/
154
155 /***en
156     @brief Type of information about a glyph position adjustment.
157
158     The type #MFLTGlyphAdjustment is the structure to store
159     information about a glyph metrics/position adjustment.  It is
160     given to the callback function @b drive_otf of #MFLTFont.  */
161
162 /***ja
163     @brief ¥°¥ê¥Õ°ÌÃÖÄ´À°¾ðÊó¤Î¤¿¤á¤Î·¿.
164
165     ·¿ #MFLTGlyphAdjustment
166     ¤Ï¡¢¥°¥ê¥Õ¤Î¥á¥È¥ê¥Ã¥¯/°ÌÃÖ¤ÎÄ´À°¤Ë´Ø¤¹¤ë¾ðÊó¤ò³ÊǼ¤¹¤ë¤¿¤á¤Î¹½Â¤ÂΤǤ¢¤ê¡¢
167     #MFLTFont ¤Î callback ´Ø¿ô @b drive_otf ¤ËÅϤµ¤ì¤ë¡£  */
168
169 typedef struct
170 {
171   /* @{ */
172   /***en Adjustments for advance width for horizontal layout and
173       advance height for vertical layout expressed in 26.6 fractional
174       pixel format.  */
175   /***ja ¿åÊ¿¡¦¿âľÊý¸þ¤ÎÁ÷¤êÎ̤ÎÄ´À°Ãͤò 26.6 fractional pixel format
176       ¤Çɽ¸½¤·¤¿¤â¤Î¡£  */
177   int xadv, yadv;
178   /* @} */
179   /* @{ */
180   /***en Horizontal and vertical adjustments for glyph positioning
181       expressed in 26.6 fractional pixel format.  */
182   /***ja ¥°¥ê¥Õ°ÌÃÖ·è¤á¤¿¤á¤Î¿åÊ¿¡¦¿âľĴÀ°Ãͤò 26.6 fractional pixel
183       format ¤Çɽ¸½¤·¤¿¤â¤Î¡£  */
184   int xoff, yoff;
185   /* @} */
186   /***en Number of glyphs to go back for drawing a glyph.  */
187   /***ja ¥°¥ê¥ÕÉÁ²è¤Î¤¿¤á¤ËÌá¤ë¤Ù¤­¥°¥ê¥Õ¿ô¡£  */
188   short back;
189   /***en If nonzero, the member \<xadv\> and \<yadv\> are absolute, i.e.,
190       they should not be added to a glyph's origianl advance width and
191       height.  */
192   /***ja Èó¥¼¥í¤Î¤È¤­¡¢¥á¥ó¥Ð¡¼ \<xadv\> ¤È \<yadv\> ¤ÏÀäÂÐÃͤǤ¢¤ë¡£
193       ¤¹¤Ê¤ï¤Á¤½¤ÎÃͤò¥°¥ê¥ÕËÜÍè¤ÎÁ÷¤êÉý¤Ë²Ã»»¤·¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£  */
194   unsigned advance_is_absolute : 1;
195   /***en Should be set to 1 iff at least one of the other members has
196       a nonzero value.  */
197   /***ja Â¾¤Î¥á¥ó¥Ð¡¼¤Î¤¦¤ÁºÇÄã1¸Ä¤¬Èó¥¼¥í¤Î¤È¤­¤Î¤ß¡¢1¤Ë¥»¥Ã¥È¤µ¤ì¤ë¡£  */
198   unsigned set : 1;
199 } MFLTGlyphAdjustment;
200
201 /*=*/
202
203 /***en
204     @brief Type of information about a glyph sequence.
205
206     The type #MFLTGlyphString is the structure that contains
207     information about a sequence of glyphs.  */
208
209 /***ja
210     @brief ¥°¥ê¥ÕÎó¤Î¾ðÊó¤Î¤¿¤á¤Î·¿.
211
212     ·¿ #MFLTGlyphString ¤Ï¡¢¥°¥ê¥ÕÎó¤Î¾ðÊó¤ò³ÊǼ¤¹¤ë¤¿¤á¤Î¹½Â¤ÂΤǤ¢¤ë¡£  */
213
214 typedef struct
215 {
216   /***en The actual byte size of elements of the array pointed by the
217       member #glyphs.  It must be equal to or greater than "sizeof
218       (MFLTGlyph)".  */
219   /***ja ¥á¥ó¥Ð¡¼ #glyphs ¤Î»Ø¤¹ÇÛÎó¤ÎÍ×ÁǤ¬Àê¤á¤ë¼Â¥Ð¥¤¥È¿ô¡£
220       ¤³¤ÎÃͤϠ"sizeof (MFLTGlyph)" °Ê¾å¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£  */
221   int glyph_size;
222   /***en Array of glyphs.  */
223   /***ja ¥°¥ê¥Õ¤ÎÇÛÎó¡£  */
224   MFLTGlyph *glyphs;
225   /***en Number of elements allocated in #glyphs.  */
226   /***ja #glyphs Æâ¤ËÇÛÃÖ¤µ¤ì¤Æ¤¤¤ëÍ×ÁǤοô¡£  */
227   int allocated;
228   /***en Number of elements in #glyphs in use.  */
229   /***ja #glyphs Æâ¤Ç»ÈÍÑÃæ¤ÎÍ×ÁǤοô¡£  */
230   int used;
231   /***en Flag to tell if the glyphs should be drawn from right-to-left
232       or not.  */
233   /***ja ¥°¥ê¥Õ¤¬±¦¤«¤éº¸¤Ø¤ÈÉÁ¤«¤ì¤ë¤Ù¤­¤«Èݤ«¤ò¼¨¤¹¥Õ¥é¥°¡£  */
234   unsigned int r2l;
235 } MFLTGlyphString;
236
237 /*=*/
238
239 /***en
240     @brief Type of specification of GSUB and GPOS OpenType tables.
241
242     The type #MFLTOtfSpec is the structure that contains information
243     about the GSUB and GPOS features of a specific script and language
244     system.  The information is used to select which features to
245     apply to a glyph string, or to check if a specific FLT is usable
246     for a specific font.  */
247
248 /***ja
249     @brief GSUB ¤ª¤è¤Ó GPOS OpenType ¥Æ¡¼¥Ö¥ë¤Î»ÅÍͤΤ¿¤á¤Î·¿.
250
251     ·¿ #MFLTOtfSpec ¤Ï¡¢GSUB ¤ª¤è¤Ó GPOS¥Õ¥£¡¼¥Á¥ã¡¼¤Î¾ðÊó¤ò³ÊǼ¤¹¤ë¤¿
252     ¤á¤Î¹½Â¤ÂΤǤ¢¤ë¡£¤³¤ì¤é¥Õ¥£¡¼¥Á¥ã¡¼¤ÏÆÃÄê¤Î¥¹¥¯¥ê¥×¥È¤ª¤è¤Ó¸À¸ì¥·
253     ¥¹¥Æ¥à¤Î¤â¤Î¤Ç¤¢¤ë¡£¤³¤Î¾ðÊó¤Ï¡¢¤É¤Î¥Õ¥£¡¼¥Á¥ã¡¼¤ò¥°¥ê¥ÕÎó¤ËŬÍѤ¹
254     ¤ë¤«¡¢¤¢¤ë¤¤¤ÏÆÃÄê¤Î FLT ¤¬ÆÃÄê¤Î¥Õ¥©¥ó¥È¤ËÂФ·¤ÆÍ­¸ú¤«¤É¤¦¤«¤Î·èÄê
255     ¤Ë»ÈÍѤµ¤ì¤ë¡£  */
256
257 typedef struct
258 {
259   /***en Unique symbol representing the spec.  This is the same as the
260       @ref OTF-SPEC of the FLT.  */
261   /***ja ¤³¤Î»ÅÍͤòɽ¤ï¤¹¥æ¥Ë¡¼¥¯¤Ê¥·¥ó¥Ü¥ë¡£
262       FLT ¤Î @ref OTF-SPEC ¤ÈƱ°ì¤ÎÃͤǤ¢¤ë¡£  */
263   MSymbol sym;
264
265   /* @{ */
266   /***en Tags for script and language system.  */
267   /***ja ¥¹¥¯¥ê¥×¥È¤ª¤è¤Ó¸À¸ì¥·¥¹¥Æ¥à¤Î¥¿¥°¡£  */
268   unsigned int script, langsys;
269   /* @} */
270
271   /***en Array of GSUB (1st element) and GPOS (2nd element) feature
272       tag arrays.  Each array is terminated by 0.  It may be NULL if
273       there is no feature to specify.
274
275       (1) The case of using this information for selecting which
276       features to apply to a glyph string.  If the array is NULL,
277       apply no feature.  If the first element is 0, apply all
278       available features.  If the first element is 0xFFFFFFFF, apply
279       all available features except for what appear in the second and
280       following elements.  Otherwise, apply all listed features.
281
282       (1) The case of using this information for checking if a a font
283       can be drived by a specific FLT.  If the array is NULL, the font
284       should not have any features.  If the first elements is 0, don't
285       check the font.  Otherwize, the font should have all features
286       before 0xFFFFFFFF element (if any) and should not have any
287       features after that element.  */
288   /***ja GSUB ¥Õ¥£¡¼¥Á¥ã¡¼¥¿¥°¤ÎÇÛÎó¤òÂè1Í×ÁÇ¡¢GPOS ¥Õ¥£¡¼¥Á¥ã¡¼¥¿¥°¤Î
289       ÇÛÎó¤òÂè2Í×ÁǤȤ¹¤ëÇÛÎó¡£³ÆÇÛÎó¤ÎËöÈø¤Ï0¤Ç¼¨¤µ¤ì¤ë¡£¥Õ¥£¡¼¥Á¥ã¡¼
290       ¤Î»ØÄ꤬1¤Ä¤â¤Ê¤¤¾ì¹ç¤Ï¤³¤ÎÇÛÎó¤ÎÍ×ÁǤϠNULL ¤Ç¤â¤è¤¤¡£
291
292       (1) ¤³¤Î¾ðÊ󤬥°¥ê¥ÕÎó¤ËŬÍѤ¹¤Ù¤­¥Õ¥£¡¼¥Á¥ã¡¼¤ÎÁªÂò¤Ë»È¤ï¤ì¤ë¾ì
293       ¹ç¡£¤â¤·ÇÛÎ󼫿Ȥ¬NULL¤Ê¤é¡¢¤É¤Î¥Õ¥£¡¼¥Á¥ã¡¼¤âŬÍѤ·¤Ê¤¤¡£¤â¤·ºÇ
294       ½é¤ÎÍ×ÁǤ¬0¤Ê¤é¡¢Å¬ÍѲÄǽ¤Ê¤¹¤Ù¤Æ¤Î¥Õ¥£¡¼¥Á¥ã¡¼¤òŬÍѤ¹¤ë¡£¤â¤·ºÇ
295       ½é¤ÎÍ×ÁǤ¬ 0xFFFFFFFF ¤Ê¤é¡¢£²ÈÖÌܰʹߤΥե£¡¼¥Á¥ã¡¼¤ò½ü¤¯¤¹¤Ù¤Æ
296       ¤ÎŬÍѲÄǽ¤Ê¥Õ¥£¡¼¥Á¥ã¡¼¤òŬÍѤ¹¤ë¡£¤½¤ì°Ê³°¤Î¾ì¹ç¥ê¥¹¥È¤µ¤ì¤¿¤¹
297       ¤Ù¤Æ¤Î¥Õ¥£¡¼¥Á¥ã¡¼¤òŬÍѤ¹¤ë¡£
298
299       (2) ¤³¤Î¾ðÊó¤¬ÆÃÄê¤Î FLT ¤¬ÆÃÄê¤Î¥Õ¥©¥ó¥È¤ËÍ­¸ú¤«¤É¤¦¤«¤Î·èÄê¤Ë»È
300       ¤ï¤ì¤ë¾ì¹ç¡£¤â¤·ÇÛÎ󼫿Ȥ¬NULL¤Ê¤é¡¢¥Õ¥©¥ó¥È¤Ï¥Õ¥£¡¼¥Á¥ã¡¼¤ò°ì¤Ä
301       ¤â»ý¤Ã¤Æ¤¤¤Æ¤Ï¤¤¤±¤Ê¤¤¡£¤â¤·ºÇ½é¤ÎÍ×ÁǤ¬0¤Ê¤é¡¢¤É¤ó¤Ê¥Õ¥©¥ó¥È¤Ç¤â
302       Îɤ¤¡£¤â¤·ºÇ½é¤ÎÍ×ÁǤ¬0xFFFFFFFF¤Ê¤é¡¢¥Õ¥©¥ó¥È¤Ï£²ÈÖÌܤÎÍ×Áǰʹß
303       ¤Î¥Õ¥©¥ó¥È¤ò»ý¤Ã¤Æ¤¤¤Æ¤Ï¤¤¤±¤Ê¤¤¡£¤½¤ì°Ê³°¤Î¾ì¹ç¡¢¥Õ¥©¥ó¥È¤Ï
304       0xFFFFFFFF °ÊÁ°¤Î¤¹¤Ù¤Æ¤Î¥Õ¥£¡¼¥Á¥ã¡¼¤ò»ý¤Á¡¢¤«¤Ä 0xFFFFFFFF °Ê¹ß
305       ¤Î¥Õ¥£¡¼¥Á¥ã¡¼¤Ï°ì¤Ä¤â»ý¤Ã¤Æ¤¤¤Æ¤Ï¤¤¤±¤Ê¤¤¡£*/
306   unsigned int *features[2];
307 } MFLTOtfSpec;
308
309 /*=*/
310
311 /***en
312     @brief Type of font to be used by the FLT driver.
313
314     The type #MFLTFont is the structure that contains information
315     about a font used by the FLT driver.  Usually, an application
316     should prepare a bigger structure whose first element is MFLTFont
317     and has more information about the font that is used by callback
318     funcitons, and give that structure to mflt functions by coercing
319     it to MFLTFont.  It is assured that callback functions can safely
320     coerce MFLTFont back to the original structure.  */
321
322 /***ja
323     @brief FLT ¥É¥é¥¤¥Ð¤¬»È¤¦¥Õ¥©¥ó¥È¤Î·¿.
324
325     ·¿ #MFLTFont ¤Ï¡¢FLT¥É¥é¥¤¥Ð¤¬»È¤¦¥Õ¥©¥ó¥È¤Ë´Ø¤¹¤ë¾ðÊó¤ò³ÊǼ¤¹¤ë¤¿
326     ¤á¤Î¹½Â¤ÂΤǤ¢¤ë¡£Ä̾異¥×¥ê¥±¡¼¥·¥ç¥ó¤ÏºÇ½é¤ÎÍ×ÁǤ¬ MFLTFont ¤Ç¡¢
327     »Ä¤ê¤ÎÍ×ÁǤËcallback´Ø¿ô¤¬ÍøÍѤ¹¤ë¥Õ¥©¥ó¥È¾ðÊó¤ò»ý¤Ã¤¿¡¢¤è¤êÂ礭¤Ê
328     ¹½Â¤ÂΤòÍÑ°Õ¤·¡¢¤½¤ì¤ò MFLTFont ¤Ë coerce ¤·¤Æ mflt ¤Î³Æ´Ø¿ô¤ËÅϤ¹¡£
329     ³Æcallback´Ø¿ô¤Ï MFLTFont ¤ò¸µ¤Î¹½Â¤ÂΤˠcoerce ¤·Ä¾¤¹¤³¤È¤¬¤Ç¤­¤ë
330     ¤³¤È¤¬Êݾڤµ¤ì¤Æ¤¤¤ë¡£ */
331
332 typedef struct _MFLTFont
333 {
334   /***en Family name of the font.  It may be #Mnil if the family name
335      is not important in finding a Font Layout Table suitable for the
336      font (for instance, in the case that the font is an OpenType
337      font).  */
338   /***ja ¥Õ¥©¥ó¥È¤Î¥Õ¥¡¥ß¥ê¡¼Ì¾¡£¥Õ¥©¥ó¥È¤ËŬ¤·¤¿ FLT¤òõ¤¹ºÝ¤Ë½ÅÍפǤÊ
339       ¤¤¾ì¹ç (¤¿¤È¤¨¤Ð OpenType¥Õ¥©¥ó¥È¤Î¾ì¹ç¤Ê¤É) ¤Ï¡¢#Mnil ¤Ç¤è¤¤¡£ */
340   MSymbol family;
341
342   /***en Horizontal font sizes in pixels per EM.  */
343   /***ja ¥Õ¥©¥ó¥È¤Î¿åÊ¿¥µ¥¤¥º¤ò pixels per EM ¤Çɽ¸½¤·¤¿¤â¤Î¡£  */
344   int x_ppem;
345   /***en Vertical font sizes in pixels per EM.  */
346   /***ja ¥Õ¥©¥ó¥È¤Î¿âľ¥µ¥¤¥º¤ò pixels per EM ¤Çɽ¸½¤·¤¿¤â¤Î¡£  */
347   int y_ppem;
348
349   /***en Callback function to get glyph IDs for glyphs between FROM
350      (inclusive) and TO (exclusive) of GSTRING.  If the member \<encoded\>
351      of a glyph is zero, the member \<code\> of that glyph is a character
352      code.  The function must convert it to the glyph ID of FONT.  */
353   /***ja GSTRING Æâ¤Î FROM ¤«¤é TO Ä¾Á°¤Þ¤Ç¤Î³Æ¥°¥ê¥Õ¤ËÂбþ¤¹¤ë¥°¥ê¥Õ
354       ID¤ò¼èÆÀ¤¹¤ë¤¿¤á¤Î callback ´Ø¿ô¡£¤â¤·¤¢¤ë¥°¥ê¥Õ¤Î¥á¥ó¥Ð¡¼
355       \<encoded\>¤¬¥¼¥í¤Ê¤é¤Ð¡¢¤½¤Î¥°¥ê¥Õ¤Î¥á¥ó¥Ð¡¼ \<code\> ¤Ïʸ»ú¥³¡¼¥É¤Ç
356       ¤¢¤ë¡£¤³¤Î´Ø¿ô¤Ï¤½¤Îʸ»ú¥³¡¼¥É¤ò FONT ¤Î¥°¥ê¥Õ ID¤ËÊÑ´¹¤·¤Ê¤¯¤Æ¤Ï
357       ¤Ê¤é¤Ê¤¤¡£  */
358   int (*get_glyph_id) (struct _MFLTFont *font, MFLTGlyphString *gstring,
359                        int from, int to);
360
361   /***en Callback function to get metrics of glyphs between FROM
362      (inclusive) and TO (exclusive) of GSTRING.  If the member \<measured\>
363      of a glyph is zero, the function must set the members \<xadv\>, \<yadv\>,
364      \<ascent\>, \<descent\>, \<lbearing\>, and \<rbearing\> of the glyph.  */
365   /***ja GSTRING Æâ¤Î FROM ¤«¤é TOľÁ°¤Þ¤Ç¤Î³Æ¥°¥ê¥Õ¤ËÂбþ¤¹¤ë¥á¥È¥ê¥Ã
366       ¥¯¤ò¼èÆÀ¤¹¤ë¤¿¤á¤Î callback ´Ø¿ô¡£¤â¤·¤¢¤ë¥°¥ê¥Õ¤Î¥á¥ó¥Ð¡¼
367       \<measured\>¤¬¥¼¥í¤Ê¤é¤Ð¡¢¤³¤Î´Ø¿ô¤Ï¤½¤Î¥°¥ê¥Õ¤Î¥á¥ó¥Ð¡¼ \<xadv\>,
368       \<yadv\>, \<ascent\>, \<descent\>, \<lbearing\>, ¤ª¤è¤Ó \<rbearing\>¤ò¥»¥Ã
369       ¥È¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£  */
370   int (*get_metrics) (struct _MFLTFont *font, MFLTGlyphString *gstring,
371                      int from, int to);
372
373   /***en Callback function to check if the font has OpenType GSUB/GPOS
374      features for a specific script/language.  The function must
375      return 1, if the font satisfies SPEC, or 0.  It must be
376      NULL if the font does not have OpenType tables.  */
377   /***ja ¥Õ¥©¥ó¥È¤¬¤¢¤ëÆÃÄê¤Î¥¹¥¯¥ê¥×¥È/¸À¸ì¤ËÂФ¹¤ë GSUB/GPOS
378       OpenType¥Õ¥£¡¼¥Á¥ã¡¼¤ò»ý¤Ä¤«Èݤ«¤òÄ´¤Ù¤ë callback ´Ø¿ô¡£¤³¤Î´Ø¿ô
379       ¤Ï¥Õ¥©¥ó¥È¤¬SPEC ¤òËþ¤¿¤¹¤È¤­¤Ï 1 ¤ò¡¢¤½¤¦¤Ç¤Ê¤¤¤È¤­¤Ï 0¤òÊÖ¤µ¤Ê
380       ¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£¥Õ¥©¥ó¥È¤¬ OpenType ¥Æ¡¼¥Ö¥ë¤ò»ý¤¿¤Ê¤¤¤È¤­¤ÏNULL
381       ¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£  */
382   int (*check_otf) (struct _MFLTFont *font, MFLTOtfSpec *spec);
383
384   /***en Callback function to apply OpenType features in SPEC to glyphs
385      between FROM (inclusive) and TO (exclusive) of IN.  The resulting
386      glyphs are appended to the tail of OUT.  If OUT does not
387      have a room to store all the resulting glyphs, it must return -2.
388      It must be NULL if the font does not have OpenType tables.  */
389   /***ja IN Æâ¤Î FROM ¤«¤é TO Ä¾Á°¤Þ¤Ç¤Î³Æ¥°¥ê¥Õ¤Ë SPECÆâ¤Î³Æ OpenType
390       ¥Õ¥£¡¼¥Á¥ã¡¼¤òŬÍѤ¹¤ë¤¿¤á¤Î callback ´Ø¿ô¡£Å¬ÍÑ·ë²Ì¤Î¥°¥ê¥ÕÎó¤Ï
391       OUT ¤ÎËöÈø¤ËÄɲ䵤ì¤ë¡£OUT ¤¬Ã»¤«²á¤®¤Æ·ë²Ì¤òÄɲä·ÀÚ¤ì¤Ê¤¤¾ì¹ç
392       ¤Ï -2 ¤òÊÖ¤µ¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£¥Õ¥©¥ó¥È¤¬ OpenType ¥Æ¡¼¥Ö¥ë¤ò»ý¤¿
393       ¤Ê¤¤¾ì¹ç¤Ï NULL¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£  */
394   int (*drive_otf) (struct _MFLTFont *font, MFLTOtfSpec *spec,
395                     MFLTGlyphString *in, int from, int to,
396                     MFLTGlyphString *out, MFLTGlyphAdjustment *adjustment);
397
398   /***en For m17n-lib's internal use only.  It should be initialized
399       to NULL.  */
400   /***ja m17n-lib ¤ÎÆâÉôºî¶ÈÍÑ¡£NULL ¤Ë½éÃͲ½¤µ¤ì¤ë¡£  */
401   void *internal;
402 } MFLTFont;
403
404 /*=*/
405
406 /***en
407     @brief Type of FLT (Font Layout Table).
408
409     The type #MFLT is for an FLT object.  Its internal structure is
410     concealed from application programs.  */
411
412 /***ja
413     @brief FLT (Font Layout Table) ¤Î·¿.
414
415     ·¿ #MFLT ¤Ï FLT ¥ª¥Ö¥¸¥§¥¯¥È¤Î¤¿¤á¤Î·¿¤Ç¤¢¤ë¡£
416     ¤³¤ÎÆâÉô¹½Â¤¤Ï¡¢¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é¥à¤«¤é¤Ï±£Ê䵤ì¤Æ¤¤¤ë¡£  */
417
418 typedef struct _MFLT MFLT;
419
420 extern MFLT *mflt_get (MSymbol name);
421
422 extern MFLT *mflt_find (int c, MFLTFont *font);
423
424 extern const char *mflt_name (MFLT *flt);
425
426 extern MCharTable *mflt_coverage (MFLT *flt);
427
428 extern int mflt_run (MFLTGlyphString *gstring, int from, int to,
429                      MFLTFont *font, MFLT *flt);
430
431 extern int mflt_enable_new_feature;
432
433 extern MSymbol (*mflt_font_id) (MFLTFont *font);
434
435 extern int (*mflt_iterate_otf_feature) (MFLTFont *font,
436                                         MFLTOtfSpec *spec,
437                                         int from, int to,
438                                         unsigned char *table);
439
440 extern int (*mflt_try_otf) (struct _MFLTFont *font, MFLTOtfSpec *spec,
441                             MFLTGlyphString *gstring, int from, int to);
442
443 /*=*/
444 /*** @} */
445
446 M17N_END_HEADER
447
448 #endif /* _M17N_FLT_H_ */
449
450 /*
451   Local Variables:
452   coding: euc-japan
453   End:
454 */