*** empty log message ***
[m17n/m17n-lib.git] / src / font.c
index e85212a..5ebdaa0 100644 (file)
@@ -1,5 +1,5 @@
 /* font.c -- font module.
-   Copyright (C) 2003, 2004, 2005, 2006
+   Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
      National Institute of Advanced Industrial Science and Technology (AIST)
      Registration Number H15PRO112
 
@@ -1154,7 +1154,7 @@ mfont__init ()
   default_encoding.repertory_name = Mnil;
   default_encoding.repertory_charset = NULL;
   {
-    char *path, *buf;
+    char *path, *buf = NULL;
     int bufsize;
     USE_SAFE_ALLOCA;
 
@@ -1219,7 +1219,7 @@ mfont__fini ()
 MSymbol
 mfont__id (MFont *font)
 {
-  char *buf, *p;
+  char *buf = NULL, *p;
   int i;
   int file_len = (font->file == Mnil ? 0 : MSYMBOL_NAMELEN (font->file));
   int capability_len  = (font->capability == Mnil ? 0
@@ -1685,13 +1685,16 @@ mfont__get_glyph_id (MFLTFont *font, MFLTGlyphString *gstring,
 
       if (g->g.encoded)
        continue;
-      if (! encoding->encoding_charset)
-       g->g.code = MCHAR_INVALID_CODE;
-      else if (mfont->source == MFONT_SOURCE_X && encoding->repertory_charset)
-       g->g.code = ENCODE_CHAR (encoding->repertory_charset, g->g.code);
+      if (mfont->source == MFONT_SOURCE_X && encoding->repertory_charset)
+       g->g.code = ENCODE_CHAR (encoding->repertory_charset, g->g.c);
       else
        {
-         unsigned code = ENCODE_CHAR (encoding->encoding_charset, g->g.code);
+         unsigned code;
+
+         if (encoding->encoding_charset)
+           code = ENCODE_CHAR (encoding->encoding_charset, g->g.c);
+         else
+           code = g->g.code;
 
          if (code != MCHAR_INVALID_CODE)
            {
@@ -1708,9 +1711,8 @@ mfont__get_glyph_id (MFLTFont *font, MFLTGlyphString *gstring,
                        MFATAL (MERROR_FONT);
                    }
                }
-             g->g.code
-               = (driver->encode_char) (rfont->frame, rfont->font, mfont,
-                                        g->g.code);
+             g->g.code = (driver->encode_char) (rfont->frame, rfont->font,
+                                                mfont, code);
            }
        }
       g->g.encoded = 1;
@@ -1956,7 +1958,7 @@ mfont__check_capability (MRealizedFont *rfont, MSymbol capability)
 /***ja
     @brief ³«È¯¸µ¤ò»ØÄꤹ¤ë¥Õ¥©¥ó¥È¥×¥í¥Ñ¥Æ¥£¤Î¥­¡¼.
     
-    ÊÑ¿ô #Mfoundry ¤Ï <tt>"fonudry"</tt> 
+    ÊÑ¿ô #Mfoundry ¤Ï <tt>"foundry"</tt> 
     ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Ä¥·¥ó¥Ü¥ë¤Ç¤¢¤ê¡¢¥Õ¥©¥ó¥È¥×¥í¥Ñ¥Æ¥£¤È¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¤Î¥­¡¼¤È¤·¤ÆÍѤ¤¤é¤ì¤ë¡£
     Ãͤϡ¢¥Õ¥©¥ó¥È¤Î³«È¯¸µÌ¾¤ò̾Á°¤È¤·¤Æ»ý¤Ä¥·¥ó¥Ü¥ë¤Ç¤¢¤ë¡£    */
 
@@ -2158,42 +2160,42 @@ MSymbol Mfontconfig;
 /***en
     @brief Symbol of name "x".
 
-    The variable #Mx is to be used for a value of <type> member of the
-    structure #MDrawGlyph to specify the type of <fontp> member is
+    The variable #Mx is to be used for a value of \<type\> member of the
+    structure #MDrawGlyph to specify the type of \<fontp\> member is
     actually (XFontStruct *).  */
 /***ja
     @brief "x" ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Ä¥·¥ó¥Ü¥ë.
 
-    ÊÑ¿ô #Mx ¤Ï¹½Â¤ #MDrawGlyph ¤Î¥á¥ó¥Ð <type> 
-    ¤ÎÃͤȤ·¤ÆÍѤ¤¤é¤ì¡¢¥á¥ó¥Ð <fontp> ¤Î·¿¤¬¼ÂºÝ¤Ë¤Ï (XFontStruct *) ¤Ç¤¢¤ë¤³¤È¤òɽ¤¹.  */
+    ÊÑ¿ô #Mx ¤Ï¹½Â¤ #MDrawGlyph ¤Î¥á¥ó¥Ð \<type\> 
+    ¤ÎÃͤȤ·¤ÆÍѤ¤¤é¤ì¡¢¥á¥ó¥Ð \<fontp\> ¤Î·¿¤¬¼ÂºÝ¤Ë¤Ï (XFontStruct *) ¤Ç¤¢¤ë¤³¤È¤òɽ¤¹.  */
 
 MSymbol Mx;
 
 /***en
     @brief Symbol of name "freetype".
 
-    The variable #Mfreetype is to be used for a value of <type> member
-    of the structure #MDrawGlyph to specify the type of <fontp> member
+    The variable #Mfreetype is to be used for a value of \<type\> member
+    of the structure #MDrawGlyph to specify the type of \<fontp\> member
     is actually FT_Face.  */
 /***ja
     @brief "freetype" ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Ä¥·¥ó¥Ü¥ë.
 
-    ÊÑ¿ô #Mfreetype ¤Ï¹½Â¤ #MDrawGlyph ¤Î¥á¥ó¥Ð <type> 
-    ¤ÎÃͤȤ·¤ÆÍѤ¤¤é¤ì¡¢¥á¥ó¥Ð <fontp> ¤Î·¿¤¬¼ÂºÝ¤Ë¤Ï FT_Face ¤Ç¤¢¤ë¤³¤È¤òɽ¤¹¡£  */
+    ÊÑ¿ô #Mfreetype ¤Ï¹½Â¤ #MDrawGlyph ¤Î¥á¥ó¥Ð \<type\> 
+    ¤ÎÃͤȤ·¤ÆÍѤ¤¤é¤ì¡¢¥á¥ó¥Ð \<fontp\> ¤Î·¿¤¬¼ÂºÝ¤Ë¤Ï FT_Face ¤Ç¤¢¤ë¤³¤È¤òɽ¤¹¡£  */
 
 MSymbol Mfreetype;
 
 /***en
     @brief Symbol of name "xft".
 
-    The variable #Mxft is to be used for a value of <type> member of the
-    structure #MDrawGlyph to specify the type of <fontp> member
+    The variable #Mxft is to be used for a value of \<type\> member of the
+    structure #MDrawGlyph to specify the type of \<fontp\> member
     is actually (XftFont *).  */
 /***ja
     @brief  "xft" ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Ä¥·¥ó¥Ü¥ë.
 
-    ÊÑ¿ô #Mxft ¤Ï¹½Â¤ #MDrawGlyph ¤Î¥á¥ó¥Ð <type> 
-    ¤ÎÃͤȤ·¤ÆÍѤ¤¤é¤ì¡¢¥á¥ó¥Ð <fontp> ¤Î·¿¤¬¼ÂºÝ¤Ë¤Ï (XftFont *) ¤Ç¤¢¤ë¤³¤È¤òɽ¤¹¡£  */
+    ÊÑ¿ô #Mxft ¤Ï¹½Â¤ #MDrawGlyph ¤Î¥á¥ó¥Ð \<type\> 
+    ¤ÎÃͤȤ·¤ÆÍѤ¤¤é¤ì¡¢¥á¥ó¥Ð \<fontp\> ¤Î·¿¤¬¼ÂºÝ¤Ë¤Ï (XftFont *) ¤Ç¤¢¤ë¤³¤È¤òɽ¤¹¡£  */
 
 MSymbol Mxft;
 
@@ -2395,13 +2397,14 @@ mfont_copy (MFont *font)
     If $FONT is a return value of mfont_find (), $KEY can also be one
     of the following symbols:
 
-       #Mfont_ascent, #Mfont_descent, #Mmax_advance.
+       @b Mfont_ascent, @b Mfont_descent, #Mmax_advance.
 
-    @return If $KEY is @c Mfoundry, @c Mfamily, @c Mweight, @c Mstyle,
+    @return 
+    If $KEY is @c Mfoundry, @c Mfamily, @c Mweight, @c Mstyle,
     @c Mstretch, @c Madstyle, @c Mregistry, or @c Mspacing, this
     function returns the corresponding value as a symbol.  If the font
     does not have $KEY property, it returns @c Mnil.  If $KEY is @c
-    Msize, @c Mresolution, #Mfont_ascent, Mfont_descent, or
+    Msize, @c Mresolution, @b Mfont_ascent, Mfont_descent, or
     #Mmax_advance, this function returns the corresponding value as an
     integer.  If the font does not have $KEY property, it returns 0.
     If $KEY is something else, it returns @c NULL and assigns an error
@@ -2417,7 +2420,8 @@ mfont_copy (MFont *font)
        @c Mfoundry, @c Mfamily, @c Mweight, @c Mstyle, @c Mstretch,
        @c Madstyle, @c Mregistry, @c Msize, @c Mresolution, @c Mspacing.
 
-    @return $KEY ¤¬ @c Mfoundry, @c Mfamily, @c Mweight, @c Mstyle, @c
+    @return 
+    $KEY ¤¬ @c Mfoundry, @c Mfamily, @c Mweight, @c Mstyle, @c
     Mstretch, @c Madstyle, @c Mregistry, @c Mspacing ¤Î¤¤¤º¤ì¤«¤Ç¤¢¤ì¤Ð¡¢
     ÁêÅö¤¹¤ëÃͤò¥·¥ó¥Ü¥ë¤È¤·¤ÆÊÖ¤¹¡£¥Õ¥©¥ó¥È¤¬¤½¤Î¥×¥í¥Ñ¥Æ¥£¤ò»ý¤¿¤Ê¤¤
     ¾ì¹ç¤Ë¤Ï@c Mnil ¤òÊÖ¤¹¡£$KEY ¤¬ @c Msize ¤¢¤ë¤¤¤Ï @c Mresolution ¤Î
@@ -3040,7 +3044,8 @@ mfont_list_family_names (MFrame *frame)
     The mfont_check () function checkes if $FONT can be used for
     $SCRIPT and $LANGUAGE in $FONTSET on $FRAME.
 
-    @return If the font is usable, return 1.  Otherwise return 0.
+    @return 
+    If the font is usable, return 1.  Otherwise return 0.
  */
 
 int
@@ -3110,7 +3115,7 @@ mfont_open (MFrame *frame, MFont *font)
     @brief Encapusulate a font.
 
     The mfont_encapsulate () functions realizes a font by
-    encapusulating data $DATA or type $DATA_TYPE on #FRAME.  Currently
+    encapusulating data $DATA or type $DATA_TYPE on $FRAME.  Currently
     $DATA_TAPE is #Mfontconfig or #Mfreetype, and $DATA points to an
     object of FcPattern or FT_Face respectively.