Title: [241946] releases/WebKitGTK/webkit-2.22/Source/WebCore
Revision
241946
Author
[email protected]
Date
2019-02-22 06:28:41 -0800 (Fri, 22 Feb 2019)

Log Message

Merged r241402 - [FreeType] Unable to render some Hebrew characters
https://bugs.webkit.org/show_bug.cgi?id=194498

Reviewed by Michael Catanzaro.

We are failing to find a font for some of the combining character sequences because normalization is failing due
to overflow error. In case of overflow, normalize returns the required length for the normalized characters, so
we should handle that case to resize the output buffer and try again.

* platform/graphics/cairo/FontCairoHarfbuzzNG.cpp:
(WebCore::FontCascade::fontForCombiningCharacterSequence const):

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.22/Source/WebCore/ChangeLog (241945 => 241946)


--- releases/WebKitGTK/webkit-2.22/Source/WebCore/ChangeLog	2019-02-22 13:52:18 UTC (rev 241945)
+++ releases/WebKitGTK/webkit-2.22/Source/WebCore/ChangeLog	2019-02-22 14:28:41 UTC (rev 241946)
@@ -1,3 +1,17 @@
+2019-02-13  Carlos Garcia Campos  <[email protected]>
+
+        [FreeType] Unable to render some Hebrew characters
+        https://bugs.webkit.org/show_bug.cgi?id=194498
+
+        Reviewed by Michael Catanzaro.
+
+        We are failing to find a font for some of the combining character sequences because normalization is failing due
+        to overflow error. In case of overflow, normalize returns the required length for the normalized characters, so
+        we should handle that case to resize the output buffer and try again.
+
+        * platform/graphics/cairo/FontCairoHarfbuzzNG.cpp:
+        (WebCore::FontCascade::fontForCombiningCharacterSequence const):
+
 2019-02-01  Claudio Saavedra  <[email protected]>
 
         Race-condition during scrolling thread creation

Modified: releases/WebKitGTK/webkit-2.22/Source/WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp (241945 => 241946)


--- releases/WebKitGTK/webkit-2.22/Source/WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp	2019-02-22 13:52:18 UTC (rev 241945)
+++ releases/WebKitGTK/webkit-2.22/Source/WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp	2019-02-22 14:28:41 UTC (rev 241946)
@@ -49,17 +49,21 @@
 {
     UErrorCode error = U_ZERO_ERROR;
     Vector<UChar, 4> normalizedCharacters(length);
-#if COMPILER(GCC_OR_CLANG)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
-    int32_t normalizedLength = unorm_normalize(characters, length, UNORM_NFC, UNORM_UNICODE_3_2, normalizedCharacters.data(), length, &error);
-#if COMPILER(GCC_OR_CLANG)
-#pragma GCC diagnostic pop
-#endif
+    const auto* normalizer = unorm2_getNFCInstance(&error);
     if (U_FAILURE(error))
         return nullptr;
+    int32_t normalizedLength = unorm2_normalize(normalizer, characters, length, normalizedCharacters.data(), length, &error);
+    if (U_FAILURE(error)) {
+        if (error != U_BUFFER_OVERFLOW_ERROR)
+            return nullptr;
 
+        error = U_ZERO_ERROR;
+        normalizedCharacters.resize(normalizedLength);
+        normalizedLength = unorm2_normalize(normalizer, characters, length, normalizedCharacters.data(), normalizedLength, &error);
+        if (U_FAILURE(error))
+            return nullptr;
+    }
+
     UChar32 character;
     unsigned clusterLength = 0;
     SurrogatePairAwareTextIterator iterator(normalizedCharacters.data(), 0, normalizedLength, normalizedLength);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to