PassRefPtr<FontFeatureSettings> StyleBuilderConverter::convertFontFeatureSettings(StyleResolverState& state, CSSValue* value)
{
    if (value->isPrimitiveValue() && toCSSPrimitiveValue(value)->getValueID() == CSSValueNormal)
        return FontBuilder::initialFeatureSettings();

    CSSValueList* list = toCSSValueList(value);
    RefPtr<FontFeatureSettings> settings = FontFeatureSettings::create();
    int len = list->length();
    for (int i = 0; i < len; ++i) {
        CSSFontFeatureValue* feature = toCSSFontFeatureValue(list->item(i));
        settings->append(FontFeature(feature->tag(), feature->value()));
    }
    return settings;
}
예제 #2
0
void FontBuilder::setFeatureSettingsValue(CSSValue* value)
{
    FontDescriptionChangeScope scope(this);

    CSSValueList* list = toCSSValueList(value);
    RefPtr<FontFeatureSettings> settings = FontFeatureSettings::create();
    int len = list->length();
    for (int i = 0; i < len; ++i) {
        CSSValue* item = list->itemWithoutBoundsCheck(i);
        if (!item->isFontFeatureValue())
            continue;
        CSSFontFeatureValue* feature = toCSSFontFeatureValue(item);
        settings->append(FontFeature(feature->tag(), feature->value()));
    }
    scope.fontDescription().setFeatureSettings(settings.release());
}