X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=src%2Fm17n-flt.h;h=a9efff70033495219da5a2bc0e366894aceb7a6f;hb=38a8279d68792a0ac90b2e81dc7a0795b414ae36;hp=665d8936df9abaec38192b4b648e281b961181c8;hpb=4d7ae8f860db7c702a0c6e0f4e4cb4351fa1b666;p=m17n%2Fm17n-lib.git diff --git a/src/m17n-flt.h b/src/m17n-flt.h index 665d893..a9efff7 100644 --- a/src/m17n-flt.h +++ b/src/m17n-flt.h @@ -1,5 +1,5 @@ /* m17n-flt.h -- header file for the FLT API of the m17n library. - Copyright (C) 2007 + Copyright (C) 2007, 2008, 2009, 2010 National Institute of Advanced Industrial Science and Technology (AIST) Registration Number H15PRO112 @@ -58,8 +58,10 @@ extern void m17n_fini_flt (void); #endif -/***en @defgroup m17nFLT FLT API */ -/***ja @defgroup m17nFLT FLT API */ +/***en @defgroup m17nFLT FLT API + @brief API provided by libm17n-flt.so */ +/***ja @defgroup m17nFLT FLT API + @brief libm17n-flt.so ¤¬Ä󶡤¹¤ë API */ /*=*/ /*** @addtogroup m17nFLT */ @@ -107,35 +109,39 @@ typedef struct fractional pixel format. */ /***ja ½Ä½ñ¤­»þ¤ÎÁ÷¤ê¹â¤ò 26.6 fractional pixel format ¤Çɽ¸½¤·¤¿¤â¤Î¡£ */ int yadv; + /* @{ */ /***en Ink metrics of the glyph expressed in 26.6 fractional pixel format. */ /***ja ¤³¤Î¥°¥ê¥Õ¤Î¥¤¥ó¥¯¥á¥È¥ê¥Ã¥¯¤ò 26.6 fractional pixel format ¤Çɽ¸½¤·¤¿¤â¤Î¡£ */ int ascent, descent, lbearing, rbearing; + /* @} */ + /* @{ */ /***en Horizontal and vertical adjustments for the glyph positioning expressed in 26.6 fractional pixel format. */ /***ja ¥°¥ê¥Õ°ÌÃÖ·è¤á¤ÎºÝ¤Î¿åÊ¿¡¦¿âľĴÀ°Ãͤò¡¢ 26.6 fractional pixel format ¤Çɽ¸½¤·¤¿¤â¤Î¡£ */ int xoff, yoff; - /***en Flag to tell whether the member has already been set + /* @} */ + /***en Flag to tell whether the member \ has already been set to a glyph ID in the font. */ - /***ja ¥á¥ó¥Ð¡¼ ¤Ë´û¤Ë¥°¥ê¥Õ ID + /***ja ¥á¥ó¥Ð¡¼ \ ¤Ë´û¤Ë¥°¥ê¥Õ ID ¤¬¥»¥Ã¥È¤µ¤ì¤Æ¤¤¤ë¤«Èݤ«¤ò¼¨¤¹¥Õ¥é¥°¡£ */ unsigned encoded : 1; - /***en Flag to tell if the metrics of the glyph (members thru - ) are already calculated. */ - /***ja ¥á¥ó¥Ð¡¼ ¤«¤é + /***en Flag to tell if the metrics of the glyph (members \ thru + \) are already calculated. */ + /***ja ¥á¥ó¥Ð¡¼ \ ¤«¤é \ ¤Þ¤Ç¤Î³Æ¥á¥È¥ê¥Ã¥¯¤¬´û¤Ë·×»»ºÑ¤«Èݤ«¤ò¼¨¤¹¥Õ¥é¥°¡£ */ unsigned measured : 1; /***en Flag to tell if the metrics of the glyph is adjusted, - i.e. or is different from the normal size, or - or is nonzero. */ + i.e. \ or \ is different from the normal size, or + \ or \ is nonzero. */ /***ja ¥°¥ê¥Õ¤Î¥á¥È¥ê¥Ã¥¯¤¬Ä´À°ºÑ¤ß¤«Èݤ«¡¢ ¤¹¤Ê¤ï¤Á°Ê²¼¤Î¤¦¤Á1¤Ä°Ê¾å¤¬À®Î©¤·¤Æ¤¤¤ë¤³¤È¤ò¼¨¤¹¥Õ¥é¥°¡£ - ¤¬É¸½à¤ÎÃͤȰۤʤ롢 - ¤¬É¸½à¤ÎÃͤȰۤʤ롢 - ¤¬¥¼¥í¤Ç¤Ê¤¤¡¢ - ¤¬¥¼¥í¤Ç¤Ê¤¤¡£ */ + \ ¤¬É¸½à¤ÎÃͤȰۤʤ롢 + \ ¤¬É¸½à¤ÎÃͤȰۤʤ롢 + \ ¤¬¥¼¥í¤Ç¤Ê¤¤¡¢ + \ ¤¬¥¼¥í¤Ç¤Ê¤¤¡£ */ unsigned adjusted : 1; /***en For m17n-lib's internal use only. */ /***ja m17n-lib ÆâÉôºî¶ÈÍÑ¡£ */ @@ -151,35 +157,39 @@ typedef struct The type #MFLTGlyphAdjustment is the structure to store information about a glyph metrics/position adjustment. It is - given to the callback function #drive_otf of #MFLTFont. */ + given to the callback function @b drive_otf of #MFLTFont. */ /***ja @brief ¥°¥ê¥Õ°ÌÃÖÄ´À°¾ðÊó¤Î¤¿¤á¤Î·¿. ·¿ #MFLTGlyphAdjustment ¤Ï¡¢¥°¥ê¥Õ¤Î¥á¥È¥ê¥Ã¥¯/°ÌÃÖ¤ÎÄ´À°¤Ë´Ø¤¹¤ë¾ðÊó¤ò³ÊǼ¤¹¤ë¤¿¤á¤Î¹½Â¤ÂΤǤ¢¤ê¡¢ - #MFLTFont ¤Î callback ´Ø¿ô #drive_otf ¤ËÅϤµ¤ì¤ë¡£ */ + #MFLTFont ¤Î callback ´Ø¿ô @b drive_otf ¤ËÅϤµ¤ì¤ë¡£ */ typedef struct { + /* @{ */ /***en Adjustments for advance width for horizontal layout and advance height for vertical layout expressed in 26.6 fractional pixel format. */ /***ja ¿åÊ¿¡¦¿âľÊý¸þ¤ÎÁ÷¤êÎ̤ÎÄ´À°Ãͤò 26.6 fractional pixel format ¤Çɽ¸½¤·¤¿¤â¤Î¡£ */ int xadv, yadv; + /* @} */ + /* @{ */ /***en Horizontal and vertical adjustments for glyph positioning expressed in 26.6 fractional pixel format. */ /***ja ¥°¥ê¥Õ°ÌÃÖ·è¤á¤¿¤á¤Î¿åÊ¿¡¦¿âľĴÀ°Ãͤò 26.6 fractional pixel format ¤Çɽ¸½¤·¤¿¤â¤Î¡£ */ int xoff, yoff; + /* @} */ /***en Number of glyphs to go back for drawing a glyph. */ /***ja ¥°¥ê¥ÕÉÁ²è¤Î¤¿¤á¤ËÌá¤ë¤Ù¤­¥°¥ê¥Õ¿ô¡£ */ short back; - /***en If nonzero, the member and are absolute, i.e., + /***en If nonzero, the member \ and \ are absolute, i.e., they should not be added to a glyph's origianl advance width and height. */ - /***ja Èó¥¼¥í¤Î¤È¤­¡¢¥á¥ó¥Ð¡¼ ¤È ¤ÏÀäÂÐÃͤǤ¢¤ë¡£ + /***ja Èó¥¼¥í¤Î¤È¤­¡¢¥á¥ó¥Ð¡¼ \ ¤È \ ¤ÏÀäÂÐÃͤǤ¢¤ë¡£ ¤¹¤Ê¤ï¤Á¤½¤ÎÃͤò¥°¥ê¥ÕËÜÍè¤ÎÁ÷¤êÉý¤Ë²Ã»»¤·¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£ */ unsigned advance_is_absolute : 1; /***en Should be set to 1 iff at least one of the other members has @@ -231,37 +241,65 @@ typedef struct The type #MFLTOtfSpec is the structure that contains information about the GSUB and GPOS features of a specific script and language - system to be applied to a glyph sequence. */ + system. The information is used to select which features to + apply to a glyph string, or to check if a specific FLT is usable + for a specific font. */ /***ja @brief GSUB ¤ª¤è¤Ó GPOS OpenType ¥Æ¡¼¥Ö¥ë¤Î»ÅÍͤΤ¿¤á¤Î·¿. ·¿ #MFLTOtfSpec ¤Ï¡¢GSUB ¤ª¤è¤Ó GPOS¥Õ¥£¡¼¥Á¥ã¡¼¤Î¾ðÊó¤ò³ÊǼ¤¹¤ë¤¿ ¤á¤Î¹½Â¤ÂΤǤ¢¤ë¡£¤³¤ì¤é¥Õ¥£¡¼¥Á¥ã¡¼¤ÏÆÃÄê¤Î¥¹¥¯¥ê¥×¥È¤ª¤è¤Ó¸À¸ì¥· - ¥¹¥Æ¥à¤Î¤â¤Î¤Ç¤¢¤ê¡¢¥°¥ê¥ÕÎó¤ËŬÍѤµ¤ì¤ë¡£ */ + ¥¹¥Æ¥à¤Î¤â¤Î¤Ç¤¢¤ë¡£¤³¤Î¾ðÊó¤Ï¡¢¤É¤Î¥Õ¥£¡¼¥Á¥ã¡¼¤ò¥°¥ê¥ÕÎó¤ËŬÍѤ¹ + ¤ë¤«¡¢¤¢¤ë¤¤¤ÏÆÃÄê¤Î FLT ¤¬ÆÃÄê¤Î¥Õ¥©¥ó¥È¤ËÂФ·¤ÆÍ­¸ú¤«¤É¤¦¤«¤Î·èÄê + ¤Ë»ÈÍѤµ¤ì¤ë¡£ */ typedef struct { /***en Unique symbol representing the spec. This is the same as the - #OTF-SPEC of the FLT. */ + @ref OTF-SPEC of the FLT. */ /***ja ¤³¤Î»ÅÍͤòɽ¤ï¤¹¥æ¥Ë¡¼¥¯¤Ê¥·¥ó¥Ü¥ë¡£ - FLT ¤Î #OTF-SPEC ¤ÈƱ°ì¤ÎÃͤǤ¢¤ë¡£ */ + FLT ¤Î @ref OTF-SPEC ¤ÈƱ°ì¤ÎÃͤǤ¢¤ë¡£ */ MSymbol sym; + /* @{ */ /***en Tags for script and language system. */ /***ja ¥¹¥¯¥ê¥×¥È¤ª¤è¤Ó¸À¸ì¥·¥¹¥Æ¥à¤Î¥¿¥°¡£ */ unsigned int script, langsys; - - /***en Array of GSUB (1st element) and GPOS (2nd element) features. - Each array is terminated by 0. If an element is 0xFFFFFFFF - apply the previous features in that order, and apply all the - other features except those that appear in the following elements. - It may be NULL if there are no features. */ - /***ja GSUB ¥Õ¥£¡¼¥Á¥ã¡¼¤òÂè1Í×ÁÇ¡¢GPOS ¥Õ¥£¡¼¥Á¥ã¡¼¤òÂè2Í×ÁǤȤ¹¤ëÇÛ - Îó¡£³ÆÇÛÎó¤ÎËöÈø¤Ï0¤Ç¼¨¤µ¤ì¤ë¡£¤â¤·¤¢¤ëÍ×ÁǤ¬ 0xFFFFFFFF¤Ê¤é¤Ð¡¢ - °ÊÁ°¤ÎÁ´¥Õ¥£¡¼¥Á¥ã¡¼¤ò¤½¤Î½ç½ø¤ÇŬÍѤ·¡¢¹¹¤Ë°Ê¹ß¤ÎÍ×ÁǤȤ·¤Æ¸½¤ï - ¤ì¤ë¥Õ¥£¥Á¥ã¡¼°Ê³°¤Î¤¹¤Ù¤Æ¤òŬÍѤ¹¤ë¡£¥Õ¥£¡¼¥Á¥ã¡¼¤¬1¤Ä¤â¤Ê¤¤¾ì¹ç - ¤Ï NULL ¤Ç¤â¤è¤¤¡£ */ + /* @} */ + + /***en Array of GSUB (1st element) and GPOS (2nd element) feature + tag arrays. Each array is terminated by 0. It may be NULL if + there is no feature to specify. + + (1) The case of using this information for selecting which + features to apply to a glyph string. If the array is NULL, + apply no feature. If the first element is 0xFFFFFFFF, apply all + available features except for what appear in the second and + following elements (if any). Otherwise, apply all listed + features. + + (2) The case of using this information for checking if a a font + can be drived by a specific FLT. If the array is NULL, the font + should not have any features. Otherwize, the font should have + all features before 0xFFFFFFFF element (if any) and should not + have any features after that element. */ + /***ja GSUB ¥Õ¥£¡¼¥Á¥ã¡¼¥¿¥°¤ÎÇÛÎó¤òÂè1Í×ÁÇ¡¢GPOS ¥Õ¥£¡¼¥Á¥ã¡¼¥¿¥°¤Î + ÇÛÎó¤òÂè2Í×ÁǤȤ¹¤ëÇÛÎó¡£³ÆÇÛÎó¤ÎËöÈø¤Ï0¤Ç¼¨¤µ¤ì¤ë¡£¥Õ¥£¡¼¥Á¥ã¡¼ + ¤Î»ØÄ꤬1¤Ä¤â¤Ê¤¤¾ì¹ç¤Ï¤³¤ÎÇÛÎó¤ÎÍ×ÁÇ¤Ï NULL ¤Ç¤â¤è¤¤¡£ + + (1) ¤³¤Î¾ðÊ󤬥°¥ê¥ÕÎó¤ËŬÍѤ¹¤Ù¤­¥Õ¥£¡¼¥Á¥ã¡¼¤ÎÁªÂò¤Ë»È¤ï¤ì¤ë¾ì + ¹ç¡£¤â¤·ÇÛÎ󼫿Ȥ¬NULL¤Ê¤é¡¢¤É¤Î¥Õ¥£¡¼¥Á¥ã¡¼¤âŬÍѤ·¤Ê¤¤¡£¤â¤·ºÇ + ½é¤ÎÍ×ÁǤ¬ 0xFFFFFFFF ¤Ê¤é¡¢£²ÈÖÌܰʹߤΥե£¡¼¥Á¥ã¡¼¡Ê¤â¤·¤¢¤ì + ¤Ð¡Ë¤ò½ü¤¯¤¹¤Ù¤Æ¤ÎŬÍѲÄǽ¤Ê¥Õ¥£¡¼¥Á¥ã¡¼¤òŬÍѤ¹¤ë¡£¤½¤ì°Ê³°¤Î¾ì + ¹ç¥ê¥¹¥È¤µ¤ì¤¿¤¹¤Ù¤Æ¤Î¥Õ¥£¡¼¥Á¥ã¡¼¤òŬÍѤ¹¤ë¡£ + + (2) ¤³¤Î¾ðÊó¤¬ÆÃÄê¤Î FLT ¤¬ÆÃÄê¤Î¥Õ¥©¥ó¥È¤ËÍ­¸ú¤«¤É¤¦¤«¤Î·èÄê¤Ë»È + ¤ï¤ì¤ë¾ì¹ç¡£¤â¤·ÇÛÎ󼫿Ȥ¬NULL¤Ê¤é¡¢¥Õ¥©¥ó¥È¤Ï¥Õ¥£¡¼¥Á¥ã¡¼¤ò°ì¤Ä + ¤â»ý¤Ã¤Æ¤¤¤Æ¤Ï¤¤¤±¤Ê¤¤¡£¤â¤·ºÇ½é¤ÎÍ×ÁǤ¬0xFFFFFFFF¤Ê¤é¡¢¥Õ¥©¥ó¥È + ¤Ï£²ÈÖÌܤÎÍ×ÁǰʹߤΥե©¥ó¥È¤ò»ý¤Ã¤Æ¤¤¤Æ¤Ï¤¤¤±¤Ê¤¤¡£¤½¤ì°Ê³°¤Î¾ì + ¹ç¡¢¥Õ¥©¥ó¥È¤Ï0xFFFFFFFF °ÊÁ°¤Î¤¹¤Ù¤Æ¤Î¥Õ¥£¡¼¥Á¥ã¡¼¤ò»ý¤Á¡¢¤«¤Ä + 0xFFFFFFFF °Ê¹ß¤Î¥Õ¥£¡¼¥Á¥ã¡¼¤Ï°ì¤Ä¤â»ý¤Ã¤Æ¤¤¤Æ¤Ï¤¤¤±¤Ê¤¤¡£*/ unsigned int *features[2]; } MFLTOtfSpec; @@ -271,13 +309,22 @@ typedef struct @brief Type of font to be used by the FLT driver. The type #MFLTFont is the structure that contains information - about a font used by the FLT driver. */ + about a font used by the FLT driver. Usually, an application + should prepare a bigger structure whose first element is MFLTFont + and has more information about the font that is used by callback + funcitons, and give that structure to mflt functions by coercing + it to MFLTFont. It is assured that callback functions can safely + coerce MFLTFont back to the original structure. */ /***ja @brief FLT ¥É¥é¥¤¥Ð¤¬»È¤¦¥Õ¥©¥ó¥È¤Î·¿. ·¿ #MFLTFont ¤Ï¡¢FLT¥É¥é¥¤¥Ð¤¬»È¤¦¥Õ¥©¥ó¥È¤Ë´Ø¤¹¤ë¾ðÊó¤ò³ÊǼ¤¹¤ë¤¿ - ¤á¤Î¹½Â¤ÂΤǤ¢¤ë¡£ */ + ¤á¤Î¹½Â¤ÂΤǤ¢¤ë¡£Ä̾異¥×¥ê¥±¡¼¥·¥ç¥ó¤ÏºÇ½é¤ÎÍ×ÁǤ¬ MFLTFont ¤Ç¡¢ + »Ä¤ê¤ÎÍ×ÁǤËcallback´Ø¿ô¤¬ÍøÍѤ¹¤ë¥Õ¥©¥ó¥È¾ðÊó¤ò»ý¤Ã¤¿¡¢¤è¤êÂ礭¤Ê + ¹½Â¤ÂΤòÍÑ°Õ¤·¡¢¤½¤ì¤ò MFLTFont ¤Ë coerce ¤·¤Æ mflt ¤Î³Æ´Ø¿ô¤ËÅϤ¹¡£ + ³Æcallback´Ø¿ô¤Ï MFLTFont ¤ò¸µ¤Î¹½Â¤ÂÎ¤Ë coerce ¤·Ä¾¤¹¤³¤È¤¬¤Ç¤­¤ë + ¤³¤È¤¬Êݾڤµ¤ì¤Æ¤¤¤ë¡£ */ typedef struct _MFLTFont { @@ -289,30 +336,33 @@ typedef struct _MFLTFont ¤¤¾ì¹ç (¤¿¤È¤¨¤Ð OpenType¥Õ¥©¥ó¥È¤Î¾ì¹ç¤Ê¤É) ¤Ï¡¢#Mnil ¤Ç¤è¤¤¡£ */ MSymbol family; - /***en Horizontal and vertical font sizes in pixels per EM. */ - /***ja ¥Õ¥©¥ó¥È¤Î¿åÊ¿¡¦¿âľ¥µ¥¤¥º¤ò pixels per EM ¤Çɽ¸½¤·¤¿¤â¤Î¡£ */ - int x_ppem, y_ppem; + /***en Horizontal font sizes in pixels per EM. */ + /***ja ¥Õ¥©¥ó¥È¤Î¿åÊ¿¥µ¥¤¥º¤ò pixels per EM ¤Çɽ¸½¤·¤¿¤â¤Î¡£ */ + int x_ppem; + /***en Vertical font sizes in pixels per EM. */ + /***ja ¥Õ¥©¥ó¥È¤Î¿âľ¥µ¥¤¥º¤ò pixels per EM ¤Çɽ¸½¤·¤¿¤â¤Î¡£ */ + int y_ppem; /***en Callback function to get glyph IDs for glyphs between FROM - (inclusive) and TO (exclusive) of GSTRING. If the member - of a glyph is zero, the member of that glyph is a character + (inclusive) and TO (exclusive) of GSTRING. If the member \ + of a glyph is zero, the member \ of that glyph is a character code. The function must convert it to the glyph ID of FONT. */ /***ja GSTRING Æâ¤Î FROM ¤«¤é TO ľÁ°¤Þ¤Ç¤Î³Æ¥°¥ê¥Õ¤ËÂбþ¤¹¤ë¥°¥ê¥Õ ID¤ò¼èÆÀ¤¹¤ë¤¿¤á¤Î callback ´Ø¿ô¡£¤â¤·¤¢¤ë¥°¥ê¥Õ¤Î¥á¥ó¥Ð¡¼ - ¤¬¥¼¥í¤Ê¤é¤Ð¡¢¤½¤Î¥°¥ê¥Õ¤Î¥á¥ó¥Ð¡¼ ¤Ïʸ»ú¥³¡¼¥É¤Ç + \¤¬¥¼¥í¤Ê¤é¤Ð¡¢¤½¤Î¥°¥ê¥Õ¤Î¥á¥ó¥Ð¡¼ \ ¤Ïʸ»ú¥³¡¼¥É¤Ç ¤¢¤ë¡£¤³¤Î´Ø¿ô¤Ï¤½¤Îʸ»ú¥³¡¼¥É¤ò FONT ¤Î¥°¥ê¥Õ ID¤ËÊÑ´¹¤·¤Ê¤¯¤Æ¤Ï ¤Ê¤é¤Ê¤¤¡£ */ int (*get_glyph_id) (struct _MFLTFont *font, MFLTGlyphString *gstring, int from, int to); /***en Callback function to get metrics of glyphs between FROM - (inclusive) and TO (exclusive) of GSTRING. If the member - of a glyph is zero, the function must set the members , , - , , , and of the glyph. */ + (inclusive) and TO (exclusive) of GSTRING. If the member \ + of a glyph is zero, the function must set the members \, \, + \, \, \, and \ of the glyph. */ /***ja GSTRING Æâ¤Î FROM ¤«¤é TOľÁ°¤Þ¤Ç¤Î³Æ¥°¥ê¥Õ¤ËÂбþ¤¹¤ë¥á¥È¥ê¥Ã ¥¯¤ò¼èÆÀ¤¹¤ë¤¿¤á¤Î callback ´Ø¿ô¡£¤â¤·¤¢¤ë¥°¥ê¥Õ¤Î¥á¥ó¥Ð¡¼ - ¤¬¥¼¥í¤Ê¤é¤Ð¡¢¤³¤Î´Ø¿ô¤Ï¤½¤Î¥°¥ê¥Õ¤Î¥á¥ó¥Ð¡¼ , - , , , , ¤ª¤è¤Ó ¤ò¥»¥Ã + \¤¬¥¼¥í¤Ê¤é¤Ð¡¢¤³¤Î´Ø¿ô¤Ï¤½¤Î¥°¥ê¥Õ¤Î¥á¥ó¥Ð¡¼ \, + \, \, \, \, ¤ª¤è¤Ó \¤ò¥»¥Ã ¥È¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£ */ int (*get_metrics) (struct _MFLTFont *font, MFLTGlyphString *gstring, int from, int to); @@ -378,6 +428,18 @@ extern int mflt_run (MFLTGlyphString *gstring, int from, int to, /*=*/ /*** @} */ +extern int mflt_enable_new_feature; + +extern MSymbol (*mflt_font_id) (MFLTFont *font); + +extern int (*mflt_iterate_otf_feature) (MFLTFont *font, + MFLTOtfSpec *spec, + int from, int to, + unsigned char *table); + +extern int (*mflt_try_otf) (struct _MFLTFont *font, MFLTOtfSpec *spec, + MFLTGlyphString *gstring, int from, int to); + M17N_END_HEADER #endif /* _M17N_FLT_H_ */