Esempio n. 1
0
/**
 * pango_ot_ruleset_maybe_add_feature:
 * @ruleset: a #PangoOTRuleset.
 * @table_type: the table type to add a feature to.
 * @feature_tag: the tag of the feature to add.
 * @property_bit: the property bit to use for this feature. Used to identify
 *                the glyphs that this feature should be applied to, or
 *                %PANGO_OT_ALL_GLYPHS if it should be applied to all glyphs.
 *
 * This is a convenience function that first tries to find the feature
 * using pango_ot_info_find_feature() and the ruleset script and language
 * passed to pango_ot_ruleset_new_for(),
 * and if the feature is found, adds it to the ruleset.
 *
 * If @ruleset was not created using pango_ot_ruleset_new_for(), this function
 * does nothing.
 *
 * Return value: %TRUE if the feature was found and added to ruleset,
 *               %FALSE otherwise.
 *
 * Since: 1.18
 **/
gboolean
pango_ot_ruleset_maybe_add_feature (PangoOTRuleset          *ruleset,
                                    PangoOTTableType         table_type,
                                    PangoOTTag               feature_tag,
                                    gulong                   property_bit)
{
    guint feature_index;

    g_return_val_if_fail (PANGO_IS_OT_RULESET (ruleset), FALSE);
    g_return_val_if_fail (ruleset->info != NULL, FALSE);

    pango_ot_info_find_feature (ruleset->info, table_type,
                                feature_tag,
                                ruleset->script_index[table_type],
                                ruleset->language_index[table_type],
                                &feature_index);

    if (feature_index != PANGO_OT_NO_FEATURE)
    {
        pango_ot_ruleset_add_feature (ruleset, table_type,
                                      feature_index, property_bit);
        return TRUE;
    }

    return FALSE;
}
Esempio n. 2
0
static void
maybe_add_GPOS_feature (PangoOTRuleset *ruleset,
                        PangoOTInfo    *info,
                        guint           script_index,
                        PangoOTTag      tag,
                        gulong          property_bit)
{
  guint feature_index;

  /* 0xffff == default language system */
  if (pango_ot_info_find_feature (info, PANGO_OT_TABLE_GPOS,
                                  tag, script_index, 0xffff, &feature_index))
    pango_ot_ruleset_add_feature (ruleset, PANGO_OT_TABLE_GPOS, feature_index,
                                  property_bit);
}
Esempio n. 3
0
static void
maybe_add_GPOS_feature (PangoOTRuleset *ruleset,
		        PangoOTInfo    *info,
			guint           script_index,
			PangoOTTag      feature_tag,
			gulong          property_bit)
{
  guint feature_index;

  if (pango_ot_info_find_feature (info, PANGO_OT_TABLE_GPOS,
				  feature_tag,script_index, 0xffff, &feature_index))
    {
      /*
      printf("Added GPOS feature '%c%c%c%c' = %8.8X\n", feature_tag>>24, feature_tag>>16&0xFF, feature_tag>>8&0xFF, feature_tag&0xFF, property_bit);
      */

      pango_ot_ruleset_add_feature (ruleset, PANGO_OT_TABLE_GPOS, feature_index,
				    property_bit);
    }
}