Exemplo n.º 1
0
char
AudicleFont::draw_sub ( const std::string & str, char last ) 
{ 
    if ( str.length() == 0 ) return last; //empty string
    if ( last ) { //add kerning for the last character pair, if supplied
        glTranslated ( kerning ( last, str[0] ), 0, 0 );  
    }
    glPushMatrix();
    draw( str );
    glPopMatrix();
    glTranslated( length (str), 0 , 0 );        
    return *str.end();
}
Exemplo n.º 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;
    }

    // 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_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;
        }
    }
}
Exemplo n.º 3
0
Math::Vector2 SpriteFont::GetOffset(char previous, char character)
{
    GlyphMetric* glyph = (*m_Glyphs)[character];
    Math::Vector2 kerning(0, 0);
    if (previous != '\0')
    {
        for (int i = 0; i < glyph->Kerning.GetCount(); i++)
        {
            if (glyph->Kerning[i].First == character)
            {
                kerning = Math::Vector2(glyph->Kerning[i].Ammount, 0);
                break;
            }
        }
    }

    return kerning + Math::Vector2(glyph->OffsetX, glyph->OffsetY);
}
Exemplo n.º 4
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;
    }
}