[uniscribe] Half-support user features

Turning features on globally works now.
This commit is contained in:
Behdad Esfahbod 2013-08-06 14:45:36 -04:00
parent 639afdc690
commit 38d5c58d23

View File

@ -659,11 +659,27 @@ retry:
#undef MAX_ITEMS #undef MAX_ITEMS
int *range_char_counts = NULL; hb_auto_array_t<OPENTYPE_FEATURE_RECORD> feature_records;
TEXTRANGE_PROPERTIES **range_properties = NULL; hb_auto_array_t<TEXTRANGE_PROPERTIES> range_records;
int range_count = 0; hb_auto_array_t<TEXTRANGE_PROPERTIES*> range_properties;
if (num_features) { hb_auto_array_t<int> range_char_counts;
/* TODO setup ranges */ if (num_features)
{
for (unsigned int i = 0; i < num_features; i++)
{
OPENTYPE_FEATURE_RECORD *record = feature_records.push ();
if (likely (record))
{
record->tagFeature = hb_uint32_swap (features[i].tag);
record->lParameter = features[i].value;
}
}
TEXTRANGE_PROPERTIES *range_record = range_records.push ();
if (likely (range_record))
{
range_record->potfRecords = feature_records.array;
range_record->cotfRecords = feature_records.len;
}
} }
OPENTYPE_TAG language_tag = hb_uint32_swap (hb_ot_tag_from_language (buffer->props.language)); OPENTYPE_TAG language_tag = hb_uint32_swap (hb_ot_tag_from_language (buffer->props.language));
@ -677,15 +693,31 @@ retry:
unsigned int chars_offset = items[i].iCharPos; unsigned int chars_offset = items[i].iCharPos;
unsigned int item_chars_len = items[i + 1].iCharPos - chars_offset; unsigned int item_chars_len = items[i + 1].iCharPos - chars_offset;
if (num_features)
{
/* XXX We currently ignore feature ranges and apply all features to all characters.
* Also, turning off a previously turned-on feature doesn't work. We have to do
* that part ourselves and pass the active features down to Uniscribe. */
range_char_counts.shrink (0);
range_properties.shrink (0);
range_char_counts.push (); /* Can't fail. */
range_properties.push (); /* Can't fail. */
range_char_counts.array[0] = item_chars_len;
range_properties.array[0] = range_records.array;
}
retry_shape: retry_shape:
hr = funcs->ScriptShapeOpenType (font_data->hdc, hr = funcs->ScriptShapeOpenType (font_data->hdc,
&font_data->script_cache, &font_data->script_cache,
&items[i].a, &items[i].a,
script_tags[i], script_tags[i],
language_tag, language_tag,
range_char_counts, range_char_counts.array,
range_properties, range_properties.array,
range_count, range_properties.len,
wchars + chars_offset, wchars + chars_offset,
item_chars_len, item_chars_len,
glyphs_size - glyphs_offset, glyphs_size - glyphs_offset,
@ -725,9 +757,9 @@ retry:
&items[i].a, &items[i].a,
script_tags[i], script_tags[i],
language_tag, language_tag,
range_char_counts, range_char_counts.array,
range_properties, range_properties.array,
range_count, range_properties.len,
wchars + chars_offset, wchars + chars_offset,
log_clusters + chars_offset, log_clusters + chars_offset,
char_props + chars_offset, char_props + chars_offset,