+2017-08-16 Fujii Hironori <Hironori.Fujii@sony.com>
+
+ [HarfBuzz] Decomposed Vietnamese characters are rendered incorrectly
+ https://bugs.webkit.org/show_bug.cgi?id=174418
+
+ Reviewed by Michael Catanzaro.
+
+ * fast/text/international/vietnamese-nfd-expected.html: Added.
+ * fast/text/international/vietnamese-nfd.html: Added.
+
2017-08-16 Chris Dumez <cdumez@apple.com>
Unreviewed, rebaseline a few tests after r220779.
+2017-08-16 Fujii Hironori <Hironori.Fujii@sony.com>
+
+ [HarfBuzz] Decomposed Vietnamese characters are rendered incorrectly
+ https://bugs.webkit.org/show_bug.cgi?id=174418
+
+ Reviewed by Michael Catanzaro.
+
+ HarfBuzzShaper should normalize the input text before collecting
+ HarfBuzzRuns. Actually, HarfBuzzShaper::setNormalizedBuffer does
+ the task. But, this function hasn't been called from anywhere
+ since Bug 90951.
+
+ Test: fast/text/international/vietnamese-nfd.html
+ imported/blink/fast/text/international/text-shaping-arabic-diffs.html
+
+ * platform/graphics/harfbuzz/HarfBuzzShaper.cpp:
+ (WebCore::HarfBuzzShaper::HarfBuzzShaper):
+ Call setNormalizedBuffer instead of normalizeCharacters.
+ (WebCore::normalizeCharacters): Deleted.
+ (WebCore::normalizeSpacesAndMirrorChars) Use
+ FontCascade::treatAsZeroWidthSpaceInComplexScript instead of
+ FontCascade::treatAsZeroWidthSpace to preserve ZWJ and ZWNJ.
+
2017-08-16 Antti Koivisto <antti@apple.com>
Move first-letter renderer mutation code out of RenderBlock and into RenderTreeUpdater
return position;
}
-static void normalizeCharacters(const TextRun& run, UChar* destination, unsigned length)
-{
- unsigned position = 0;
- bool error = false;
- const UChar* source;
- String stringFor8BitRun;
- if (run.is8Bit()) {
- stringFor8BitRun = String::make16BitFrom8BitSource(run.characters8(), run.length());
- source = stringFor8BitRun.characters16();
- } else
- source = run.characters16();
-
- while (position < length) {
- UChar32 character;
- unsigned nextPosition = position;
- U16_NEXT(source, nextPosition, length, character);
- // Don't normalize tabs as they are not treated as spaces for word-end.
- if (FontCascade::treatAsSpace(character) && character != '\t')
- character = ' ';
- else if (FontCascade::treatAsZeroWidthSpaceInComplexScript(character))
- character = zeroWidthSpace;
- U16_APPEND(destination, position, length, character, error);
- ASSERT_UNUSED(error, !error);
- position = nextPosition;
- }
-}
-
HarfBuzzShaper::HarfBuzzShaper(const FontCascade* font, const TextRun& run)
: m_font(font)
, m_normalizedBufferLength(0)
, m_padError(0)
, m_letterSpacing(font->letterSpacing())
{
- m_normalizedBuffer = std::make_unique<UChar[]>(m_run.length() + 1);
- m_normalizedBufferLength = m_run.length();
- normalizeCharacters(m_run, m_normalizedBuffer.get(), m_normalizedBufferLength);
+ setNormalizedBuffer();
setPadding(m_run.expansion());
setFontFeatures();
}
// Don't normalize tabs as they are not treated as spaces for word-end
if (FontCascade::treatAsSpace(character) && character != '\t')
character = ' ';
- else if (FontCascade::treatAsZeroWidthSpace(character))
+ else if (FontCascade::treatAsZeroWidthSpaceInComplexScript(character))
character = zeroWidthSpace;
else if (normalizeMode == HarfBuzzShaper::NormalizeMirrorChars)
character = u_charMirror(character);