Changeset 54020 in webkit


Ignore:
Timestamp:
Jan 28, 2010 2:17:23 PM (14 years ago)
Author:
evan@chromium.org
Message:

2010-01-27 Evan Martin <evan@chromium.org>

Reviewed by David Levin.

[chromium] hebrew vowel marks incorrectly positioned
https://bugs.webkit.org/show_bug.cgi?id=34234

Add a layout test containing some Hebrew vowels.

  • fast/text/international/hebrew-vowels.html: Added.

2010-01-27 Evan Martin <evan@chromium.org>

Reviewed by David Levin.

[chromium] hebrew vowel marks incorrectly positioned
https://bugs.webkit.org/show_bug.cgi?id=34234

Fix glyph metrics computation such that the glyph offsets
are correct, so we can now make use of them.

Test: fast/text/international/hebrew-vowels.html

  • platform/graphics/chromium/FontLinux.cpp: (WebCore::TextRunWalker::createGlyphArrays): initialize per-glyph offset table. (WebCore::TextRunWalker::setGlyphXPositions): use per-glyph offsets.
  • platform/graphics/chromium/HarfbuzzSkia.cpp: (WebCore::getGlyphMetrics): fix metrics computation such that per-glyph offsets are computed correctly.
Location:
trunk
Files:
4 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r54013 r54020  
     12010-01-27  Evan Martin  <evan@chromium.org>
     2
     3        Reviewed by David Levin.
     4
     5        [chromium] hebrew vowel marks incorrectly positioned
     6        https://bugs.webkit.org/show_bug.cgi?id=34234
     7
     8        Add a layout test containing some Hebrew vowels.
     9
     10        * fast/text/international/hebrew-vowels.html: Added.
     11
    1122010-01-28  Dimitri Glazkov  <dglazkov@chromium.org>
    213
  • trunk/WebCore/ChangeLog

    r54019 r54020  
     12010-01-27  Evan Martin  <evan@chromium.org>
     2
     3        Reviewed by David Levin.
     4
     5        [chromium] hebrew vowel marks incorrectly positioned
     6        https://bugs.webkit.org/show_bug.cgi?id=34234
     7
     8        Fix glyph metrics computation such that the glyph offsets
     9        are correct, so we can now make use of them.
     10
     11        Test: fast/text/international/hebrew-vowels.html
     12
     13        * platform/graphics/chromium/FontLinux.cpp:
     14        (WebCore::TextRunWalker::createGlyphArrays): initialize per-glyph
     15        offset table.
     16        (WebCore::TextRunWalker::setGlyphXPositions): use per-glyph
     17        offsets.
     18        * platform/graphics/chromium/HarfbuzzSkia.cpp:
     19        (WebCore::getGlyphMetrics): fix metrics computation such that
     20        per-glyph offsets are computed correctly.
     21
    1222010-01-28  Laszlo Gombos  <laszlo.1.gombos@nokia.com>
    223
  • trunk/WebCore/platform/graphics/chromium/FontLinux.cpp

    r53958 r54020  
    401401        m_item.advances = new HB_Fixed[m_maxGlyphs];
    402402        m_item.offsets = new HB_FixedPoint[m_maxGlyphs];
     403        // HB_FixedPoint is a struct, so we must use memset to clear it.
     404        memset(m_item.offsets, 0, m_maxGlyphs * sizeof(HB_FixedPoint));
    403405        m_glyphs16 = new uint16_t[m_maxGlyphs];
    404406        m_xPositions = new SkScalar[m_maxGlyphs];
     
    437439    void setGlyphXPositions(bool isRTL)
    438440    {
    439         m_pixelWidth = 0;
    440         for (unsigned i = 0; i < m_item.num_glyphs; ++i) {
    441             int index;
    442             if (isRTL)
    443                 index = m_item.num_glyphs - (i + 1);
    444             else
    445                 index = i;
     441        double position = 0;
     442        for (int iter = 0; iter < m_item.num_glyphs; ++iter) {
     443            // Glyphs are stored in logical order, but for layout purposes we always go left to right.
     444            int i = isRTL ? m_item.num_glyphs - iter - 1 : iter;
    446445
    447446            m_glyphs16[i] = m_item.glyphs[i];
    448             m_xPositions[index] = m_offsetX + m_pixelWidth;
    449             m_pixelWidth += truncateFixedPointToInteger(m_item.advances[index]);
    450         }
     447            double offsetX = truncateFixedPointToInteger(m_item.offsets[i].x);
     448            m_xPositions[i] = m_offsetX + position + offsetX;
     449
     450            double advance = truncateFixedPointToInteger(m_item.advances[i]);
     451            position += advance;
     452        }
     453        m_pixelWidth = position;
    451454        m_offsetX += m_pixelWidth;
    452455    }
  • trunk/WebCore/platform/graphics/chromium/HarfbuzzSkia.cpp

    r53958 r54020  
    168168    paint.getTextWidths(&glyph16, sizeof(glyph16), &width, &bounds);
    169169
    170     metrics->x = SkiaScalarToHarfbuzzFixed(width);
     170    metrics->x = SkiaScalarToHarfbuzzFixed(bounds.fLeft);
     171    metrics->y = SkiaScalarToHarfbuzzFixed(bounds.fTop);
     172    metrics->width = SkiaScalarToHarfbuzzFixed(bounds.width());
     173    metrics->height = SkiaScalarToHarfbuzzFixed(bounds.height());
     174
     175    metrics->xOffset = SkiaScalarToHarfbuzzFixed(width);
    171176    // We can't actually get the |y| correct because Skia doesn't export
    172177    // the vertical advance. However, nor we do ever render vertical text at
    173178    // the moment so it's unimportant.
    174     metrics->y = 0;
    175     metrics->width = SkiaScalarToHarfbuzzFixed(bounds.width());
    176     metrics->height = SkiaScalarToHarfbuzzFixed(bounds.height());
    177     metrics->xOffset = SkiaScalarToHarfbuzzFixed(bounds.fLeft);
    178     metrics->yOffset = SkiaScalarToHarfbuzzFixed(bounds.fTop);
     179    metrics->yOffset = 0;
    179180}
    180181
Note: See TracChangeset for help on using the changeset viewer.