From: handa Date: Mon, 29 Oct 2007 02:29:30 +0000 (+0000) Subject: * m17n-flt.h (struct _MFLTOtfSpec): Adjusted for the new FLT handling. X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7e87344fd0e87dee492d633465bc51bf58b8af28;p=m17n%2Fm17n-lib.git * m17n-flt.h (struct _MFLTOtfSpec): Adjusted for the new FLT handling. (mflt_get): Adjusted for the argument change. (mflt_name): Adjusted for the return value change. --- diff --git a/src/m17n-flt.h b/src/m17n-flt.h index 083e722..526978c 100644 --- a/src/m17n-flt.h +++ b/src/m17n-flt.h @@ -42,10 +42,12 @@ extern void m17n_fini_flt (void); #endif /***en @defgroup m17nFLT FLT API */ -/***ja @defgroup m17nGUI FLT API */ +/***ja @defgroup m17nFLT FLT API */ /*=*/ -/*** @ingroup m17nFLT */ +/*** @addtogroup m17nFLT */ +/*** @{ */ +/*=*/ /***en @brief Type of information about a glyph. @@ -57,17 +59,22 @@ typedef struct _MFLTGlyph MFLTGlyph; struct _MFLTGlyph { - /***en Character code (Unicode) of the glyph. This is the sole + /***en @brief Character code (Unicode) of the glyph. This is the sole member to be set before calling the functions mflt_find () and mflt_run (). */ int c; /***en Glyph-id of the font of the glyph. */ unsigned int code; - /***en Glyph indices indicating the range of original glyphs. */ - int from, to; - /***en Advance width for horizontal layout and advance height for - vertical layout expressed in 26.6 fractional pixel format. */ - int xadv, yadv; + /***en Glyph indices indicating the start of the original glyphs. */ + int from; + /***en Glyph indices indicating the end of the original glyphs. */ + int to; + /***en Advance width for horizontal layout expressed in 26.6 + fractional pixel format. */ + int xadv; + /***en Advance height for vertical layout expressed in 26.6 + fractional pixel format. */ + int yadv; /***en Ink metrics of the glyph expressed in 26.6 fractional pixel format. */ int ascent, descent, lbearing, rbearing; @@ -86,22 +93,24 @@ struct _MFLTGlyph /* Arbitrary data can follow. */ }; +/*=*/ + /***en @brief Type of information about a glyph position adjustment. - The type #MFLTGlyphAdjustment is the structure that contains - information about a glyph position adjustment. It is used as an - argument to the callback function #drive_otf of #MFLTFont. */ + 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. */ typedef struct _MFLTGlyphAdjustment MFLTGlyphAdjustment; struct _MFLTGlyphAdjustment { - /***en Adjustments advance width for horizontal layout and advance - height for vertical layout expressed in 26.6 fractional pixel - format. */ + /***en Adjustments for advance width for horizontal layout and + advance height for vertical layout expressed in 26.6 fractional + pixel format. */ int xadv, yadv; - /***en Horizontal and vertical adjustment for a glyph positioning + /***en Horizontal and vertical adjustments for a glyph positioning expressed in 26.6 fractional pixel format. */ int xoff, yoff; /***en Number of glyphs to go back for drawing a glyph. */ @@ -110,8 +119,8 @@ struct _MFLTGlyphAdjustment they should not be added to a glyph's origianl advance width and height. */ unsigned advance_is_absolute : 1; - /***en If nonzero, at least one of the other members has a nonzero - value. */ + /***en Should be set to 1 iff at least one of the other members has + a nonzero value. */ unsigned set : 1; }; @@ -126,7 +135,8 @@ typedef struct _MFLTGlyphString MFLTGlyphString; struct _MFLTGlyphString { /***en The actual byte size of elements of the array pointed by the - member #glyphs. It must be greater than "sizeof (MFLTGlyph)". */ + member #glyphs. It must be equal to or greater than "sizeof + (MFLTGlyph)". */ int glyph_size; /***en Array of glyphs. */ MFLTGlyph *glyphs; @@ -134,30 +144,13 @@ struct _MFLTGlyphString int allocated; /***en How many elements in #glyphs are in use. */ int used; - /***en OTF script tag. Zero means */ - unsigned int script; - /***en OTF language system tag. */ - unsigned int language; -}; - -/***en - @brief Type of information about GSUB/GPOS features of OTF. - - The type #MFLTOtfSpec is the structure that contains information - about GSUB and GPOS features to be applied to a glyph sequence. */ - -typedef struct _MFLTOtfFeatures MFLTOtfFeatures; - -struct _MFLTOtfFeatures -{ - /***en Number of feature tags stored in the member . */ - int count; - /***en Array of feature tags. */ - unsigned int *tags; + /***en Flag to tell if the glyphs should be drawn from right-to-left + or not. */ + unsigned int r2l; }; /***en - @brief Type of information about requested spec of OpenType tables. + @brief Type of specification of GSUB and GPOS OpenType tables. The type #MFLTOtfSpec is the structure that contains information about GSUB and GPOS features of a specific script and language @@ -170,71 +163,92 @@ struct _MFLTOtfSpec /***en Unique symbol representing the spec. This is the same as the #OTF-SPEC of the FLT. */ MSymbol sym; - /***en Tags for script and language system. */ + + /***en Tags for script and language system. */ unsigned int script, langsys; - /***en Array of GSUB (1st element) and GPOS (2nd element) - features. */ - MFLTOtfFeatures gsub_gpos[2]; + + /***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 appearing in the following elements. + It may be NULL if there's no feature. */ + unsigned int *features[2]; }; +/***en + @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. */ + typedef struct _MFLTFont MFLTFont; struct _MFLTFont { - /* Family name of the font. It may be #Mnil if the family name is - not important in finding a Font Layout Table suitable for the + /***en Family name of the font. It may be #Mnil if the family name + is not important in finding a Font Layout Table suitable for the font (for instance, in the case that the font is an OpenType font). */ MSymbol family; - /* Horizontal and vertical font sizes in pixel per EM. */ + /***en Horizontal and vertical font sizes in pixel per EM. */ int x_ppem, y_ppem; - /* Callback function to check if the font has OpenType GSUB/GPOS - features for a specific script/language. The function must - return 1 if the font satisfy SPEC, else return 0. */ - int (*check_otf) (MFLTFont *font, MFLTOtfSpec *spec); - - /* Callback function to get glyph IDs for glyphs between FROM + /***en Callback function to get glyph IDs for glyphs between FROM (inclusive) and TO (exclusive) of GSTRING. If member of a glyph is zero, the member of the glyph is a character code. The function must convert it to the glyph ID of FONT. */ int (*get_glyph_id) (MFLTFont *font, MFLTGlyphString *gstring, - int form, int to); + int from, int to); - /* Callback function to get metrics of glyphs between FROM + /*** Callback function to get metrics of glyphs between FROM (inclusive) and TO (exclusive) of GSTRING. If member of a glyph is zero, the function must set members , , , , , and of the glyph. */ int (*get_metrics) (MFLTFont *font, MFLTGlyphString *gstring, - int form, int to); + int from, int to); + + /***en Callback function to check if the font has OpenType GSUB/GPOS + features for a specific script/language. The function must + return 1 if the font satisfy SPEC, else return 0. It must be + NULL if the font doesn't have OpenType tables. */ + int (*check_otf) (MFLTFont *font, MFLTOtfSpec *spec); - /* Callback function to apply OpenType features in SPEC to glyphs + /*** Callback function to apply OpenType features in SPEC to glyphs between FROM (inclusive) and TO (exclusive) of IN. The resulting glyphs should be appended to the tail of OUT. If OUT doesn't - have a room to store all resulting glyphs, it must return -2. */ + have a room to store all resulting glyphs, it must return -2. + It must be NULL if the font doesn't have OpenType tables. */ int (*drive_otf) (MFLTFont *font, MFLTOtfSpec *spec, MFLTGlyphString *in, int from, int to, MFLTGlyphString *out, MFLTGlyphAdjustment *adjustment); - /* Arbitrary data can follow. */ + + /***en For m17n-lib's internal use only. It should be initialized + to NULL. */ + void *internal; }; +/***en + @brief Type of FLT (Font Layout Table). + + The type #MFLT is for a FLT object. Its internal structure is + concealed from application program. */ + typedef struct _MFLT MFLT; -extern MFLT *mflt_get (char *name); +extern MFLT *mflt_get (MSymbol name); extern MFLT *mflt_find (int c, MFLTFont *font); -extern char *mflt_name (MFLT *flt); +extern const char *mflt_name (MFLT *flt); extern MCharTable *mflt_coverage (MFLT *flt); extern int mflt_run (MFLTGlyphString *gstring, int from, int to, MFLTFont *font, MFLT *flt); -#if !defined (FOR_DOXYGEN) || defined (DOXYGEN_INTERNAL_MODULE) -#define MCHAR_INVALID_CODE 0xFFFFFFFF -#endif +/*=*/ +/*** @} */ M17N_END_HEADER