*** empty log message ***
[m17n/m17n-lib.git] / src / font.h
index 4cfeff0..592fa2a 100644 (file)
@@ -1,5 +1,5 @@
 /* font.h -- header file for the font module.
-   Copyright (C) 2003, 2004
+   Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
      National Institute of Advanced Industrial Science and Technology (AIST)
      Registration Number H15PRO112
 
@@ -104,9 +104,9 @@ struct MFont
       For the time being, we mention only Y-resolution (resy) and
       assume that resx is always equal to resy.  */
   unsigned short property[MFONT_PROPERTY_MAX];
-  enum MFontType type : 2;
-  enum MFontSource source : 2;
-  enum MFontSpacing spacing : 2;
+  unsigned type : 2;
+  unsigned source : 2;
+  unsigned spacing : 2;
   unsigned for_full_width : 1;
   /* For FONT-OBJ, 1 means `size' is a logical or of bit masks for
      available pixel sizes (Nth bit corresponds to (6 + N) pixels), 0
@@ -140,6 +140,9 @@ struct MRealizedFont
      so that this object can be distingushed from MFont.  */
   MFont spec;
 
+  /* Font identifier. */
+  MSymbol id;
+
   /* Frame on which the font is realized.  */
   MFrame *frame;
 
@@ -159,6 +162,8 @@ struct MRealizedFont
      non-NULL, it must be a pointer to a managed object.  */
   void *info;
 
+  int x_ppem, y_ppem;
+
   int ascent, descent, max_advance, average_width, baseline_offset;
 
   /* Pointer to the font structure.  */
@@ -167,6 +172,11 @@ struct MRealizedFont
   MRealizedFont *next;
 };
 
+typedef struct MFLTFontForRealized {
+  MFLTFont font;
+  MRealizedFont *rfont;
+} MFLTFontForRealized;
+
 typedef struct {
   MFont *font;
   int score;
@@ -227,6 +237,18 @@ struct MFontDriver
   MRealizedFont *(*encapsulate) (MFrame *frame, MSymbol source, void *data);
 
   void (*close) (MRealizedFont *rfont);
+
+  int (*check_otf) (MFLTFont *font, MFLTOtfSpec *spec);
+
+  int (*drive_otf) (MFLTFont *font, MFLTOtfSpec *spec,
+                   MFLTGlyphString *in, int from, int to,
+                   MFLTGlyphString *out, MFLTGlyphAdjustment *adjustment);
+
+  int (*try_otf) (MFLTFont *font, MFLTOtfSpec *spec,
+                 MFLTGlyphString *in, int from, int to);
+
+  int (*iterate_otf_feature) (struct _MFLTFont *font, MFLTOtfSpec *spec,
+                             int from, int to, unsigned char *table);
 };
 
 /** Initialize the members of FONT.  */
@@ -244,6 +266,7 @@ extern void mfont__flt_fini ();
 #ifdef HAVE_FREETYPE
 #include <ft2build.h>
 #include FT_FREETYPE_H
+#endif
 
 #ifdef HAVE_FONTCONFIG
 #include <fontconfig/fontconfig.h>
@@ -277,6 +300,7 @@ typedef struct
   } features[MFONT_OTT_MAX];
 } MFontCapability;
 
+#ifdef HAVE_FREETYPE
 extern MFontDriver mfont__ft_driver;
 
 extern int mfont__ft_init ();
@@ -313,6 +337,9 @@ extern int mfont__has_char (MFrame *frame, MFont *font, MFont *spec, int c);
 extern unsigned mfont__encode_char (MFrame *frame, MFont *font, MFont *spec,
                                    int c);
 
+extern int mfont__get_glyph_id (MFLTFont *font, MFLTGlyphString *gstring,
+                               int from, int to);
+
 extern MFont *mfont__select (MFrame *frame, MFont *font, int max_size);
 
 extern MFontList *mfont__list (MFrame *frame, MFont *spec, MFont *request,
@@ -322,6 +349,9 @@ extern MRealizedFont *mfont__open (MFrame *frame, MFont *font, MFont *spec);
 
 extern void mfont__get_metric (MGlyphString *gstring, int from, int to);
 
+extern int mfont__get_metrics (MFLTFont *font, MFLTGlyphString *gstring,
+                              int from, int to);
+
 extern void mfont__set_property (MFont *font, enum MFontProperty key,
                                 MSymbol val);