*** empty log message ***
[m17n/m17n-lib.git] / src / m17n-flt.h
index 84eb1ab..f1454aa 100644 (file)
@@ -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
 
@@ -109,16 +109,20 @@ 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 \<code\> has already been set
       to a glyph ID in the font.  */
   /***ja ¥á¥ó¥Ð¡¼ \<code\> ¤Ë´û¤Ë¥°¥ê¥Õ ID
@@ -153,28 +157,32 @@ 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;
@@ -245,25 +253,26 @@ typedef struct
 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.  If the first
+      element is 0xFFFFFFFF, apply all the 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 ¤Ç¤â¤è¤¤¡£ */
   unsigned int *features[2];
 } MFLTOtfSpec;
 
@@ -273,13 +282,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
 {
@@ -291,9 +309,12 @@ 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 \<encoded\>
@@ -377,6 +398,18 @@ extern MCharTable *mflt_coverage (MFLT *flt);
 extern int mflt_run (MFLTGlyphString *gstring, int from, int to,
                     MFLTFont *font, MFLT *flt);
 
+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);
+
 /*=*/
 /*** @} */