⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 94352 in webkit


Ignore:
Timestamp:
Sep 1, 2011, 3:32:43 PM (15 years ago)
Author:
mitz@apple.com
Message:

<rdar://problem/9528843> STIX glyphs not rendered on this stackoverflow answer
https://bugs.webkit.org/show_bug.cgi?id=67444

Reviewed by Darin Adler.

Source/WebCore:

Test: fast/text/fallback-traits-fixup.html

After obtaining STIX Regular as a fallback font for some characters, getFontDataForCharacters()
proceeded to ask for a font from the same family having the desired traits and weight (because
wkGetFontInLanguageForRange() does not preserve traits and weight). The returned font was different
and happened to not contain the desired character.

  • platform/graphics/mac/FontCacheMac.mm:

(WebCore::FontCache::getFontDataForCharacters): Only ask for a family member with the desired
traits and weight if the substitute font does not already have them, and only use the returned
member if it actually contains the desired character.

LayoutTests:

  • fast/text/fallback-traits-fixup.html: Added.
  • platform/mac/fast/text/fallback-traits-fixup-expected.png: Added.
  • platform/mac/fast/text/fallback-traits-fixup-expected.txt: Added.
Location:
trunk
Files:
3 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r94351 r94352  
     12011-09-01  Dan Bernstein  <mitz@apple.com>
     2
     3        <rdar://problem/9528843> STIX glyphs not rendered on this stackoverflow answer
     4        https://bugs.webkit.org/show_bug.cgi?id=67444
     5
     6        Reviewed by Darin Adler.
     7
     8        * fast/text/fallback-traits-fixup.html: Added.
     9        * platform/mac/fast/text/fallback-traits-fixup-expected.png: Added.
     10        * platform/mac/fast/text/fallback-traits-fixup-expected.txt: Added.
     11
    1122011-09-01  James Robinson  <jamesr@chromium.org>
    213
  • trunk/Source/WebCore/ChangeLog

    r94350 r94352  
     12011-09-01  Dan Bernstein  <mitz@apple.com>
     2
     3        <rdar://problem/9528843> STIX glyphs not rendered on this stackoverflow answer
     4        https://bugs.webkit.org/show_bug.cgi?id=67444
     5
     6        Reviewed by Darin Adler.
     7
     8        Test: fast/text/fallback-traits-fixup.html
     9
     10        After obtaining STIX Regular as a fallback font for some characters, getFontDataForCharacters()
     11        proceeded to ask for a font from the same family having the desired traits and weight (because
     12        wkGetFontInLanguageForRange() does not preserve traits and weight). The returned font was different
     13        and happened to not contain the desired character.
     14
     15        * platform/graphics/mac/FontCacheMac.mm:
     16        (WebCore::FontCache::getFontDataForCharacters): Only ask for a family member with the desired
     17        traits and weight if the substitute font does not already have them, and only use the returned
     18        member if it actually contains the desired character.
     19
    1202011-09-01  Kentaro Hara  <haraken@google.com>
    221
  • trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm

    r93140 r94352  
    102102const SimpleFontData* FontCache::getFontDataForCharacters(const Font& font, const UChar* characters, int length)
    103103{
    104     const FontPlatformData& platformData = font.fontDataAt(0)->fontDataForCharacter(characters[0])->platformData();
     104    UChar32 character;
     105    U16_GET(characters, 0, 0, length, character);
     106    const FontPlatformData& platformData = font.fontDataAt(0)->fontDataForCharacter(character)->platformData();
    105107    NSFont *nsFont = platformData.font();
    106108
     
    141143    }
    142144
    143     if (NSFont *bestVariation = [fontManager fontWithFamily:[substituteFont familyName] traits:traits weight:weight size:size])
    144         substituteFont = bestVariation;
    145 
    146     substituteFont = font.fontDescription().usePrinterFont() ? [substituteFont printerFont] : [substituteFont screenFont];
    147 
    148145    NSFontTraitMask substituteFontTraits = [fontManager traitsOfFont:substituteFont];
    149146    NSInteger substituteFontWeight = [fontManager weightOfFont:substituteFont];
     147
     148    if (traits != substituteFontTraits || weight != substituteFontWeight) {
     149        if (NSFont *bestVariation = [fontManager fontWithFamily:[substituteFont familyName] traits:traits weight:weight size:size]) {
     150            if (([fontManager traitsOfFont:bestVariation] != substituteFontTraits || [fontManager weightOfFont:bestVariation] != substituteFontWeight)
     151                && [[bestVariation coveredCharacterSet] longCharacterIsMember:character])
     152                substituteFont = bestVariation;
     153        }
     154    }
     155
     156    substituteFont = font.fontDescription().usePrinterFont() ? [substituteFont printerFont] : [substituteFont screenFont];
     157
     158    substituteFontTraits = [fontManager traitsOfFont:substituteFont];
     159    substituteFontWeight = [fontManager weightOfFont:substituteFont];
    150160
    151161    FontPlatformData alternateFont(substituteFont, platformData.size(),
Note: See TracChangeset for help on using the changeset viewer.