コード例 #1
0
void FontDescription::updateTypesettingFeatures() {
    m_fields.m_typesettingFeatures = s_defaultTypesettingFeatures;

    switch (textRendering()) {
    case AutoTextRendering:
        break;
    case OptimizeSpeed:
        m_fields.m_typesettingFeatures &= ~(blink::Kerning | Ligatures);
        break;
    case GeometricPrecision:
    case OptimizeLegibility:
        m_fields.m_typesettingFeatures |= blink::Kerning | Ligatures;
        break;
    }

    switch (getKerning()) {
    case FontDescription::NoneKerning:
        m_fields.m_typesettingFeatures &= ~blink::Kerning;
        break;
    case FontDescription::NormalKerning:
        m_fields.m_typesettingFeatures |= blink::Kerning;
        break;
    case FontDescription::AutoKerning:
        break;
    }

    // As per CSS (http://dev.w3.org/csswg/css-text-3/#letter-spacing-property),
    // When the effective letter-spacing between two characters is not zero (due
    // to either justification or non-zero computed letter-spacing), user agents
    // should not apply optional ligatures.
    if (m_letterSpacing == 0) {
        switch (commonLigaturesState()) {
        case FontDescription::DisabledLigaturesState:
            m_fields.m_typesettingFeatures &= ~blink::Ligatures;
            break;
        case FontDescription::EnabledLigaturesState:
            m_fields.m_typesettingFeatures |= blink::Ligatures;
            break;
        case FontDescription::NormalLigaturesState:
            break;
        }

        if (discretionaryLigaturesState() ==
                FontDescription::EnabledLigaturesState ||
                historicalLigaturesState() == FontDescription::EnabledLigaturesState ||
                contextualLigaturesState() == FontDescription::EnabledLigaturesState) {
            m_fields.m_typesettingFeatures |= blink::Ligatures;
        }
    }

    if (variantCaps() != CapsNormal)
        m_fields.m_typesettingFeatures |= blink::Caps;
}
コード例 #2
0
void FontDescription::updateTypesettingFeatures() const
{
    m_typesettingFeatures = s_defaultTypesettingFeatures;

    switch (textRendering()) {
    case AutoTextRendering:
        break;
    case OptimizeSpeed:
        m_typesettingFeatures &= ~(WebCore::Kerning | Ligatures);
        break;
    case GeometricPrecision:
    case OptimizeLegibility:
        m_typesettingFeatures |= WebCore::Kerning | Ligatures;
        break;
    }

    switch (kerning()) {
    case FontDescription::NoneKerning:
        m_typesettingFeatures &= ~WebCore::Kerning;
        break;
    case FontDescription::NormalKerning:
        m_typesettingFeatures |= WebCore::Kerning;
        break;
    case FontDescription::AutoKerning:
        break;
    }

    switch (commonLigaturesState()) {
    case FontDescription::DisabledLigaturesState:
        m_typesettingFeatures &= ~Ligatures;
        break;
    case FontDescription::EnabledLigaturesState:
        m_typesettingFeatures |= Ligatures;
        break;
    case FontDescription::NormalLigaturesState:
        break;
    }

    if (discretionaryLigaturesState() == FontDescription::EnabledLigaturesState
        || historicalLigaturesState() == FontDescription::EnabledLigaturesState
        || contextualLigaturesState() == FontDescription::EnabledLigaturesState) {
        m_typesettingFeatures |= WebCore::Ligatures;
    }
}