Changeset 131005 in webkit


Ignore:
Timestamp:
Oct 10, 2012 8:20:37 PM (12 years ago)
Author:
mitz@apple.com
Message:

<rdar://problem/12472460> text-combine doesn’t use third- and quarter-width variants when used with @font-face
https://bugs.webkit.org/show_bug.cgi?id=98961

Reviewed by Tim Horton.

Source/WebCore:

Test: fast/text/text-combine-with-font-face.html

  • css/CSSSegmentedFontFace.cpp:

(WebCore::CSSSegmentedFontFace::getFontData): Added the width variant to the
key used for entries in the font data table, so that we can return different
font data for different width variants.

  • platform/graphics/FontWidthVariant.h: Defined FontWidthVariantWidth for

use in the computation of the above key.

  • rendering/RenderCombineText.cpp:

(WebCore::RenderCombineText::combineText): Added a local variable to store
the font selector before changing the font description. Previously, by the time
we tried to get the font selector from the font, it had already been cleared,
so we called Font::update() with a 0 font selector, meaning @font-face fonts
could not be selected.

LayoutTests:

  • fast/text/text-combine-with-font-face-expected.html: Added.
  • fast/text/text-combine-with-font-face.html: Added.
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r131004 r131005  
     12012-10-10  Dan Bernstein  <mitz@apple.com>
     2
     3        <rdar://problem/12472460> text-combine doesn’t use third- and quarter-width variants when used with @font-face
     4        https://bugs.webkit.org/show_bug.cgi?id=98961
     5
     6        Reviewed by Tim Horton.
     7
     8        * fast/text/text-combine-with-font-face-expected.html: Added.
     9        * fast/text/text-combine-with-font-face.html: Added.
     10
    1112012-10-10  Elliott Sprehn  <esprehn@chromium.org>
    212
  • trunk/Source/WebCore/ChangeLog

    r131004 r131005  
     12012-10-10  Dan Bernstein  <mitz@apple.com>
     2
     3        <rdar://problem/12472460> text-combine doesn’t use third- and quarter-width variants when used with @font-face
     4        https://bugs.webkit.org/show_bug.cgi?id=98961
     5
     6        Reviewed by Tim Horton.
     7
     8        Test: fast/text/text-combine-with-font-face.html
     9
     10        * css/CSSSegmentedFontFace.cpp:
     11        (WebCore::CSSSegmentedFontFace::getFontData): Added the width variant to the
     12        key used for entries in the font data table, so that we can return different
     13        font data for different width variants.
     14        * platform/graphics/FontWidthVariant.h: Defined FontWidthVariantWidth for
     15        use in the computation of the above key.
     16        * rendering/RenderCombineText.cpp:
     17        (WebCore::RenderCombineText::combineText): Added a local variable to store
     18        the font selector before changing the font description. Previously, by the time
     19        we tried to get the font selector from the font, it had already been cleared,
     20        so we called Font::update() with a 0 font selector, meaning @font-face fonts
     21        could not be selected.
     22
    1232012-10-10  Elliott Sprehn  <esprehn@chromium.org>
    224
  • trunk/Source/WebCore/css/CSSSegmentedFontFace.cpp

    r130612 r131005  
    106106
    107107    FontTraitsMask desiredTraitsMask = fontDescription.traitsMask();
    108     unsigned hashKey = ((fontDescription.computedPixelSize() + 1) << (FontTraitsMaskWidth + 1)) | ((fontDescription.orientation() == Vertical ? 1 : 0) << FontTraitsMaskWidth) | desiredTraitsMask;
     108    unsigned hashKey = ((fontDescription.computedPixelSize() + 1) << (FontTraitsMaskWidth + FontWidthVariantWidth + 1))
     109        | ((fontDescription.orientation() == Vertical ? 1 : 0) << (FontTraitsMaskWidth + FontWidthVariantWidth))
     110        | fontDescription.widthVariant() << FontTraitsMaskWidth
     111        | desiredTraitsMask;
    109112
    110113    RefPtr<SegmentedFontData>& fontData = m_fontDataTable.add(hashKey, 0).iterator->value;
  • trunk/Source/WebCore/platform/graphics/FontWidthVariant.h

    r95901 r131005  
    2929namespace WebCore {
    3030
    31 enum FontWidthVariant { RegularWidth, HalfWidth, ThirdWidth, QuarterWidth };
     31enum FontWidthVariant {
     32    RegularWidth,
     33    HalfWidth,
     34    ThirdWidth,
     35    QuarterWidth,
     36    LastFontWidthVariant = QuarterWidth
     37};
     38
     39const unsigned FontWidthVariantWidth = 2;
     40
     41COMPILE_ASSERT(LastFontWidthVariant >> FontWidthVariantWidth == 0, FontWidthVariantWidth_is_correct);
    3242
    3343} // namespace WebCore
  • trunk/Source/WebCore/rendering/RenderCombineText.cpp

    r126359 r131005  
    104104    m_isCombined = m_combinedTextWidth <= emWidth;
    105105
     106    FontSelector* fontSelector = style()->font().fontSelector();
     107
    106108    if (m_isCombined)
    107109        shouldUpdateFont = style()->setFontDescription(description); // Need to change font orientation to horizontal.
     
    112114            description.setWidthVariant(widthVariants[i]);
    113115            Font compressedFont = Font(description, style()->font().letterSpacing(), style()->font().wordSpacing());
    114             compressedFont.update(style()->font().fontSelector());
     116            compressedFont.update(fontSelector);
    115117            float runWidth = compressedFont.width(run);
    116118            if (runWidth <= emWidth) {
     
    129131
    130132    if (shouldUpdateFont)
    131         style()->font().update(style()->font().fontSelector());
     133        style()->font().update(fontSelector);
    132134
    133135    if (m_isCombined) {
Note: See TracChangeset for help on using the changeset viewer.