1 /* m17n-flt.h -- header file for the FLT API of the m17n library. 2 Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 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 Boston, MA 02110-1301 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. The members @ref c and @ref encoded are the 76 members to be set appropriately before calling the functions 77 mflt_find () and mflt_run (). And, if @ref encoded is set to 1, 78 the member @ref code should also be set. */ 79 80 /***ja 81 @brief ����դ˴ؤ������η�. 82 83 �� #MFLTGlyph �ϡ�����դ˴ؤ��������Ǽ���빽¤�ΤǤ��롣�ؿ� 84 mflt_find () �� mflt_run () ��Ƥ����ˤϥ��С� \<c\> �� 85 \<encoded\> ��Ŭ�ڤ����ꤷ�Ƥ����ͤФʤ餺���⤷ \<encoded\> �� 1 86 �Ȥ������� \<code\> �����ꤷ�Ƥ����ͤФʤ�ʤ��� */ 87 88 typedef struct 89 { 90 /***en Character code (Unicode) of the glyph. */ 91 /***ja ����դ� (Unicode �ˤ�����) ʸ�������ɡ� */ 92 int c; 93 /***en Glyph ID of the glyph in the font. */ 94 /***ja �ե������ˤ����뤽�Υ���դ� ID�� */ 95 unsigned int code; 96 /***en Starting index of the run in #MFLTGlyphString that is 97 replaced by this glyph. */ 98 /***ja #MFLTGlyphString 99 ����ǡ����Υ���դˤ�ä��֤�����������ʬ����Ƭ�Υ���ǥ����� */ 100 int from; 101 /***en Ending index of the run in #MFLTGlyphString that is 102 replaced by this glyph. */ 103 /***ja #MFLTGlyphString 104 ����ǡ����Υ���դˤ�ä��֤�����������ʬ�������Υ���ǥ����� */ 105 int to; 106 /***en Advance width for horizontal layout expressed in 26.6 107 fractional pixel format. */ 108 /***ja �������������� 26.6 fractional pixel format ��ɽ��������Ρ� */ 109 int xadv; 110 /***en Advance height for vertical layout expressed in 26.6 111 fractional pixel format. */ 112 /***ja �Ľ��������� 26.6 fractional pixel format ��ɽ��������Ρ� */ 113 int yadv; 114 /* @{ */ 115 /***en Ink metrics of the glyph expressed in 26.6 fractional pixel 116 format. */ 117 /***ja ���Υ���դΥ���ȥ�å��� 26.6 fractional pixel format 118 ��ɽ��������Ρ� */ 119 int ascent, descent, lbearing, rbearing; 120 /* @} */ 121 /* @{ */ 122 /***en Horizontal and vertical adjustments for the glyph positioning 123 expressed in 26.6 fractional pixel format. */ 124 /***ja ����հ��ַ��κݤο�ʿ����ľĴ���ͤ� 125 26.6 fractional pixel format ��ɽ��������Ρ� */ 126 int xoff, yoff; 127 /* @} */ 128 /***en Flag to tell whether the member \<code\> has already been set 129 to a glyph ID in the font. */ 130 /***ja ���С� \<code\> �˴��˥���� ID 131 �����åȤ���Ƥ��뤫�ݤ����ե饰�� */ 132 unsigned encoded : 1; 133 /***en Flag to tell if the metrics of the glyph (members \<xadv\> thru 134 \<rbearing\>) are already calculated. */ 135 /***ja ���С� \<xadv\> ���� \<rbearing\> 136 �ޤǤγƥ�ȥ�å������˷��Ѥ��ݤ����ե饰�� */ 137 unsigned measured : 1; 138 /***en Flag to tell if the metrics of the glyph is adjusted, 139 i.e. \<xadv\> or \<yadv\> is different from the normal size, or 140 \<xoff\> or \<yoff\> is nonzero. */ 141 /***ja ����դΥ�ȥ�å���Ĵ���Ѥߤ��ݤ��� 142 ���ʤ���ʲ��Τ���1�İʾ夬��Ω���Ƥ��뤳�Ȥ��ե饰�� 143 \<xadv\> ��ɸ����ͤȰۤʤ롢 144 \<yadv\> ��ɸ����ͤȰۤʤ롢 145 \<xoff\> ������Ǥʤ��� 146 \<yoff\> ������Ǥʤ��� */ 147 unsigned adjusted : 1; 148 /***en For m17n-lib's internal use only. */ 149 /***ja m17n-lib ��������ѡ� */ 150 unsigned internal : 30; 151 152 /* Arbitrary data can follow. */ 153 } MFLTGlyph; 154 155 /*=*/ 156 157 /***en 158 @brief Type of information about a glyph position adjustment. 159 160 The type #MFLTGlyphAdjustment is the structure to store 161 information about a glyph metrics/position adjustment. It is 162 given to the callback function @b drive_otf of #MFLTFont. */ 163 164 /***ja 165 @brief ����հ���Ĵ������Τ���η�. 166 167 �� #MFLTGlyphAdjustment 168 �ϡ�����դΥ�ȥ�å�/���֤�Ĵ���˴ؤ��������Ǽ���뤿��ι�¤�ΤǤ��ꡢ 169 #MFLTFont �� callback �ؿ� @b drive_otf ���Ϥ���롣 */ 170 171 typedef struct 172 { 173 /* @{ */ 174 /***en Adjustments for advance width for horizontal layout and 175 advance height for vertical layout expressed in 26.6 fractional 176 pixel format. */ 177 /***ja ��ʿ����ľ�����������̤�Ĵ���ͤ� 26.6 fractional pixel format 178 ��ɽ��������Ρ� */ 179 int xadv, yadv; 180 /* @} */ 181 /* @{ */ 182 /***en Horizontal and vertical adjustments for glyph positioning 183 expressed in 26.6 fractional pixel format. */ 184 /***ja ����հ��ַ���ο�ʿ����ľĴ���ͤ� 26.6 fractional pixel 185 format ��ɽ��������Ρ� */ 186 int xoff, yoff; 187 /* @} */ 188 /***en Number of glyphs to go back for drawing a glyph. */ 189 /***ja ���������Τ�������٤�����տ��� */ 190 short back; 191 /***en If nonzero, the member \<xadv\> and \<yadv\> are absolute, i.e., 192 they should not be added to a glyph's origianl advance width and 193 height. */ 194 /***ja ��ΤȤ������С� \<xadv\> �� \<yadv\> �������ͤǤ��롣 195 ���ʤ�������ͤ��������������˲û����ƤϤʤ�ʤ��� */ 196 unsigned advance_is_absolute : 1; 197 /***en Should be set to 1 iff at least one of the other members has 198 a nonzero value. */ 199 /***ja ¾�Υ��С��Τ�������1�Ĥ���ΤȤ��Τߡ�1�˥��åȤ���롣 */ 200 unsigned set : 1; 201 } MFLTGlyphAdjustment; 202 203 /*=*/ 204 205 /***en 206 @brief Type of information about a glyph sequence. 207 208 The type #MFLTGlyphString is the structure that contains 209 information about a sequence of glyphs. */ 210 211 /***ja 212 @brief �������ξ���Τ���η�. 213 214 �� #MFLTGlyphString �ϡ��������ξ�����Ǽ���뤿��ι�¤�ΤǤ��롣 */ 215 216 typedef struct 217 { 218 /***en The actual byte size of elements of the array pointed by the 219 member #glyphs. It must be equal to or greater than "sizeof 220 (MFLTGlyph)". */ 221 /***ja ���С� #glyphs �λؤ���������Ǥ�����¥Х��ȿ��� 222 �����ͤ� "sizeof (MFLTGlyph)" �ʾ�Ǥʤ���Фʤ�ʤ��� */ 223 int glyph_size; 224 /***en Array of glyphs. */ 225 /***ja ����դ����� */ 226 MFLTGlyph *glyphs; 227 /***en Number of elements allocated in #glyphs. */ 228 /***ja #glyphs ������֤���Ƥ������Ǥο��� */ 229 int allocated; 230 /***en Number of elements in #glyphs in use. */ 231 /***ja #glyphs ��ǻ���������Ǥο��� */ 232 int used; 233 /***en Flag to tell if the glyphs should be drawn from right-to-left 234 or not. */ 235 /***ja ����դ������麸�ؤ��������٤����ݤ����ե饰�� */ 236 unsigned int r2l; 237 } MFLTGlyphString; 238 239 /*=*/ 240 241 /***en 242 @brief Type of specification of GSUB and GPOS OpenType tables. 243 244 The type #MFLTOtfSpec is the structure that contains information 245 about the GSUB and GPOS features of a specific script and language 246 system. The information is used to select which features to 247 apply to a glyph string, or to check if a specific FLT is usable 248 for a specific font. */ 249 250 /***ja 251 @brief GSUB ����� GPOS OpenType �ơ��֥�λ��ͤΤ���η�. 252 253 �� #MFLTOtfSpec �ϡ�GSUB ����� GPOS�ե������㡼�ξ�����Ǽ���뤿 254 ��ι�¤�ΤǤ��롣�����ե������㡼������Υ�����ץȤ���Ӹ��쥷 255 ���ƥ�Τ�ΤǤ��롣���ξ���ϡ��ɤΥե������㡼������Ŭ�Ѥ� 256 �뤫�����뤤������� FLT ������Υե���Ȥ��Ф���ͭ�����ɤ����η��� 257 �˻��Ѥ���롣 */ 258 259 typedef struct 260 { 261 /***en Unique symbol representing the spec. This is the same as the 262 @ref OTF-SPEC of the FLT. */ 263 /***ja ���λ��ͤ�ɽ�魯��ˡ����ʥ���ܥ롣 264 FLT �� @ref OTF-SPEC ��Ʊ����ͤǤ��롣 */ 265 MSymbol sym; 266 267 /* @{ */ 268 /***en Tags for script and language system. */ 269 /***ja ������ץȤ���Ӹ��쥷���ƥ�Υ����� */ 270 unsigned int script, langsys; 271 /* @} */ 272 273 /***en Array of GSUB (1st element) and GPOS (2nd element) feature 274 tag arrays. Each array is terminated by 0. It may be NULL if 275 there is no feature to specify. 276 277 (1) The case of using this information for selecting which 278 features to apply to a glyph string. If the array is NULL, 279 apply no feature. If the first element is 0xFFFFFFFF, apply all 280 available features except for what appear in the second and 281 following elements (if any). Otherwise, apply all listed 282 features. 283 284 (2) The case of using this information for checking if a a font 285 can be drived by a specific FLT. If the array is NULL, the font 286 should not have any features. Otherwize, the font should have 287 all features before 0xFFFFFFFF element (if any) and should not 288 have any features after that element. */ 289 /***ja GSUB �ե������㡼�������������1���ǡ�GPOS �ե������㡼������ 290 �������2���ǤȤ������������������0�Ǽ�����롣�ե������㡼 291 �λ��꤬1�Ĥ�ʤ����Ϥ�����������Ǥ� NULL �Ǥ�褤�� 292 293 (1) ���ξ���������Ŭ�Ѥ��٤��ե������㡼������˻Ȥ���� 294 �硣�⤷���Ȥ�NULL�ʤ顢�ɤΥե������㡼��Ŭ�Ѥ��ʤ����⤷�� 295 ������Ǥ� 0xFFFFFFFF �ʤ顢�����ܰʹߤΥե������㡼�ʤ⤷���� 296 �Сˤ�������٤Ƥ�Ŭ�Ѳ�ǽ�ʥե������㡼��Ŭ�Ѥ��롣����ʳ��ξ� 297 ��ꥹ�Ȥ��줿���٤ƤΥե������㡼��Ŭ�Ѥ��롣 298 299 (2) ���ξ�������� FLT ������Υե���Ȥ�ͭ�����ɤ����η���˻� 300 �����硣�⤷���Ȥ�NULL�ʤ顢�ե���Ȥϥե������㡼���� 301 ����äƤ��ƤϤ����ʤ����⤷�ǽ�����Ǥ�0xFFFFFFFF�ʤ顢�ե���� 302 �ϣ����ܤ����ǰʹߤΥե���Ȥ���äƤ��ƤϤ����ʤ�������ʳ��ξ� 303 �硢�ե���Ȥ�0xFFFFFFFF �����Τ��٤ƤΥե������㡼����������� 304 0xFFFFFFFF �ʹߤΥե������㡼�ϰ�Ĥ���äƤ��ƤϤ����ʤ���*/ 305 unsigned int *features[2]; 306 } MFLTOtfSpec; 307 308 /*=*/ 309 310 /***en 311 @brief Type of font to be used by the FLT driver. 312 313 The type #MFLTFont is the structure that contains information 314 about a font used by the FLT driver. Usually, an application 315 should prepare a bigger structure whose first element is MFLTFont 316 and has more information about the font that is used by callback 317 funcitons, and give that structure to mflt functions by coercing 318 it to MFLTFont. It is assured that callback functions can safely 319 coerce MFLTFont back to the original structure. */ 320 321 /***ja 322 @brief FLT �ɥ饤�Ф��Ȥ��ե���Ȥη�. 323 324 �� #MFLTFont �ϡ�FLT�ɥ饤�Ф��Ȥ��ե���Ȥ˴ؤ��������Ǽ���뤿 325 ��ι�¤�ΤǤ��롣�̾異�ץꥱ�������Ϻǽ�����Ǥ� MFLTFont �ǡ� 326 �Ĥ�����Ǥ�callback�ؿ������Ѥ���ե���Ⱦ������ä�������礭�� 327 ��¤�Τ��Ѱդ�������� MFLTFont �� coerce ���� mflt �γƴؿ����Ϥ��� 328 ��callback�ؿ��� MFLTFont �ι�¤�Τ� coerce ��ľ�����Ȥ��Ǥ��� 329 ���Ȥ��ݾڤ���Ƥ��롣 */ 330 331 typedef struct _MFLTFont 332 { 333 /***en Family name of the font. It may be #Mnil if the family name 334 is not important in finding a Font Layout Table suitable for the 335 font (for instance, in the case that the font is an OpenType 336 font). */ 337 /***ja �ե���ȤΥե��ߥ̾���ե���Ȥ�Ŭ���� FLT��õ���ݤ˽��פǤ� 338 ����� (���Ȥ��� OpenType�ե���Ȥξ��ʤ�) �ϡ�#Mnil �Ǥ褤�� */ 339 MSymbol family; 340 341 /***en Horizontal font sizes in pixels per EM. */ 342 /***ja �ե���Ȥο�ʿ�������� pixels per EM ��ɽ��������Ρ� */ 343 int x_ppem; 344 /***en Vertical font sizes in pixels per EM. */ 345 /***ja �ե���Ȥο�ľ�������� pixels per EM ��ɽ��������Ρ� */ 346 int y_ppem; 347 348 /***en Callback function to get glyph IDs for glyphs between FROM 349 (inclusive) and TO (exclusive) of GSTRING. If the member \<encoded\> 350 of a glyph is zero, the member \<code\> of that glyph is a character 351 code. The function must convert it to the glyph ID of FONT. */ 352 /***ja GSTRING ��� FROM ���� TO ľ���ޤǤγƥ���դ��б����륰��� 353 ID��������뤿��� callback �ؿ����⤷���륰��դΥ��С� 354 \<encoded\>������ʤ�С����Υ���դΥ��С� \<code\> ��ʸ�������ɤ� 355 ���롣���δؿ��Ϥ���ʸ�������ɤ� FONT �Υ���� ID���Ѵ����ʤ��Ƥ� 356 �ʤ�ʤ��� */ 357 int (*get_glyph_id) (struct _MFLTFont *font, MFLTGlyphString *gstring, 358 int from, int to); 359 360 /***en Callback function to get metrics of glyphs between FROM 361 (inclusive) and TO (exclusive) of GSTRING. If the member \<measured\> 362 of a glyph is zero, the function must set the members \<xadv\>, \<yadv\>, 363 \<ascent\>, \<descent\>, \<lbearing\>, and \<rbearing\> of the glyph. */ 364 /***ja GSTRING ��� FROM ���� TOľ���ޤǤγƥ���դ��б������ȥ�� 365 ����������뤿��� callback �ؿ����⤷���륰��դΥ��С� 366 \<measured\>������ʤ�С����δؿ��Ϥ��Υ���դΥ��С� \<xadv\>, 367 \<yadv\>, \<ascent\>, \<descent\>, \<lbearing\>, ����� \<rbearing\>�� 368 �Ȥ��ʤ���Фʤ�ʤ��� */ 369 int (*get_metrics) (struct _MFLTFont *font, MFLTGlyphString *gstring, 370 int from, int to); 371 372 /***en Callback function to check if the font has OpenType GSUB/GPOS 373 features for a specific script/language. The function must 374 return 1, if the font satisfies SPEC, or 0. It must be 375 NULL if the font does not have OpenType tables. */ 376 /***ja �ե���Ȥ���������Υ�����ץ�/������Ф��� GSUB/GPOS 377 OpenType�ե������㡼����Ĥ��ݤ���Ĵ�٤� callback �ؿ������δؿ� 378 �ϥե���Ȥ�SPEC ���������Ȥ��� 1 �����Ǥʤ��Ȥ��� 0���֤��� 379 ����Фʤ�ʤ����ե���Ȥ� OpenType �ơ��֥������ʤ��Ȥ���NULL 380 �Ǥʤ���Фʤ�ʤ��� */ 381 int (*check_otf) (struct _MFLTFont *font, MFLTOtfSpec *spec); 382 383 /***en Callback function to apply OpenType features in SPEC to glyphs 384 between FROM (inclusive) and TO (exclusive) of IN. The resulting 385 glyphs are appended to the tail of OUT. If OUT does not 386 have a room to store all the resulting glyphs, it must return -2. 387 It must be NULL if the font does not have OpenType tables. */ 388 /***ja IN ��� FROM ���� TO ľ���ޤǤγƥ���դ� SPEC��γ� OpenType 389 �ե������㡼��Ŭ�Ѥ��뤿��� callback �ؿ���Ŭ�ѷ�̤Υ������� 390 OUT ���������ɲä���롣OUT ��û����Ʒ�̤��ɲä��ڤ�ʤ���� 391 �� -2 ���֤��ʤ��ƤϤʤ�ʤ����ե���Ȥ� OpenType �ơ��֥����� 392 �ʤ����� NULL�Ǥʤ���Фʤ�ʤ��� */ 393 int (*drive_otf) (struct _MFLTFont *font, MFLTOtfSpec *spec, 394 MFLTGlyphString *in, int from, int to, 395 MFLTGlyphString *out, MFLTGlyphAdjustment *adjustment); 396 397 /***en For m17n-lib's internal use only. It should be initialized 398 to NULL. */ 399 /***ja m17n-lib ����������ѡ�NULL �˽��Ͳ�����롣 */ 400 void *internal; 401 } MFLTFont; 402 403 /*=*/ 404 405 /***en 406 @brief Type of FLT (Font Layout Table). 407 408 The type #MFLT is for an FLT object. Its internal structure is 409 concealed from application programs. */ 410 411 /***ja 412 @brief FLT (Font Layout Table) �η�. 413 414 �� #MFLT �� FLT ���֥������ȤΤ���η��Ǥ��롣 415 ����������¤�ϡ����ץꥱ�������ץ���फ��ϱ��ä���Ƥ��롣 */ 416 417 typedef struct _MFLT MFLT; 418 419 extern MFLT *mflt_get (MSymbol name); 420 421 extern MFLT *mflt_find (int c, MFLTFont *font); 422 423 extern const char *mflt_name (MFLT *flt); 424 425 extern MCharTable *mflt_coverage (MFLT *flt); 426 427 extern int mflt_run (MFLTGlyphString *gstring, int from, int to, 428 MFLTFont *font, MFLT *flt); 429 430 /*=*/ 431 /*** @} */ 432 433 extern int mflt_enable_new_feature; 434 435 extern MSymbol (*mflt_font_id) (MFLTFont *font); 436 437 extern int (*mflt_iterate_otf_feature) (MFLTFont *font, 438 MFLTOtfSpec *spec, 439 int from, int to, 440 unsigned char *table); 441 442 extern int (*mflt_try_otf) (struct _MFLTFont *font, MFLTOtfSpec *spec, 443 MFLTGlyphString *gstring, int from, int to); 444 445 M17N_END_HEADER 446 447 #endif /* _M17N_FLT_H_ */ 448 449 /* 450 Local Variables: 451 coding: euc-japan 452 End: 453 */ 454