Ignore:
Timestamp:
May 2, 2018, 1:34:07 PM (7 years ago)
Author:
[email protected]
Message:

Collection fragment identifiers don't use PostScript names
https://bugs.webkit.org/show_bug.cgi?id=184624
Source/WebCore:

<rdar://problem/39432089>

Reviewed by Simon Fraser.

In a previous version of the CSS Fonts spec, there was text saying that items in font collections
should be 1-indexed (so the first item would be MyFonts.ttc#1). However, this is unfortunate because
inserting an item into the middle of a collection would throw off all content that uses the file.
Instead, the spec has since changed to use PostScript names (so the content instead would say
MyFonts.ttc#MyFont-Regular).

Test: fast/text/font-collection.html

  • css/CSSFontFaceSource.cpp:

(WebCore::CSSFontFaceSource::load):

  • loader/cache/CachedFont.cpp:

(WebCore::CachedFont::calculateItemInCollection const):
(WebCore::CachedFont::ensureCustomFontData):
(WebCore::CachedFont::createCustomFontData):
(WebCore::CachedFont::calculateIndex const): Deleted.

  • loader/cache/CachedFont.h:
  • platform/graphics/mac/FontCustomPlatformData.cpp:

(WebCore::createFontCustomPlatformData):

  • platform/graphics/mac/FontCustomPlatformData.h:

LayoutTests:

Reviewed by Simon Fraser.

  • fast/text/font-collection-expected.html:
  • fast/text/font-collection.html:
  • fast/text/resources/collection.ttc: I generated this font collection by hand. The "Ahemerator" font inside it is missing the

"A" glyph.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/css/CSSFontFaceSource.cpp

    r227381 r231259  
    160160                    m_generatedOTFBuffer = SharedBuffer::create(WTFMove(otfFont.value()));
    161161                if (m_generatedOTFBuffer) {
    162                     m_inDocumentCustomPlatformData = createFontCustomPlatformData(*m_generatedOTFBuffer, 0);
     162                    m_inDocumentCustomPlatformData = createFontCustomPlatformData(*m_generatedOTFBuffer, String());
    163163                    success = static_cast<bool>(m_inDocumentCustomPlatformData);
    164164                }
     
    171171            RefPtr<SharedBuffer> buffer = SharedBuffer::create(static_cast<const char*>(m_immediateSource->baseAddress()), m_immediateSource->byteLength());
    172172            ASSERT(buffer);
    173             m_immediateFontCustomPlatformData = CachedFont::createCustomFontData(*buffer, 0, wrapping);
     173            m_immediateFontCustomPlatformData = CachedFont::createCustomFontData(*buffer, String(), wrapping);
    174174            success = static_cast<bool>(m_immediateFontCustomPlatformData);
    175175        } else {
Note: See TracChangeset for help on using the changeset viewer.