*** empty log message ***
[m17n/m17n-lib.git] / src / m17n-gui.h
index c2b43ca..efe9846 100644 (file)
@@ -68,22 +68,31 @@ extern void m17n_fini_win (void);
     #MFrame ¤Ï¡¢@e ¥Õ¥ì¡¼¥à ¥ª¥Ö¥¸¥§¥¯¥ÈÍѤη¿¤Ç¤¢¤ë¡£¸Ä¡¹¤Î¥Õ¥ì¡¼¥à¤Ï¡¢
     ¤½¤ì¤¬Âбþ¤¹¤ëʪÍýŪ¤Êɽ¼¨¡¿ÆþÎϥǥХ¤¥¹¤Î³Æ¼ï¾ðÊó¤òÊÝ»ý¤¹¤ë¡£
 
-    #MFrame ·¿¤ÎÆâÉô¹½Â¤¤Ï¡¢»ÈÍѤ¹¤ë¥¦¥£¥ó¥É¥¦¥·¥¹¥Æ¥à¤Ë°Í¸¤·¡¢¤Þ¤¿¥¢
-    ¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é¥à¤«¤é¤Ï¸«¤¨¤Ê¤¤¡£m17n-X ¥é¥¤¥Ö¥é¥ê¤Ë¤ª¤±¤ë
-    ¥Õ¥ì¡¼¥à¤Ï¡¢X ¥¦¥£¥ó¥É¥¦¤Î @e display ¤È @e screen ¤Ë´Ø¤¹¤ë¾ðÊó¤ò
-    »ý¤Ä¡£
+    #MFrame ·¿¤ÎÆâÉô¹½Â¤¤Ï¡¢¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é¥à¤«¤é¤Ï¸«¤¨¤Ê¤¤¡£
+    ¤Þ¤¿¤½¤ÎÆâÍƤϻÈÍѤ¹¤ë¥¦¥£¥ó¥É¥¦¥·¥¹¥Æ¥à¤Ë°Í¸¤¹¤ë¡£¤Þ¤¿m17n-X ¥é
+    ¥¤¥Ö¥é¥ê¤Ë¤ª¤±¤ë¥Õ¥ì¡¼¥à¤Ï¡¢X ¥¦¥£¥ó¥É¥¦¤Î @e display ¤È @e screen 
+    ¤Ë´Ø¤¹¤ë¾ðÊó¤ò»ý¤Ä¡£
       */
 
 typedef struct MFrame MFrame;
 
 /*=*/
 
+extern MSymbol Mdevice;
+
 extern MSymbol Mfont;
 extern MSymbol Mfont_width;
 extern MSymbol Mfont_ascent;
 extern MSymbol Mfont_descent;
 extern MFrame *mframe_default;
 
+extern MSymbol Mdisplay;
+extern MSymbol Mscreen;
+extern MSymbol Mdrawable;
+extern MSymbol Mwidget;
+extern MSymbol Mdepth;
+extern MSymbol Mcolormap;
+
 extern MFrame *mframe (MPlist *plist);
 
 extern void *mframe_get_prop (MFrame *frame, MSymbol key);
@@ -114,7 +123,7 @@ extern void *mframe_get_prop (MFrame *frame, MSymbol key);
     @brief ¥Õ¥©¥ó¥È¤Î·¿Àë¸À.
 
     #MFont ·¿¤Ï¥Õ¥©¥ó¥È»ØÄêÍѤι½Â¤ÂΤǤ¢¤ê¡¢¥Õ¥©¥ó¥È¤Î¥×¥í¥Ñ¥Æ¥£¤Ç¤¢
-    ¤ë fondry, family, weight, style, stretch, adstyle, registry,
+    ¤ë foundry, family, weight, style, stretch, adstyle, registry,
     size, resolution ¤Ë´Ø¤¹¤ë¾ðÊó¤ò´Þ¤à¡£
 
     ¤³¤Î¹½Â¤ÂΤϥե©¥ó¥È¥»¥Ã¥ÈÆâ¤Î¥Õ¥©¥ó¥È¤ò»ØÄꤹ¤ëºÝ¤È¡¢»ÈÍѲÄǽ¤Ê¥·
@@ -130,21 +139,21 @@ typedef struct MFont MFont;
 
 /*=*/
 
-extern MSymbol Mfont;
+extern MSymbol Mx, Mfreetype, Mxft;
 
 extern MPlist *mfont_freetype_path;
 
 extern MFont *mfont ();
 
-extern MFont *mfont_from_name (char *name);
-
 extern MFont *mfont_copy (MFont *font);
 
-extern char *mfont_name (MFont *font);
+extern MFont *mfont_parse_name (char *name, MSymbol format);
 
-extern MFont *mfont_from_spec (char *family, char *weight, char *slant,
-                              char *swidth, char *adstyle, char *registry,
-                              unsigned short point, unsigned short res);
+extern char *mfont_unparse_name (MFont *font, MSymbol format);
+
+/* These two are obsolete (from 1.1.0).  */
+extern char *mfont_name (MFont *font);
+extern MFont *mfont_from_name (char *name);
 
 extern MSymbol Mfoundry;
 extern MSymbol Mfamily;
@@ -156,6 +165,8 @@ extern MSymbol Mregistry;
 extern MSymbol Msize;
 extern MSymbol Mresolution;
 
+extern MSymbol Mfontconfig;
+
 extern void *mfont_get_prop (MFont *font, MSymbol key);
 
 extern int mfont_put_prop (MFont *font, MSymbol key, void *val);
@@ -200,6 +211,12 @@ extern MSymbol *mfont_selection_priority ();
 
 extern int mfont_set_selection_priority (MSymbol *keys);
 
+extern int mfont_resize_ratio (MFont *font);
+
+extern MPlist *mfont_list (MFrame *frame, MFont *font, MSymbol language,
+                          int maxnum);
+
+
 /* end of font module */
 /*=*/
 
@@ -207,7 +224,8 @@ extern int mfont_set_selection_priority (MSymbol *keys);
 /***en @defgroup m17nFontset Fontset */
 /***ja @defgroup m17nFontset ¥Õ¥©¥ó¥È¥»¥Ã¥È */
 /*=*/
-
+/*** @addtogroup m17nFontset
+     @{   */
 typedef struct MFontset MFontset;
 
 extern MFontset *mfontset (char *name);
@@ -222,6 +240,9 @@ extern int mfontset_modify_entry (MFontset *fontset,
                                  MFont *spec, MSymbol layouter_name,
                                  int how);
 
+extern MPlist *mfontset_lookup (MFontset *fontset, MSymbol script,
+                               MSymbol language, MSymbol charset);
+/*** @}   */
 /* end of fontset module */
 /*=*/
 
@@ -380,7 +401,7 @@ typedef struct
     #MFaceHookFunc ¤Ï¥Õ¥§¡¼¥¹¤Î #Mhook ¥×¥í¥Ñ¥Æ¥£¤ò»ØÄꤹ¤ë·¿¤Ç¤¢¤ë¡£
     ¤³¤Î¥×¥í¥Ñ¥Æ¥£¤ÎÃͤϡ¢¤³¤Î·¿¤Î´Ø¿ô¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
       */
-typedef void *(*MFaceHookFunc) (MFace *face, void *arg, void *info);
+typedef void (*MFaceHookFunc) (MFace *face, void *arg, void *info);
 /*=*/
 
 extern void *mface_get_prop (MFace *face, MSymbol key);
@@ -450,7 +471,7 @@ typedef void *MDrawRegion;
     The type #MDrawControl is the structure that controls how to draw
     an M-text.  */
 /***ja
-    @brief ¥Æ¥­¥¹¥Èɽ¼¨¤Î¥³¥ó¥È¥í¡¼¥ë¤Î·¿Àë¸À.
+    @brief ¥Æ¥­¥¹¥Èɽ¼¨À©¸æ¤Î·¿Àë¸À.
 
     #MDrawControl ·¿¤Ï¡¢M-text ¤ò¤É¤¦É½¼¨¤¹¤ë¤«¤òÀ©¸æ¤¹¤ë¹½Â¤ÂΤǤ¢¤ë¡£
       */
@@ -512,6 +533,12 @@ typedef struct
       ¹ç¤Î¤ß¡£¡Ë */
   unsigned anti_alias : 1;
 
+  /***en If nonzero, disable the adjustment of glyph positions to
+      avoid horizontal overlapping at font boundary.  */
+  /***ja 0 ¤Ç¤Ê¤±¤ì¤Ð¡¢¥Õ¥©¥ó¥È¶­³¦¤Ç¤Î¿åÊ¿Êý¸þ¤Î¥°¥ê¥Õ¤Î½Å¤Ê¤ê¤òÈò¤±
+      ¤ë¤¿¤á¤Î¥°¥ê¥Õ°ÌÃÖ¤ÎÄ´À°¤ò̵¸ú¤Ë¤¹¤ë¡£  */
+  unsigned disable_overlapping_adjustment : 1;
+
   /***en If nonzero, the values are minimum line ascent and descent
       pixels.  */
   /***ja 0 ¤Ç¤Ê¤±¤ì¤Ð¡¢ÃͤϹԤΠascent ¤È descent ¤ÎºÇ¾®Ãͤò¼¨¤¹¡£  */
@@ -580,9 +607,9 @@ typedef struct
 
   /***en If non-NULL, the value is a function that calculates a line
       breaking position when a line is too long to fit within the
-      width limit.  POS is a position of the character next to the
-      last one that fits within the limit.  FROM is a position of the
-      first character of the line, and TO is a position of the last
+      width limit.  POS is the position of the character next to the
+      last one that fits within the limit.  FROM is the position of the
+      first character of the line, and TO is the position of the last
       character displayed on the line if there were not width limit.
       LINE and Y are the same as the arguments to <format>.
 
@@ -717,11 +744,11 @@ typedef struct
 
   /***en Metric of the glyph.  */
   /***ja ¥°¥ê¥Õ¤ÎÀ£Ë¡.  */
-  MDrawMetric this;
+  MDrawMetric metrics;
 
   /***en Font used for the glyph.  Set to NULL if no font is found for
       the glyph.  */
-  /***ja ¤½¤Î¥°¥ê¥ÕÍѤ˻Ȥï¤ì¤ë¥Õ¥©¥ó¥È¡£¸«¤Ä¤«¤é¤Ê¤±¤ì¤Ð NULL¡£
+  /***ja ¥°¥ê¥Õ¤Ë»È¤ï¤ì¤ë¥Õ¥©¥ó¥È¡£¸«¤Ä¤«¤é¤Ê¤±¤ì¤Ð NULL¡£
       the glyph.  */
   MFont *font;
 
@@ -736,14 +763,77 @@ typedef struct
 
   /***en Character ranges corresponding to visually left and right
       glyphs. */
-  /***ja »ë³ÐŪ¤Êº¸±¦¤Î¥°¥ê¥Õ¤ËÂбþ¤¹¤ëʸ»ú¤ÎÈÏ°Ï¡£  */
+  /***ja É½¼¨¾å¤Îº¸±¦¤Î¥°¥ê¥Õ¤ËÂбþ¤¹¤ëʸ»ú¤ÎÈÏ°Ï¡£  */
   int left_from, left_to;
   int right_from, right_to;
 
+  /***en Logical width of the glyph.  Nominal distance to the next
+      glyph.  */
+  /***ja ¥°¥ê¥Õ¤ÎÏÀÍýŪÉý¡£¼¡¤Î¥°¥ê¥Õ¤È¤Î̾Ìܾå¤Îµ÷Î¥¡£  */
+  int logical_width;
 } MDrawGlyphInfo;
 
 /*=*/
 
+/*** @ingroup m17nDraw */
+/***en
+    @brief Type of information about a glyph metric and font.
+
+    The type #MDrawGlyph is the structure that contains information
+    about a glyph metric and font.  It is used by the function
+    mdraw_glyph_list ().  */
+/***ja
+    @brief ¥°¥ê¥Õ¤ÎÀ£Ë¡¤È¥Õ¥©¥ó¥È¤Ë´Ø¤¹¤ë¾ðÊó¤Î·¿Àë¸À.
+
+    #MDrawGlyph ·¿¤Ï¥°¥ê¥Õ¤ÎÀ£Ë¡¤È¥Õ¥©¥ó¥È¤Ë´Ø¤¹¤ë¾ðÊó¤ò´Þ¤à¹½Â¤ÂΤǤ¢
+    ¤ë¡£mdraw_glyph_list () ¤Ï¤³¤ì¤òÍѤ¤¤ë¡£  */
+
+typedef struct
+{
+  /***en Character range corresponding to the glyph.  */
+  /***ja ¥°¥ê¥Õ¤ËÂбþ¤¹¤ëʸ»ú¤ÎÈÏ°Ï.  */
+  int from, to;
+
+  /***en Font glyph code of the glyph.  */
+  /***ja ¥Õ¥©¥ó¥ÈÆâ¤Î¥°¥ê¥Õ¥³¡¼¥É¡£  */
+  int glyph_code;
+
+  /***en Logical width of the glyph.  Nominal distance to the next
+      glyph.  */
+  /***ja ¥°¥ê¥Õ¤ÎÏÀÍýŪÉý¡£¼¡¤Î¥°¥ê¥Õ¤È¤Î̾Ìܾå¤Îµ÷Î¥¡£  */
+  int x_advance, y_advance;
+
+  /***en X/Y offset relative to the glyph position.  */
+  /***ja ¥°¥ê¥Õ¤Î°ÌÃÖ¤ËÂФ¹¤ë X/Y ¥ª¥Õ¥»¥Ã¥È.  */
+  int x_off, y_off;
+
+  /***en Metric of the glyph.  */
+  /***ja ¥°¥ê¥Õ¤ÎÀ£Ë¡.  */
+  int lbearing, rbearing, ascent, descent;
+
+  /***en Font used for the glyph.  Set to NULL if no font is found for
+      the glyph.  */
+  /***ja ¥°¥ê¥Õ¤Ë»È¤ï¤ì¤ë¥Õ¥©¥ó¥È¡£¸«¤Ä¤«¤é¤Ê¤±¤ì¤Ð NULL¡£
+      the glyph.  */
+  MFont *font;
+
+  /***en Type of the font.  One of Mx, Mfreetype, Mxft.  */
+  /***ja ¥Õ¥©¥ó¥È¤Î¥¿¥¤¥×¡£Mx¡¢Mfreetype¡¢Mxft ¤Î¤¤¤º¤ì¤«¡£  */
+  MSymbol font_type;
+
+  /***en Pointer to the font structure.  The actual type is
+      (XFontStruct *) if <font_type> member is Mx, FT_Face if
+      <font_type> member is Mfreetype, and (XftFont *) if <font_type>
+      member is Mxft.  */
+  /***ja ¥Õ¥©¥ó¥È¤Î¹½Â¤ÂΤؤΥݥ¤¥ó¥¿¡£¼ÂºÝ¤Î·¿¤Ï <font_type> ¥á¥ó¥Ð¤¬
+      Mx ¤Ê¤é (XFontStruct *)¡¢ Mfreetype ¤Ê¤é FT_Face¡¢Mxft ¤Ê¤é
+      (XftFont *)¡£ */
+  void *fontp;
+
+} MDrawGlyph;
+
+/*=*/
+
 /***en
     @brief Type of text items.
 
@@ -823,6 +913,10 @@ extern int mdraw_text_per_char_extents (MFrame *frame,
 extern int mdraw_glyph_info (MFrame *frame, MText *mt, int from, int pos,
                             MDrawControl *control, MDrawGlyphInfo *info);
 
+extern int mdraw_glyph_list (MFrame *frame, MText *mt, int from, int to,
+                            MDrawControl *control, MDrawGlyph *glyphs,
+                            int array_size, int *num_glyphs_return);
+
 extern void mdraw_text_items (MFrame *frame, MDrawWindow win, int x, int y,
                              MDrawTextItem *items, int nitems);