Skip to content

Commit

Permalink
2010-06-29 Adam Langley <agl@chromium.org>
Browse files Browse the repository at this point in the history
        Reviewed by Kent Tamura.

        [chromium] Support forced autohinting.

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

        Freetype (the typical font rendering on Linux) includes an 'autohinter':
        an algorithm for hinting glyph shapes without using the embedded hinting
        bytecode in a font.

        Some people prefer the autohinter's results, so we support forcing its
        use.

        This change also fixes a bug where two FontPlatformData structures would
        compare equal, even if their rendering styles were different.

        * platform/graphics/chromium/FontPlatformDataLinux.cpp:
        (WebCore::FontPlatformData::setupPaint):
          In order to compare FontPlatformData structures we need to make sure
          that they are initialised.
        (WebCore::FontPlatformData::operator==):
        * platform/graphics/chromium/FontRenderStyle.h:
        (WebCore::FontRenderStyle::FontRenderStyle):
        (WebCore::FontRenderStyle::operator==):
          This fixes the case where two FontPlatformData structures, differing
          only by rendering style, would compare equal.

Canonical link: https://commits.webkit.org/53079@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@62121 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Adam Langley committed Jun 29, 2010
1 parent 7395e29 commit 4300873
Show file tree
Hide file tree
Showing 8 changed files with 138 additions and 5 deletions.
21 changes: 21 additions & 0 deletions LayoutTests/ChangeLog
@@ -1,3 +1,24 @@
2010-06-29 Adam Langley <agl@chromium.org>

Reviewed by Kent Tamura.

[chromium] Support forced autohinting.

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

Freetype (the typical font rendering on Linux) includes an 'autohinter':
an algorithm for hinting glyph shapes without using the embedded hinting
bytecode in a font.

This amends the existing tests for fontconfig settings to test that
setting autohinting works, and that it works in the face of also
setting 'hintfull'.

* platform/chromium-linux/platform/chromium/fast/text/chromium-linux-fontconfig-renderstyle-expected.checksum:
* platform/chromium-linux/platform/chromium/fast/text/chromium-linux-fontconfig-renderstyle-expected.png:
* platform/chromium-linux/platform/chromium/fast/text/chromium-linux-fontconfig-renderstyle-expected.txt:
* platform/chromium/fast/text/chromium-linux-fontconfig-renderstyle.html:

2010-06-29 Mikhail Naganov <mnaganov@chromium.org>

Unreviewed test expectations update for stable passing tests.
Expand Down
@@ -1 +1 @@
0724a0d048b168716737edd97826266f
5a3c29af0d1c8b8ddc95b91673e2e007
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Expand Up @@ -18,15 +18,15 @@ layer at (0,0) size 800x600
text run at (412,0) width 306: " mode, as that forces some rendering settings used "
text run at (718,0) width 32: "in the"
text run at (0,20) width 89: "following tests."
RenderBlock {OL} at (0,56) size 784x235
RenderBlock {OL} at (0,56) size 784x399
RenderListItem {LI} at (40,0) size 744x55
RenderBlock {P} at (0,0) size 744x20
RenderListMarker at (-21,0) size 16x19: "1"
RenderText {#text} at (0,0) size 318x19
text run at (0,0) width 318: "The following text should render without anti-aliasing:"
RenderBlock {P} at (0,36) size 744x19
RenderText {#text} at (0,0) size 154x18
text run at (0,0) width 154: "Non anti-aliased sans."
RenderText {#text} at (0,0) size 158x18
text run at (0,0) width 158: "Non anti-aliased sans."
RenderListItem {LI} at (40,71) size 744x74
RenderBlock {P} at (0,0) size 744x40
RenderListMarker at (-21,0) size 16x19: "2"
Expand All @@ -50,3 +50,53 @@ layer at (0,0) size 800x600
RenderText {#text} at (0,0) size 632x18
text run at (0,0) width 444: "Here is Tigger doing what tiggers do best \x{2026} operating "
text run at (444,0) width 188: "hydraulic exoskeletons."
RenderListItem {LI} at (40,251) size 744x56
RenderBlock {P} at (0,0) size 744x20
RenderListMarker at (-21,0) size 16x19: "4"
RenderText {#text} at (0,0) size 595x19
text run at (0,0) width 374: "The following text should show a difference caused by forcing "
text run at (374,0) width 221: "autohinting. Note: the effect is subtle."
RenderBlock {P} at (0,36) size 744x20
RenderInline {SPAN} at (0,0) size 48x13
RenderText {#text} at (0,5) size 48x13
text run at (0,5) width 48: "autohinted"
RenderText {#text} at (48,0) size 4x19
text run at (48,0) width 4: " "
RenderInline {I} at (0,0) size 14x19
RenderText {#text} at (52,0) size 14x19
text run at (52,0) width 14: "vs"
RenderText {#text} at (66,0) size 4x19
text run at (66,0) width 4: " "
RenderInline {SPAN} at (0,0) size 69x13
RenderText {#text} at (70,5) size 69x13
text run at (70,5) width 69: "not-autohinted"
RenderListItem {LI} at (40,323) size 744x76
RenderBlock {P} at (0,0) size 744x40
RenderListMarker at (-21,0) size 16x19: "5"
RenderText {#text} at (0,0) size 512x19
text run at (0,0) width 512: "The following text should be the same. It verifies that, given the contradictory settings "
RenderInline {TT} at (0,0) size 64x16
RenderText {#text} at (512,3) size 64x16
text run at (512,3) width 64: "hintfull"
RenderText {#text} at (576,0) size 30x19
text run at (576,0) width 30: " and "
RenderInline {TT} at (0,0) size 64x16
RenderText {#text} at (606,3) size 64x16
text run at (606,3) width 64: "autohint"
RenderText {#text} at (670,0) size 730x39
text run at (670,0) width 60: ", the latter"
text run at (0,20) width 53: "wins out:"
RenderBlock {P} at (0,56) size 744x20
RenderInline {SPAN} at (0,0) size 48x13
RenderText {#text} at (0,5) size 48x13
text run at (0,5) width 48: "autohinted"
RenderText {#text} at (48,0) size 4x19
text run at (48,0) width 4: " "
RenderInline {I} at (0,0) size 14x19
RenderText {#text} at (52,0) size 14x19
text run at (52,0) width 14: "vs"
RenderText {#text} at (66,0) size 4x19
text run at (66,0) width 4: " "
RenderInline {SPAN} at (0,0) size 92x13
RenderText {#text} at (70,5) size 92x13
text run at (70,5) width 92: "hopefully autohinted"
Expand Up @@ -29,6 +29,19 @@
hydraulic exoskeletons.
</p>
</li>

<li>
<p>The following text should show a difference caused by forcing
autohinting. Note: the effect is subtle.</p>

<p><span style="font-family:AutohintedSerif; font-size:0.6em;">autohinted</span> <i>vs</i> <span style="font-family:HintedSerif; font-size:0.6em;">not-autohinted</span></p>
</li>

<li>
<p>The following text should be the same. It verifies that, given the contradictory settings <tt>hintfull</tt> and <tt>autohint</tt>, the latter wins out:</p>

<p><span style="font-family:AutohintedSerif; font-size:0.6em;">autohinted</span> <i>vs</i> <span style="font-family:FullAndAutoHintedSerif; font-size:0.6em;">hopefully autohinted</span></p>
</li>
</ol>
</body>
</html>
29 changes: 29 additions & 0 deletions WebCore/ChangeLog
@@ -1,3 +1,32 @@
2010-06-29 Adam Langley <agl@chromium.org>

Reviewed by Kent Tamura.

[chromium] Support forced autohinting.

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

Freetype (the typical font rendering on Linux) includes an 'autohinter':
an algorithm for hinting glyph shapes without using the embedded hinting
bytecode in a font.

Some people prefer the autohinter's results, so we support forcing its
use.

This change also fixes a bug where two FontPlatformData structures would
compare equal, even if their rendering styles were different.

* platform/graphics/chromium/FontPlatformDataLinux.cpp:
(WebCore::FontPlatformData::setupPaint):
In order to compare FontPlatformData structures we need to make sure
that they are initialised.
(WebCore::FontPlatformData::operator==):
* platform/graphics/chromium/FontRenderStyle.h:
(WebCore::FontRenderStyle::FontRenderStyle):
(WebCore::FontRenderStyle::operator==):
This fixes the case where two FontPlatformData structures, differing
only by rendering style, would compare equal.

2010-06-29 Laszlo Gombos <laszlo.1.gombos@nokia.com>

Unreviewed, Symbian build fix.
Expand Down
4 changes: 3 additions & 1 deletion WebCore/platform/graphics/chromium/FontPlatformDataLinux.cpp
Expand Up @@ -148,6 +148,7 @@ void FontPlatformData::setupPaint(SkPaint* paint) const
paint->setTypeface(m_typeface);
paint->setFakeBoldText(m_fakeBold);
paint->setTextSkewX(m_fakeItalic ? -SK_Scalar1 / 4 : 0);
paint->setAutohinting(m_style.useAutoHint);

if (m_style.useAntiAlias == 1 || (m_style.useAntiAlias == FontRenderStyle::NoPreference && isSkiaAntiAlias))
paint->setLCDRenderText(m_style.useSubpixel == FontRenderStyle::NoPreference ? isSkiaSubpixelGlyphs : m_style.useSubpixel);
Expand Down Expand Up @@ -175,7 +176,8 @@ bool FontPlatformData::operator==(const FontPlatformData& a) const
return typefacesEqual
&& m_textSize == a.m_textSize
&& m_fakeBold == a.m_fakeBold
&& m_fakeItalic == a.m_fakeItalic;
&& m_fakeItalic == a.m_fakeItalic
&& m_style == a.m_style;
}

unsigned FontPlatformData::hash() const
Expand Down
18 changes: 18 additions & 0 deletions WebCore/platform/graphics/chromium/FontRenderStyle.h
Expand Up @@ -39,6 +39,24 @@ struct FontRenderStyle {
NoPreference = 2,
};

FontRenderStyle()
: useBitmaps(0),
useAutoHint(0),
useHinting(0),
hintStyle(0),
useAntiAlias(0),
useSubpixel(0) { }

bool operator==(const FontRenderStyle& a) const
{
return useBitmaps == a.useBitmaps
&& useAutoHint == a.useAutoHint
&& useHinting == a.useHinting
&& hintStyle == a.hintStyle
&& useAntiAlias == a.useAntiAlias
&& useSubpixel == a.useSubpixel;
}

// Each of the use* members below can take one of three values:
// 0: off
// 1: on
Expand Down

0 comments on commit 4300873

Please sign in to comment.