OpenType Font Handling

OpenType Font Handling — Obtaining information from OpenType tables

Synopsis




typedef     PangoOTTag;
struct      PangoOTInfo;
struct      PangoOTRuleset;
enum        PangoOTTableType;
PangoOTInfo* pango_ot_info_get              (FT_Face face);
gboolean    pango_ot_info_find_script       (PangoOTInfo *info,
                                             PangoOTTableType table_type,
                                             PangoOTTag script_tag,
                                             guint *script_index);
gboolean    pango_ot_info_find_language     (PangoOTInfo *info,
                                             PangoOTTableType table_type,
                                             guint script_index,
                                             PangoOTTag language_tag,
                                             guint *language_index,
                                             guint *required_feature_index);
gboolean    pango_ot_info_find_feature      (PangoOTInfo *info,
                                             PangoOTTableType table_type,
                                             PangoOTTag feature_tag,
                                             guint script_index,
                                             guint language_index,
                                             guint *feature_index);
PangoOTTag* pango_ot_info_list_scripts      (PangoOTInfo *info,
                                             PangoOTTableType table_type);
PangoOTTag* pango_ot_info_list_languages    (PangoOTInfo *info,
                                             PangoOTTableType table_type,
                                             guint script_index,
                                             PangoOTTag language_tag);
PangoOTTag* pango_ot_info_list_features     (PangoOTInfo *info,
                                             PangoOTTableType table_type,
                                             PangoOTTag tag,
                                             guint script_index,
                                             guint language_index);
PangoOTRuleset* pango_ot_ruleset_new        (PangoOTInfo *info);
void        pango_ot_ruleset_add_feature    (PangoOTRuleset *ruleset,
                                             PangoOTTableType table_type,
                                             guint feature_index,
                                             gulong property_bit);
void        pango_ot_ruleset_shape          (PangoOTRuleset *ruleset,
                                             PangoGlyphString *glyphs,
                                             gulong *properties);

Description

Details

PangoOTTag

typedef guint32  PangoOTTag;

The PangoOTTag typedef is used to represent TrueType and OpenType four letter tags inside Pango. Use the FT_MAKE_TAG() macro defined in the FreeType2 header freetype/freetype.h to create PangoOTTags manually.


struct PangoOTInfo

struct PangoOTInfo;

The PangoOTInfo struct contains the various tables associated with an OpenType font. It contains only private fields and should only be accessed via the pango_ot_info_* functions which are documented below. To obtain a PangoOTInfo, use pango_ot_info_new().


struct PangoOTRuleset

struct PangoOTRuleset;

The PangoOTRuleSet structure holds a set of features selected from the tables in an OpenType font. (A feature is an operation such as adjusting glyph positioning that should be applied to a text feature such as a certain type of accent.) A PangoOTRuleSet is created with pango_ot_ruleset_new(), features are addded to it with pango_ot_ruleset_add_feature(), then it is applied to a PangoGlyphString with pango_ot_ruleset_shape().


enum PangoOTTableType

typedef enum 
{
  PANGO_OT_TABLE_GSUB,
  PANGO_OT_TABLE_GPOS
} PangoOTTableType;

The PangoOTTableType enumeration values are used to identify the various OpenType tables in the pango_ot_info_* functions.

PANGO_OT_TABLE_GSUBThe GSUB table.
PANGO_OT_TABLE_GPOSThe GPOS table.

pango_ot_info_get ()

PangoOTInfo* pango_ot_info_get              (FT_Face face);

Returns the PangoOTInfo structure for the given FreeType font.

Since: 1.2

face : a FT_Face.
Returns : the PangoOTInfo for face. This object will have the same lifetime as FT_Face.

pango_ot_info_find_script ()

gboolean    pango_ot_info_find_script       (PangoOTInfo *info,
                                             PangoOTTableType table_type,
                                             PangoOTTag script_tag,
                                             guint *script_index);

Finds the index of a script.

info : a PangoOTInfo.
table_type : the table type to obtain information about.
script_tag : the tag of the script to find.
script_index : location to store the index of the script, or NULL.
Returns : TRUE if the script was found.

pango_ot_info_find_language ()

gboolean    pango_ot_info_find_language     (PangoOTInfo *info,
                                             PangoOTTableType table_type,
                                             guint script_index,
                                             PangoOTTag language_tag,
                                             guint *language_index,
                                             guint *required_feature_index);

Finds the index of a language and its required feature index.

info : a PangoOTInfo.
table_type : the table type to obtain information about.
script_index : the index of the script whose languages are searched.
language_tag : the tag of the language to find.
language_index : location to store the index of the language, or NULL.
required_feature_index : location to store the required feature index of the language, or NULL.
Returns : TRUE if the language was found.

pango_ot_info_find_feature ()

gboolean    pango_ot_info_find_feature      (PangoOTInfo *info,
                                             PangoOTTableType table_type,
                                             PangoOTTag feature_tag,
                                             guint script_index,
                                             guint language_index,
                                             guint *feature_index);

Finds the index of a feature.

info : a PangoOTInfo.
table_type : the table type to obtain information about.
feature_tag : the tag of the feature to find.
script_index : the index of the script.
language_index : the index of the language whose features are searched, or 0xffff to use the default language of the script.
feature_index : location to store the index of the feature, or NULL.
Returns : TRUE if the feature was found.

pango_ot_info_list_scripts ()

PangoOTTag* pango_ot_info_list_scripts      (PangoOTInfo *info,
                                             PangoOTTableType table_type);

Obtains the list of available scripts.

info : a PangoOTInfo.
table_type : the table type to obtain information about.
Returns : a newly-allocated array containing the tags of the available scripts.

pango_ot_info_list_languages ()

PangoOTTag* pango_ot_info_list_languages    (PangoOTInfo *info,
                                             PangoOTTableType table_type,
                                             guint script_index,
                                             PangoOTTag language_tag);

Obtains the list of available languages for a given script.

info : a PangoOTInfo.
table_type : the table type to obtain information about.
script_index : the index of the script to list languages for.
language_tag : unused parameter.
Returns : a newly-allocated array containing the tags of the available languages.

pango_ot_info_list_features ()

PangoOTTag* pango_ot_info_list_features     (PangoOTInfo *info,
                                             PangoOTTableType table_type,
                                             PangoOTTag tag,
                                             guint script_index,
                                             guint language_index);

Obtains the list of features for the given language of the given script.

info : a PangoOTInfo.
table_type : the table type to obtain information about.
tag : unused parameter.
script_index : the index of the script to obtain information about.
language_index : the indes of the language to list features for, or 0xffff, to list features for the default language of the script.
Returns : a newly-allocated array containing the tags of the available features.

pango_ot_ruleset_new ()

PangoOTRuleset* pango_ot_ruleset_new        (PangoOTInfo *info);

Creates a new PangoOTRuleset for the given OpenType info.

info : a PangoOTInfo.
Returns : a new PangoOTRuleset.

pango_ot_ruleset_add_feature ()

void        pango_ot_ruleset_add_feature    (PangoOTRuleset *ruleset,
                                             PangoOTTableType table_type,
                                             guint feature_index,
                                             gulong property_bit);

Adds a feature to the ruleset. See pango_ot_ruleset_shape() for an explanation of property_bit.

ruleset : a PangoOTRuleset.
table_type : the table type to add a feature to.
feature_index : the index of the feature to add.
property_bit : the property bit to use for this feature.

pango_ot_ruleset_shape ()

void        pango_ot_ruleset_shape          (PangoOTRuleset *ruleset,
                                             PangoGlyphString *glyphs,
                                             gulong *properties);

Shapes a string of glyphs with the given properties according to ruleset.

ruleset : a PangoOTRuleset.
glyphs : a pointer to a PangoGlyphString.
properties : an array containing one gulong bitfield for each glyph, which gives the glyph's properties: If a certain bit is set for a glyph, the feature which has the same bit set in its property value is applied.