Commit fd2cf34c authored by mitz@apple.com's avatar mitz@apple.com
Browse files

Kerning never occurs between a space and the following glyph

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

Reviewed by Tim Horton.

Source/WebCore: 

Covered by several existing tests.

* platform/graphics/mac/ComplexTextController.cpp:
(WebCore::ComplexTextController::adjustGlyphsAndAdvances): Changed to not reset the advance
of a space, and added a comment about how this also needs to be fixed for other characters
that are treated as spaces.

LayoutTests: 

* platform/mac/fast/text/emphasis-expected.png:
* platform/mac/fast/text/emphasis-expected.txt:
* platform/mac/fast/text/sticky-typesetting-features-expected.png:
* platform/mac/fast/text/sticky-typesetting-features-expected.txt:
* platform/mac/fast/text/thai-combining-mark-positioning-expected.png:
* platform/mac/fast/text/thai-combining-mark-positioning-expected.txt:
* platform/mac/fast/writing-mode/text-orientation-basic-expected.png:
* platform/mac/fast/writing-mode/text-orientation-basic-expected.txt:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129176 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent f5c9cef7
2012-09-20 Dan Bernstein <mitz@apple.com>
Kerning never occurs between a space and the following glyph
https://bugs.webkit.org/show_bug.cgi?id=97269
Reviewed by Tim Horton.
* platform/mac/fast/text/emphasis-expected.png:
* platform/mac/fast/text/emphasis-expected.txt:
* platform/mac/fast/text/sticky-typesetting-features-expected.png:
* platform/mac/fast/text/sticky-typesetting-features-expected.txt:
* platform/mac/fast/text/thai-combining-mark-positioning-expected.png:
* platform/mac/fast/text/thai-combining-mark-positioning-expected.txt:
* platform/mac/fast/writing-mode/text-orientation-basic-expected.png:
* platform/mac/fast/writing-mode/text-orientation-basic-expected.txt:
2012-09-20 Kenichi Ishibashi <bashi@chromium.org>
 
[Chromium] Improve glyph selection of HarfBuzzShaper
......@@ -25,9 +25,9 @@ layer at (0,0) size 800x562
RenderInline {SPAN} at (0,0) size 217x28
RenderText {#text} at (3,45) size 217x28
text run at (3,45) width 217: "consectetur adipiscing"
RenderText {#text} at (220,45) size 135x28
RenderText {#text} at (220,45) size 134x28
text run at (220,45) width 6: " "
text run at (226,45) width 129: "elit. Aliquam"
text run at (226,45) width 128: "elit. Aliquam"
RenderInline {SPAN} at (0,0) size 111x28
RenderText {#text} at (3,73) size 111x28
text run at (3,73) width 111: "odio sa\x{300}pien"
......
......@@ -13,5 +13,5 @@ layer at (0,0) size 800x600
RenderText {#text} at (0,0) size 324x18
text run at (0,0) width 324: "This should be rendered with kerning and ligatures:"
RenderBlock {DIV} at (0,250) size 784x166
RenderText {#text} at (0,0) size 754x166
text run at (0,0) width 754: "Office Today"
RenderText {#text} at (0,0) size 751x166
text run at (0,0) width 751: "Office Today"
......@@ -4,5 +4,5 @@ layer at (0,0) size 800x600
RenderBlock {HTML} at (0,0) size 800x600
RenderBody {BODY} at (8,8) size 784x584
RenderBlock {DIV} at (0,0) size 784x101
RenderText {#text} at (0,0) size 384x101
text run at (0,0) width 384: "\x{E43}\x{E2B}\x{E49}\x{E21}\x{E35}\x{E02}\x{E36}\x{E49}\x{E19} \x{E01}\x{E32}\x{E23}\x{E17}\x{E4D}\x{E32}\x{E43}\x{E2B}\x{E49}"
RenderText {#text} at (0,0) size 385x101
text run at (0,0) width 385: "\x{E43}\x{E2B}\x{E49}\x{E21}\x{E35}\x{E02}\x{E36}\x{E49}\x{E19} \x{E01}\x{E32}\x{E23}\x{E17}\x{E4D}\x{E32}\x{E43}\x{E2B}\x{E49}"
......@@ -49,8 +49,8 @@ layer at (0,0) size 785x704
RenderText {#text} at (94,1) size 36x197
text run at (94,1) width 197: "Hello world"
RenderBR {BR} at (112,198) size 0x0
RenderInline {SPAN} at (0,0) size 36x221
RenderText {#text} at (148,1) size 36x221
text run at (148,1) width 221: "Hello world"
RenderBR {BR} at (166,222) size 0x0
RenderInline {SPAN} at (0,0) size 36x197
RenderText {#text} at (148,1) size 36x197
text run at (148,1) width 197: "Hello world"
RenderBR {BR} at (166,198) size 0x0
RenderText {#text} at (0,0) size 0x0
2012-09-20 Dan Bernstein <mitz@apple.com>
Kerning never occurs between a space and the following glyph
https://bugs.webkit.org/show_bug.cgi?id=97269
Reviewed by Tim Horton.
Covered by several existing tests.
* platform/graphics/mac/ComplexTextController.cpp:
(WebCore::ComplexTextController::adjustGlyphsAndAdvances): Changed to not reset the advance
of a space, and added a comment about how this also needs to be fixed for other characters
that are treated as spaces.
2012-09-20 Kenichi Ishibashi <bashi@chromium.org>
 
[Chromium] Improve glyph selection of HarfBuzzShaper
......@@ -580,8 +580,14 @@ void ComplexTextController::adjustGlyphsAndAdvances()
nextCh = *(m_complexTextRuns[r + 1]->characters() + m_complexTextRuns[r + 1]->indexAt(0));
bool treatAsSpace = Font::treatAsSpace(ch);
CGGlyph glyph = treatAsSpace ? fontData->spaceGlyph() : glyphs[i];
CGSize advance = treatAsSpace ? CGSizeMake(spaceWidth, advances[i].height) : advances[i];
CGGlyph glyph = glyphs[i];
CGSize advance = advances[i];
// FIXME: We should find a way to substitute spaces for characters that are treated as spaces
// before handing them off to Core Text, so that kerning can be applied as if they were spaces.
if (treatAsSpace && ch != ' ') {
glyph = fontData->spaceGlyph();
advance.width = spaceWidth;
}
if (ch == '\t' && m_run.allowTabs())
advance.width = m_font.tabWidth(*fontData, m_run.tabSize(), m_run.xPos() + m_totalWidth + widthSinceLastCommit);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment