Skip to content
Permalink
Browse files
[HarfBuzz][GTK] fast/text/complex-first-glyph-with-initial-advance.ht…
…ml is failing

https://bugs.webkit.org/show_bug.cgi?id=118221

Reviewed by Carlos Garcia Campos.

Source/WebCore:

Arabic diacritics made glyphs vertically unaligned if the first
glyph had a vertical offset.

The initial advance should be same with the first glyph origin for
HarfBuzz. See the diagram in ComplexTextController.h for details.
<https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/platform/graphics/ComplexTextController.h?rev=224007#L109>

drawGlyphs of Cairo port was assuming upward y-axis for glyph
advances even though those of Mac and AppleWin port are assuming
downward y-axis. This is a problem for Windows ports because
AppleWin and WinCairo port are sharing the code calculating
advances.

Covered by existing tests.

* platform/graphics/cairo/FontCairo.cpp:
(WebCore::FontCascade::drawGlyphs):
* platform/graphics/cairo/GraphicsContextImplCairo.cpp:
(WebCore::GraphicsContextImplCairo::drawGlyphs):
Sum up the height of advances into yOffset instead of subtraction.

* platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp:
(WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun):
Don't negate offsetY. Set m_initialAdvance as the first item of
m_glyphOrigins.

LayoutTests:

* platform/gtk/TestExpectations: Unmarked
fast/text/complex-first-glyph-with-initial-advance.html and
fast/text/initial-advance-in-intermediate-run-complex.html.
* platform/wincairo/TestExpectations: Unmarked
fast/text/complex-first-glyph-with-initial-advance.html and
fast/text/complex-initial-advance.html.

Canonical link: https://commits.webkit.org/219049@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254190 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
fujii committed Jan 8, 2020
1 parent 5ef273f commit 963318ec4544298fa07b7d19f7c77c7d6339cee9
Showing 7 changed files with 51 additions and 12 deletions.
@@ -1,3 +1,17 @@
2020-01-08 Fujii Hironori <Hironori.Fujii@sony.com>

[HarfBuzz][GTK] fast/text/complex-first-glyph-with-initial-advance.html is failing
https://bugs.webkit.org/show_bug.cgi?id=118221

Reviewed by Carlos Garcia Campos.

* platform/gtk/TestExpectations: Unmarked
fast/text/complex-first-glyph-with-initial-advance.html and
fast/text/initial-advance-in-intermediate-run-complex.html.
* platform/wincairo/TestExpectations: Unmarked
fast/text/complex-first-glyph-with-initial-advance.html and
fast/text/complex-initial-advance.html.

2020-01-07 Said Abou-Hallawa <sabouhallawa@apple.com>

Implement css3-images image-orientation
@@ -2944,8 +2944,6 @@ webkit.org/b/169007 css3/flexbox/flex-item-contains-strict.html [ Failure ]
webkit.org/b/118220 http/tests/cache/partitioned-cache.html [ Failure ]
webkit.org/b/118220 http/tests/cache/partitioned-cache-iframe.html [ Failure ]

webkit.org/b/118221 fast/text/complex-first-glyph-with-initial-advance.html [ ImageOnlyFailure ]

webkit.org/b/118416 storage/websql/sql-error-codes.html [ Failure ]

webkit.org/b/120105 http/tests/navigation/post-frames-goback1-uncached.html [ Failure ]
@@ -3306,8 +3304,6 @@ webkit.org/b/168551 http/tests/misc/slow-loading-animated-image.html [ ImageOnly

webkit.org/b/168552 fast/text/hyphenate-locale.html [ Failure ]

webkit.org/b/168555 fast/text/initial-advance-in-intermediate-run-complex.html [ ImageOnlyFailure ]

webkit.org/b/168719 fast/css/paint-order-shadow.html [ ImageOnlyFailure ]

webkit.org/b/169075 editing/deleting/skip-virama-001.html [ Failure ]
@@ -1714,9 +1714,7 @@ fast/text/break-word-pre-wrap.html [ ImageOnlyFailure ]
fast/text/chinese-font-name-aliases-2.html [ ImageOnlyFailure ]
fast/text/chinese-font-name-aliases.html [ ImageOnlyFailure ]
fast/text/combining-mark-paint.html [ ImageOnlyFailure ]
fast/text/complex-first-glyph-with-initial-advance.html [ ImageOnlyFailure ]
fast/text/complex-grapheme-cluster-with-initial-advance.html [ ImageOnlyFailure ]
fast/text/complex-initial-advance.html [ ImageOnlyFailure ]
fast/text/complex-small-caps-non-bmp-capitalize.html [ ImageOnlyFailure ]
fast/text/decorations-vertical-underline.html [ ImageOnlyFailure ]
fast/text/ellipsis-text-rtl.html [ ImageOnlyFailure ]
@@ -1,3 +1,36 @@
2020-01-08 Fujii Hironori <Hironori.Fujii@sony.com>

[HarfBuzz][GTK] fast/text/complex-first-glyph-with-initial-advance.html is failing
https://bugs.webkit.org/show_bug.cgi?id=118221

Reviewed by Carlos Garcia Campos.

Arabic diacritics made glyphs vertically unaligned if the first
glyph had a vertical offset.

The initial advance should be same with the first glyph origin for
HarfBuzz. See the diagram in ComplexTextController.h for details.
<https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/platform/graphics/ComplexTextController.h?rev=224007#L109>

drawGlyphs of Cairo port was assuming upward y-axis for glyph
advances even though those of Mac and AppleWin port are assuming
downward y-axis. This is a problem for Windows ports because
AppleWin and WinCairo port are sharing the code calculating
advances.

Covered by existing tests.

* platform/graphics/cairo/FontCairo.cpp:
(WebCore::FontCascade::drawGlyphs):
* platform/graphics/cairo/GraphicsContextImplCairo.cpp:
(WebCore::GraphicsContextImplCairo::drawGlyphs):
Sum up the height of advances into yOffset instead of subtraction.

* platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp:
(WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun):
Don't negate offsetY. Set m_initialAdvance as the first item of
m_glyphOrigins.

2020-01-07 Said Abou-Hallawa <sabouhallawa@apple.com>

Implement css3-images image-orientation
@@ -65,7 +65,7 @@ void FontCascade::drawGlyphs(GraphicsContext& context, const Font& font, const G
for (size_t i = 0; i < numGlyphs; ++i) {
glyphs[i] = { glyphsData[i], xOffset, yOffset };
xOffset += advances[i].width();
yOffset -= advances[i].height();
yOffset += advances[i].height();
}
}

@@ -248,7 +248,7 @@ void GraphicsContextImplCairo::drawGlyphs(const Font& font, const GlyphBuffer& g
for (size_t i = 0; i < numGlyphs; ++i) {
glyphs[i] = { glyphsData[i], xOffset, yOffset };
xOffset += advances[i].width();
yOffset -= advances[i].height();
yOffset += advances[i].height();
}
}

@@ -164,17 +164,15 @@ ComplexTextController::ComplexTextRun::ComplexTextRun(hb_buffer_t* buffer, const
}

float offsetX = harfBuzzPositionToFloat(glyphPositions[i].x_offset);
float offsetY = -harfBuzzPositionToFloat(glyphPositions[i].y_offset);
float offsetY = harfBuzzPositionToFloat(glyphPositions[i].y_offset);
float advanceX = harfBuzzPositionToFloat(glyphPositions[i].x_advance);
float advanceY = harfBuzzPositionToFloat(glyphPositions[i].y_advance);

if (!i)
m_initialAdvance = { offsetX, -offsetY };

m_glyphs[i] = glyph;
m_baseAdvances[i] = { advanceX, advanceY };
m_glyphOrigins[i] = { offsetX, offsetY };
}
m_initialAdvance = toFloatSize(m_glyphOrigins[0]);
}

static const hb_tag_t s_vertTag = HB_TAG('v', 'e', 'r', 't');

0 comments on commit 963318e

Please sign in to comment.