Include <stdio.h>.
[m17n/m17n-lib.git] / src / font-ft.c
index d171775..3753a30 100644 (file)
@@ -42,7 +42,9 @@
 
 #ifdef HAVE_FREETYPE
 
+#ifdef HAVE_FTBDF_H
 #include <freetype/ftbdf.h>
+#endif
 
 #ifdef HAVE_FONTCONFIG
 static FcConfig *fc_config;
@@ -67,7 +69,7 @@ typedef struct
 static MFTtoProp ft_to_prop[] =
   { { "italic", 0, MFONT_STYLE, "i" },
     { "roman", 0, MFONT_STYLE, "r" },
-    { "oblique", 0, MFONT_STYLE, "p" },
+    { "oblique", 0, MFONT_STYLE, "o" },
     { "regular", 0, MFONT_WEIGHT, "medium" },
     { "normal", 0, MFONT_WEIGHT, "medium" },
     /* We need this entry even if "bold" is in commone_weight[] to
@@ -256,6 +258,7 @@ set_font_info (FT_Face ft_face, MFTInfo *ft_info,
 
   ft_info->charmap_list = charmap_list;
 
+#ifdef HAVE_FTBDF_H
   if (! FT_IS_SCALABLE (ft_face))
     {
       BDF_PropertyRec prop;
@@ -265,6 +268,7 @@ set_font_info (FT_Face ft_face, MFTInfo *ft_info,
       FT_Get_BDF_Property (ft_face, "RESOLUTION_Y", &prop);
       font->property[MFONT_RESY] = prop.u.integer;
     }
+#endif
 
   return family;
 }
@@ -296,7 +300,9 @@ static void
 add_font_info (char *filename, MSymbol family, void *langset, MPlist *plist)
 {
   FT_Face ft_face;
+#ifdef HAVE_FTBDF_H
   BDF_PropertyRec prop;
+#endif
 
   if (FT_New_Face (ft_library, filename, 0, &ft_face) == 0)
     {
@@ -329,7 +335,10 @@ add_font_info (char *filename, MSymbol family, void *langset, MPlist *plist)
 
       if (! mplist_get (plist, style)
          && (FT_IS_SCALABLE (ft_face)
-             || FT_Get_BDF_Property (ft_face, "PIXEL_SIZE", &prop) == 0))
+#ifdef HAVE_FTBDF_H
+             || FT_Get_BDF_Property (ft_face, "PIXEL_SIZE", &prop) == 0
+#endif
+             ))
        {
          int basep;
          MFTInfo *ft_info;
@@ -486,8 +495,8 @@ ft_list_family (MSymbol family)
 static MPlist *
 ft_list_generic (MSymbol generic)
 {
-  GenericFamilyInfo *info = msymbol_get (generic, M_generic_family_info);
 #ifdef HAVE_FONTCONFIG
+  GenericFamilyInfo *info = msymbol_get (generic, M_generic_family_info);
   FcPattern *pattern;
 
   if (! info)
@@ -516,8 +525,10 @@ ft_list_generic (MSymbol generic)
          i++;
        }
     }
-#endif /* HAVE_FONTCONFIG */
   return info->list;
+#else   /* not HAVE_FONTCONFIG */
+  return NULL;
+#endif /* not HAVE_FONTCONFIG */
 }
 
 
@@ -697,10 +708,13 @@ ft_find_metric (MRealizedFont *rfont, MGlyphString *gstring,
            }
          else
            {
+#ifdef HAVE_FTBDF_H
              BDF_PropertyRec prop;
+#endif
 
              g->lbearing = 0;
              g->rbearing = g->width = ft_face->available_sizes->width;
+#ifdef HAVE_FTBDF_H
              if (FT_Get_BDF_Property (ft_face, "ASCENT", &prop) == 0)
                {
                  g->ascent = prop.u.integer;
@@ -708,6 +722,7 @@ ft_find_metric (MRealizedFont *rfont, MGlyphString *gstring,
                  g->descent = prop.u.integer;
                }
              else
+#endif
                {
                  g->ascent = ft_face->available_sizes->height;
                  g->descent = 0;