[GX] Add hb_ot_layout_table_find_feature_variations()
This commit is contained in:
parent
7ceadbe981
commit
30c42b644e
|
@ -1342,7 +1342,7 @@ struct ConditionFormat1
|
||||||
friend struct Condition;
|
friend struct Condition;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
inline bool evaluate (int *coords, unsigned int coord_len) const
|
inline bool evaluate (const int *coords, unsigned int coord_len) const
|
||||||
{
|
{
|
||||||
int coord = axisIndex < coord_len ? coords[axisIndex] : 0;
|
int coord = axisIndex < coord_len ? coords[axisIndex] : 0;
|
||||||
return filterRangeMinValue <= coord && coord <= filterRangeMaxValue;
|
return filterRangeMinValue <= coord && coord <= filterRangeMaxValue;
|
||||||
|
@ -1365,7 +1365,7 @@ struct ConditionFormat1
|
||||||
|
|
||||||
struct Condition
|
struct Condition
|
||||||
{
|
{
|
||||||
inline bool evaluate (int *coords, unsigned int coord_len) const
|
inline bool evaluate (const int *coords, unsigned int coord_len) const
|
||||||
{
|
{
|
||||||
switch (u.format) {
|
switch (u.format) {
|
||||||
case 1: return u.format1.evaluate (coords, coord_len);
|
case 1: return u.format1.evaluate (coords, coord_len);
|
||||||
|
@ -1394,7 +1394,7 @@ struct Condition
|
||||||
|
|
||||||
struct ConditionSet
|
struct ConditionSet
|
||||||
{
|
{
|
||||||
inline bool evaluate (int *coords, unsigned int coord_len) const
|
inline bool evaluate (const int *coords, unsigned int coord_len) const
|
||||||
{
|
{
|
||||||
unsigned int count = conditions.len;
|
unsigned int count = conditions.len;
|
||||||
for (unsigned int i = 0; i < count; i++)
|
for (unsigned int i = 0; i < count; i++)
|
||||||
|
@ -1470,17 +1470,21 @@ struct FeatureVariationRecord
|
||||||
|
|
||||||
struct FeatureVariations
|
struct FeatureVariations
|
||||||
{
|
{
|
||||||
inline const FeatureTableSubstitution &
|
inline bool find_index (const int *coords, unsigned int coord_len,
|
||||||
get_substitutions (int *coords, unsigned int coord_len) const
|
unsigned int *index) const
|
||||||
{
|
{
|
||||||
unsigned int count = varRecords.len;
|
unsigned int count = varRecords.len;
|
||||||
for (unsigned int i = 0; i < count; i++)
|
for (unsigned int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
const FeatureVariationRecord &record = varRecords.array[i];
|
const FeatureVariationRecord &record = varRecords.array[i];
|
||||||
if ((this+record.conditions).evaluate (coords, coord_len))
|
if ((this+record.conditions).evaluate (coords, coord_len))
|
||||||
return (this+record.substitutions);
|
{
|
||||||
|
*index = i;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return Null(FeatureTableSubstitution);
|
}
|
||||||
|
*index = 0xFFFFFFFF;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *c) const
|
inline bool sanitize (hb_sanitize_context_t *c) const
|
||||||
|
|
|
@ -2271,10 +2271,10 @@ struct GSUBGPOS
|
||||||
inline const Lookup& get_lookup (unsigned int i) const
|
inline const Lookup& get_lookup (unsigned int i) const
|
||||||
{ return (this+lookupList)[i]; }
|
{ return (this+lookupList)[i]; }
|
||||||
|
|
||||||
inline const FeatureTableSubstitution &
|
inline bool find_variations_index (const int *coords, unsigned int num_coords,
|
||||||
get_feature_substitutions (int *coords, unsigned int coord_len) const
|
unsigned int *index) const
|
||||||
{ return (version.to_int () >= 0x00010001u ? this+featureVars : Null(FeatureVariations))
|
{ return (version.to_int () >= 0x00010001u ? this+featureVars : Null(FeatureVariations))
|
||||||
.get_substitutions (coords, coord_len); }
|
.find_index (coords, num_coords, index); }
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *c) const
|
inline bool sanitize (hb_sanitize_context_t *c) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -836,6 +836,21 @@ hb_ot_layout_lookup_collect_glyphs (hb_face_t *face,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Variations support */
|
||||||
|
|
||||||
|
hb_bool_t
|
||||||
|
hb_ot_layout_table_find_feature_variations (hb_face_t *face,
|
||||||
|
hb_tag_t table_tag,
|
||||||
|
const int *coords,
|
||||||
|
unsigned int num_coords,
|
||||||
|
unsigned int *variations_index /* out */)
|
||||||
|
{
|
||||||
|
const OT::GSUBGPOS &g = get_gsubgpos_table (face, table_tag);
|
||||||
|
|
||||||
|
return g.find_variations_index (coords, num_coords, variations_index);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* OT::GSUB
|
* OT::GSUB
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -95,6 +95,7 @@ hb_ot_layout_get_ligature_carets (hb_font_t *font,
|
||||||
#define HB_OT_LAYOUT_NO_SCRIPT_INDEX 0xFFFFu
|
#define HB_OT_LAYOUT_NO_SCRIPT_INDEX 0xFFFFu
|
||||||
#define HB_OT_LAYOUT_NO_FEATURE_INDEX 0xFFFFu
|
#define HB_OT_LAYOUT_NO_FEATURE_INDEX 0xFFFFu
|
||||||
#define HB_OT_LAYOUT_DEFAULT_LANGUAGE_INDEX 0xFFFFu
|
#define HB_OT_LAYOUT_DEFAULT_LANGUAGE_INDEX 0xFFFFu
|
||||||
|
#define HB_OT_LAYOUT_NO_VARIATIONS_INDEX 0xFFFFFFFFu
|
||||||
|
|
||||||
HB_EXTERN unsigned int
|
HB_EXTERN unsigned int
|
||||||
hb_ot_layout_table_get_script_tags (hb_face_t *face,
|
hb_ot_layout_table_get_script_tags (hb_face_t *face,
|
||||||
|
@ -236,6 +237,15 @@ Xhb_ot_layout_lookup_enumerate_sequences (hb_face_t *face,
|
||||||
void *user_data);
|
void *user_data);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Variations support */
|
||||||
|
|
||||||
|
HB_EXTERN hb_bool_t
|
||||||
|
hb_ot_layout_table_find_feature_variations (hb_face_t *face,
|
||||||
|
hb_tag_t table_tag,
|
||||||
|
const int *coords,
|
||||||
|
unsigned int num_coords,
|
||||||
|
unsigned int *variations_index /* out */);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GSUB
|
* GSUB
|
||||||
|
|
Loading…
Reference in New Issue