Skip to content

Commit

Permalink
Merge 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
carlosgcampos committed Feb 13, 2019
1 parent b804ffd commit 18d7eec
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 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-13 Ryosuke Niwa <rniwa@webkit.org>

Release assert in PolicyCheckIdentifier::isValidFor via WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction
Expand Down
15 changes: 12 additions & 3 deletions Source/WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp
Expand Up @@ -104,11 +104,20 @@ const Font* FontCascade::fontForCombiningCharacterSequence(const UChar* characte
{
UErrorCode error = U_ZERO_ERROR;
Vector<UChar, 4> normalizedCharacters(length);
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
int32_t normalizedLength = unorm_normalize(characters, length, UNORM_NFC, UNORM_UNICODE_3_2, normalizedCharacters.data(), length, &error);
ALLOW_DEPRECATED_DECLARATIONS_END
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 18d7eec

Please sign in to comment.