Changeset 63556 in webkit


Ignore:
Timestamp:
Jul 16, 2010 9:08:38 AM (14 years ago)
Author:
mitz@apple.com
Message:

<rdar://problem/8198266> white-space: pre text containing tabs is not laid out correctly when the font lacks a space glyph
https://bugs.webkit.org/show_bug.cgi?id=42437

Reviewed by Anders Carlsson.

No test because none of the fonts available to DumpRenderTree are missing a space glyph.

Changed the tab width computation to use the width of the space glyph from the font that has
a space glyph, which may be a fallback font if the primary font lacks a space glyph.

  • platform/graphics/Font.h: Removed Font::tabWidth().
  • platform/graphics/WidthIterator.cpp:

(WebCore::WidthIterator::advance):

  • platform/graphics/mac/ComplexTextController.cpp:

(WebCore::ComplexTextController::adjustGlyphsAndAdvances):

Location:
trunk/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r63554 r63556  
     12010-07-16  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Anders Carlsson.
     4
     5        <rdar://problem/8198266> white-space: pre text containing tabs is not laid out correctly when the font lacks a space glyph
     6        https://bugs.webkit.org/show_bug.cgi?id=42437
     7
     8        No test because none of the fonts available to DumpRenderTree are missing a space glyph.
     9
     10        Changed the tab width computation to use the width of the space glyph from the font that has
     11        a space glyph, which may be a fallback font if the primary font lacks a space glyph.
     12
     13        * platform/graphics/Font.h: Removed Font::tabWidth().
     14        * platform/graphics/WidthIterator.cpp:
     15        (WebCore::WidthIterator::advance):
     16        * platform/graphics/mac/ComplexTextController.cpp:
     17        (WebCore::ComplexTextController::adjustGlyphsAndAdvances):
     18
    1192010-07-16  Yury Semikhatsky  <yurys@chromium.org>
    220
  • trunk/WebCore/platform/graphics/Font.h

    r61253 r63556  
    136136    unsigned unitsPerEm() const { return primaryFont()->unitsPerEm(); }
    137137    int spaceWidth() const { return (int)ceilf(primaryFont()->adjustedSpaceWidth() + m_letterSpacing); }
    138     int tabWidth() const { return 8 * spaceWidth(); }
    139138
    140139    const SimpleFontData* primaryFont() const;
  • trunk/WebCore/platform/graphics/WidthIterator.cpp

    r63357 r63556  
    134134        float width;
    135135        if (c == '\t' && m_run.allowTabs()) {
    136             float tabWidth = m_font->tabWidth();
     136            float tabWidth = 8 * ceilf(fontData->adjustedSpaceWidth() + m_font->letterSpacing());
    137137            width = tabWidth - fmodf(m_run.xPos() + m_runWidthSoFar + widthSinceLastRounding, tabWidth);
    138138        } else {
  • trunk/WebCore/platform/graphics/mac/ComplexTextController.cpp

    r63357 r63556  
    475475
    476476            if (ch == '\t' && m_run.allowTabs()) {
    477                 float tabWidth = m_font.tabWidth();
     477                float tabWidth = 8 * ceilf(fontData->adjustedSpaceWidth() + m_font.letterSpacing());
    478478                advance.width = tabWidth - fmodf(m_run.xPos() + m_totalWidth + widthSinceLastRounding, tabWidth);
    479479            } else if (ch == zeroWidthSpace || Font::treatAsZeroWidthSpace(ch) && !treatAsSpace) {
Note: See TracChangeset for help on using the changeset viewer.