Skip to content

Commit

Permalink
Merged r241402 - [FreeType] Unable to render some Hebrew characters
Browse files Browse the repository at this point in the history
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):
  • Loading branch information
aperezdc committed Feb 22, 2019
1 parent d401f62 commit 79f9a90
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 8 deletions.
14 changes: 14 additions & 0 deletions Source/WebCore/ChangeLog
@@ -1,3 +1,17 @@
2019-02-13 Carlos Garcia Campos <cgarcia@igalia.com>

[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 <csaavedra@igalia.com>

Race-condition during scrolling thread creation
Expand Down
20 changes: 12 additions & 8 deletions Source/WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp
Expand Up @@ -49,16 +49,20 @@ const Font* FontCascade::fontForCombiningCharacterSequence(const UChar* characte
{
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;
Expand Down

0 comments on commit 79f9a90

Please sign in to comment.