Reviewed by Tony Chang.
[chromium] complex joining characters positioned in wrong place
https://bugs.webkit.org/show_bug.cgi?id=53637
Add a test that includes some characters that exhibited the problem.
Unfortunately it's purely a rendering issue, so it is a pixel test.
* platform/chromium-linux/fast/text/international/complex-joining-using-gpos-expected.checksum: Added.
* platform/chromium-linux/fast/text/international/complex-joining-using-gpos-expected.png: Added.
* platform/chromium-linux/fast/text/international/complex-joining-using-gpos-expected.txt: Added.
* platform/chromium-linux/fast/text/international/complex-joining-using-gpos.html: Added.
2011-02-02 Evan Martin <evan@chromium.org>
Reviewed by Tony Chang.
[chromium] complex joining characters positioned in wrong place
https://bugs.webkit.org/show_bug.cgi?id=53637
Provide the correct font metrics to Harfbuzz related to the font design space.
There are used in some fonts for GPOS positioning.
Test: platform/chromium-linux/fast/text/international/complex-joining-using-gpos.html
* platform/graphics/chromium/ComplexTextControllerLinux.cpp:
(WebCore::ComplexTextController::setupFontForScriptRun):
(WebCore::ComplexTextController::allocHarfbuzzFont):
* platform/graphics/chromium/FontPlatformDataLinux.cpp:
(WebCore::FontPlatformData::FontPlatformData):
(WebCore::FontPlatformData::emSizeInFontUnits):
(WebCore::FontPlatformData::operator=):
* platform/graphics/chromium/FontPlatformDataLinux.h:
(WebCore::FontPlatformData::FontPlatformData):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@77504
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2011-02-02 Evan Martin <evan@chromium.org>
+
+ Reviewed by Tony Chang.
+
+ [chromium] complex joining characters positioned in wrong place
+ https://bugs.webkit.org/show_bug.cgi?id=53637
+
+ Add a test that includes some characters that exhibited the problem.
+ Unfortunately it's purely a rendering issue, so it is a pixel test.
+
+ * platform/chromium-linux/fast/text/international/complex-joining-using-gpos-expected.checksum: Added.
+ * platform/chromium-linux/fast/text/international/complex-joining-using-gpos-expected.png: Added.
+ * platform/chromium-linux/fast/text/international/complex-joining-using-gpos-expected.txt: Added.
+ * platform/chromium-linux/fast/text/international/complex-joining-using-gpos.html: Added.
+
2011-02-03 Ryosuke Niwa <rniwa@webkit.org>
Unreviewed; remove the line I intended to remove.
--- /dev/null
+7c22145ac1cd3b77fee1e3499be82786
\ No newline at end of file
--- /dev/null
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderBlock {P} at (0,0) size 784x20
+ RenderText {#text} at (0,0) size 417x19
+ text run at (0,0) width 417: "This pixel test verifies that we position combining characters properly."
+ RenderBlock {P} at (0,36) size 784x20
+ RenderText {#text} at (0,0) size 668x19
+ text run at (0,0) width 668: "The backslash-looking mark should connect into the the character on the right, not be positioned off to the side."
+ RenderBlock {DIV} at (0,72) size 784x83
+ RenderText {#text} at (0,1) size 249x80
+ text run at (0,1) width 249: "\x{915}+\x{947} = \x{915}\x{947}"
+ RenderBlock {DIV} at (0,155) size 784x35
+ RenderText {#text} at (0,0) size 107x34
+ text run at (0,0) width 107: "\x{915}+\x{947} = \x{915}\x{947}"
+ RenderBlock {P} at (0,206) size 784x20
+ RenderText {#text} at (0,0) size 586x19
+ text run at (0,0) width 586: "The three words should be separated by spaces, and there should be no marks above the spaces."
+ RenderBlock {DIV} at (0,242) size 784x83
+ RenderText {#text} at (0,1) size 779x80
+ text run at (0,1) width 427: "\x{E40}\x{E01}\x{E21}\x{E2A}\x{E4C} \x{E1F}\x{E31}\x{E07}\x{E40}\x{E1E}\x{E25}\x{E07} "
+ text run at (427,1) width 352: "\x{E42}\x{E1B}\x{E23}\x{E42}\x{E21}\x{E17}\x{E40}\x{E27}\x{E47}\x{E1A}"
+ RenderBlock {DIV} at (0,325) size 784x35
+ RenderText {#text} at (0,0) size 335x34
+ text run at (0,0) width 183: "\x{E40}\x{E01}\x{E21}\x{E2A}\x{E4C} \x{E1F}\x{E31}\x{E07}\x{E40}\x{E1E}\x{E25}\x{E07} "
+ text run at (183,0) width 152: "\x{E42}\x{E1B}\x{E23}\x{E42}\x{E21}\x{E17}\x{E40}\x{E27}\x{E47}\x{E1A}"
--- /dev/null
+<meta charset=utf-8>
+
+<style>
+.big { font-size: 70px }
+.med { font-size: 30px }
+</style>
+
+<p>This pixel test verifies that we position combining characters properly.</p>
+
+<p>The backslash-looking mark should connect into the the character on the right, not be positioned off to the side.</p>
+<div class=big>क+े = के</div>
+<div class=med>क+े = के</div>
+
+<p>The three words should be separated by spaces, and there should be no
+marks above the spaces.</p>
+<div class=big>เกมส์ ฟังเพลง โปรโมทเว็บ</div>
+<div class=med>เกมส์ ฟังเพลง โปรโมทเว็บ</div>
+2011-02-02 Evan Martin <evan@chromium.org>
+
+ Reviewed by Tony Chang.
+
+ [chromium] complex joining characters positioned in wrong place
+ https://bugs.webkit.org/show_bug.cgi?id=53637
+
+ Provide the correct font metrics to Harfbuzz related to the font design space.
+ There are used in some fonts for GPOS positioning.
+
+ Test: platform/chromium-linux/fast/text/international/complex-joining-using-gpos.html
+
+ * platform/graphics/chromium/ComplexTextControllerLinux.cpp:
+ (WebCore::ComplexTextController::setupFontForScriptRun):
+ (WebCore::ComplexTextController::allocHarfbuzzFont):
+ * platform/graphics/chromium/FontPlatformDataLinux.cpp:
+ (WebCore::FontPlatformData::FontPlatformData):
+ (WebCore::FontPlatformData::emSizeInFontUnits):
+ (WebCore::FontPlatformData::operator=):
+ * platform/graphics/chromium/FontPlatformDataLinux.h:
+ (WebCore::FontPlatformData::FontPlatformData):
+
2011-02-02 Dimitri Glazkov <dglazkov@chromium.org>
Reviewed by Kent Tamura.
m_item.face = platformData.harfbuzzFace();
void* opaquePlatformData = const_cast<FontPlatformData*>(&platformData);
m_item.font->userData = opaquePlatformData;
+
+ int size = platformData.size();
+ m_item.font->x_ppem = size;
+ m_item.font->y_ppem = size;
+ // x_ and y_scale are the conversion factors from font design space (fEmSize) to 1/64th of device pixels in 16.16 format.
+ const int devicePixelFraction = 64;
+ const int multiplyFor16Dot16 = 1 << 16;
+ int scale = devicePixelFraction * size * multiplyFor16Dot16 / platformData.emSizeInFontUnits();
+ m_item.font->x_scale = scale;
+ m_item.font->y_scale = scale;
}
HB_FontRec* ComplexTextController::allocHarfbuzzFont()
memset(font, 0, sizeof(HB_FontRec));
font->klass = &harfbuzzSkiaClass;
font->userData = 0;
- // The values which harfbuzzSkiaClass returns are already scaled to
- // pixel units, so we just set all these to one to disable further
- // scaling.
- font->x_ppem = 1;
- font->y_ppem = 1;
- font->x_scale = 1;
- font->y_scale = 1;
return font;
}
#include "PlatformBridge.h"
#include "PlatformString.h"
+#include "SkAdvancedTypefaceMetrics.h"
#include "SkPaint.h"
#include "SkTypeface.h"
: m_typeface(src.m_typeface)
, m_family(src.m_family)
, m_textSize(src.m_textSize)
+ , m_emSizeInFontUnits(src.m_emSizeInFontUnits)
, m_fakeBold(src.m_fakeBold)
, m_fakeItalic(src.m_fakeItalic)
, m_orientation(src.m_orientation)
: m_typeface(tf)
, m_family(family)
, m_textSize(textSize)
+ , m_emSizeInFontUnits(0)
, m_fakeBold(fakeBold)
, m_fakeItalic(fakeItalic)
, m_orientation(orientation)
: m_typeface(src.m_typeface)
, m_family(src.m_family)
, m_textSize(textSize)
+ , m_emSizeInFontUnits(src.m_emSizeInFontUnits)
, m_fakeBold(src.m_fakeBold)
, m_fakeItalic(src.m_fakeItalic)
, m_harfbuzzFace(src.m_harfbuzzFace)
SkSafeUnref(m_typeface);
}
+int FontPlatformData::emSizeInFontUnits() const
+{
+ if (m_emSizeInFontUnits)
+ return m_emSizeInFontUnits;
+
+ SkAdvancedTypefaceMetrics* metrics = m_typeface->getAdvancedTypefaceMetrics(false);
+ m_emSizeInFontUnits = metrics->fEmSize;
+ metrics->unref();
+ return m_emSizeInFontUnits;
+}
+
FontPlatformData& FontPlatformData::operator=(const FontPlatformData& src)
{
SkRefCnt_SafeAssign(m_typeface, src.m_typeface);
m_harfbuzzFace = src.m_harfbuzzFace;
m_orientation = src.m_orientation;
m_style = src.m_style;
+ m_emSizeInFontUnits = src.m_emSizeInFontUnits;
return *this;
}
FontPlatformData(WTF::HashTableDeletedValueType)
: m_typeface(hashTableDeletedFontValue())
, m_textSize(0)
+ , m_emSizeInFontUnits(0)
, m_fakeBold(false)
, m_fakeItalic(false)
{ }
FontPlatformData()
: m_typeface(0)
, m_textSize(0)
+ , m_emSizeInFontUnits(0)
, m_fakeBold(false)
, m_fakeItalic(false)
, m_orientation(Horizontal)
FontPlatformData(float textSize, bool fakeBold, bool fakeItalic)
: m_typeface(0)
, m_textSize(textSize)
+ , m_emSizeInFontUnits(0)
, m_fakeBold(fakeBold)
, m_fakeItalic(fakeItalic)
, m_orientation(Horizontal)
unsigned hash() const;
float size() const { return m_textSize; }
+ int emSizeInFontUnits() const;
FontOrientation orientation() const { return m_orientation; }
SkTypeface* m_typeface;
CString m_family;
float m_textSize;
+ mutable int m_emSizeInFontUnits;
bool m_fakeBold;
bool m_fakeItalic;
FontOrientation m_orientation;