Changeset 177957 in webkit


Ignore:
Timestamp:
Jan 6, 2015, 6:49:24 AM (10 years ago)
Author:
Antti Koivisto
Message:

Resolve mirroring and variant in Font instead of FontGlyphs
https://bugs.webkit.org/show_bug.cgi?id=140079

Reviewed by Darin Adler.

Make FontGlyphs more focused. It doesn't need to know about resolving variants and mirroring.

  • platform/graphics/Font.cpp:

(WebCore::Font::glyphDataForCharacter):

  • platform/graphics/Font.h:

(WebCore::Font::glyphDataForCharacter): Deleted.

  • platform/graphics/FontGlyphs.cpp:

(WebCore::FontGlyphs::glyphDataForCharacter):

  • platform/graphics/FontGlyphs.h:
Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r177956 r177957  
     12015-01-06  Antti Koivisto  <antti@apple.com>
     2
     3        Resolve mirroring and variant in Font instead of FontGlyphs
     4        https://bugs.webkit.org/show_bug.cgi?id=140079
     5
     6        Reviewed by Darin Adler.
     7
     8        Make FontGlyphs more focused. It doesn't need to know about resolving variants and mirroring.
     9
     10        * platform/graphics/Font.cpp:
     11        (WebCore::Font::glyphDataForCharacter):
     12        * platform/graphics/Font.h:
     13        (WebCore::Font::glyphDataForCharacter): Deleted.
     14        * platform/graphics/FontGlyphs.cpp:
     15        (WebCore::FontGlyphs::glyphDataForCharacter):
     16        * platform/graphics/FontGlyphs.h:
     17
    1182015-01-06  Shivakumar JM  <shiva.jm@samsung.com>
    219
  • trunk/Source/WebCore/platform/graphics/Font.cpp

    r177955 r177957  
    416416    glyphName = "";
    417417    return width(run);
     418}
     419
     420GlyphData Font::glyphDataForCharacter(UChar32 c, bool mirror, FontDataVariant variant) const
     421{
     422    if (variant == AutoVariant) {
     423        if (m_fontDescription.smallCaps() && !primaryFontData().isSVGFont()) {
     424            UChar32 upperC = u_toupper(c);
     425            if (upperC != c) {
     426                c = upperC;
     427                variant = SmallCapsVariant;
     428            } else
     429                variant = NormalVariant;
     430        } else
     431            variant = NormalVariant;
     432    }
     433
     434    if (mirror)
     435        c = u_charMirror(c);
     436
     437    return m_glyphs->glyphDataForCharacter(c, m_fontDescription, variant);
    418438}
    419439
  • trunk/Source/WebCore/platform/graphics/Font.h

    r177955 r177957  
    186186    const SimpleFontData& primaryFontData() const;
    187187    const FontData* fontDataAt(unsigned) const;
    188     GlyphData glyphDataForCharacter(UChar32 c, bool mirror, FontDataVariant variant = AutoVariant) const
    189     {
    190         return m_glyphs->glyphDataForCharacter(m_fontDescription, c, mirror, variant);
    191     }
     188    GlyphData glyphDataForCharacter(UChar32, bool mirror, FontDataVariant = AutoVariant) const;
     189   
    192190#if PLATFORM(COCOA)
    193191    const SimpleFontData* fontDataForCombiningCharacterSequence(const UChar*, size_t length, FontDataVariant) const;
  • trunk/Source/WebCore/platform/graphics/FontGlyphs.cpp

    r177955 r177957  
    361361}
    362362
    363 GlyphData FontGlyphs::glyphDataForCharacter(const FontDescription& description, UChar32 c, bool mirror, FontDataVariant variant)
     363GlyphData FontGlyphs::glyphDataForCharacter( UChar32 c, const FontDescription& description, FontDataVariant variant)
    364364{
    365365    ASSERT(isMainThread());
    366 
    367     if (variant == AutoVariant) {
    368         if (description.smallCaps() && !primarySimpleFontData(description).isSVGFont()) {
    369             UChar32 upperC = u_toupper(c);
    370             if (upperC != c) {
    371                 c = upperC;
    372                 variant = SmallCapsVariant;
    373             } else
    374                 variant = NormalVariant;
    375         } else
    376             variant = NormalVariant;
    377     }
    378 
    379     if (mirror)
    380         c = u_charMirror(c);
     366    ASSERT(variant != AutoVariant);
    381367
    382368    if (variant != NormalVariant)
  • trunk/Source/WebCore/platform/graphics/FontGlyphs.h

    r177955 r177957  
    5353    bool isForPlatformFont() const { return m_isForPlatformFont; }
    5454
    55     GlyphData glyphDataForCharacter(const FontDescription&, UChar32, bool mirror, FontDataVariant);
     55    GlyphData glyphDataForCharacter(UChar32, const FontDescription&, FontDataVariant);
    5656
    5757    bool isFixedPitch(const FontDescription&);
Note: See TracChangeset for help on using the changeset viewer.