Bug 1402049 - Remove support for using legacy Gecko normalization in gfxHarfBuzzShaper, as ICU is always available. r=jrmuizel

This commit is contained in:
Jonathan Kew 2017-09-22 10:37:16 +01:00
parent f875e0fd37
commit 815fd00452
2 changed files with 7 additions and 35 deletions

View File

@ -12,20 +12,14 @@
#include "mozilla/Sprintf.h"
#include "nsUnicodeProperties.h"
#include "nsUnicodeScriptCodes.h"
#include "nsUnicodeNormalizer.h"
#include "harfbuzz/hb.h"
#include "harfbuzz/hb-ot.h"
#if ENABLE_INTL_API // ICU is available: we'll use it for Unicode composition
// and decomposition in preference to nsUnicodeNormalizer.
#include "unicode/unorm.h"
#include "unicode/utext.h"
#define MOZ_HB_SHAPER_USE_ICU_NORMALIZATION 1
static const UNormalizer2 * sNormalizer = nullptr;
#else
#undef MOZ_HB_SHAPER_USE_ICU_NORMALIZATION
#endif
static const UNormalizer2* sNormalizer = nullptr;
#include <algorithm>
@ -1106,8 +1100,6 @@ HBUnicodeCompose(hb_unicode_funcs_t *ufuncs,
hb_codepoint_t *ab,
void *user_data)
{
#if MOZ_HB_SHAPER_USE_ICU_NORMALIZATION
if (sNormalizer) {
UChar32 ch = unorm2_composePair(sNormalizer, a, b);
if (ch >= 0) {
@ -1116,14 +1108,6 @@ HBUnicodeCompose(hb_unicode_funcs_t *ufuncs,
}
}
#else // no ICU available, use the old nsUnicodeNormalizer
if (nsUnicodeNormalizer::Compose(a, b, ab)) {
return true;
}
#endif
return false;
}
@ -1144,8 +1128,6 @@ HBUnicodeDecompose(hb_unicode_funcs_t *ufuncs,
}
#endif
#if MOZ_HB_SHAPER_USE_ICU_NORMALIZATION
if (!sNormalizer) {
return false;
}
@ -1177,12 +1159,6 @@ HBUnicodeDecompose(hb_unicode_funcs_t *ufuncs,
utext_close(&text);
return *b != 0 || *a != ab;
#else // no ICU available, use the old nsUnicodeNormalizer
return nsUnicodeNormalizer::DecomposeNonRecursively(ab, a, b);
#endif
}
static void
@ -1265,11 +1241,9 @@ gfxHarfBuzzShaper::Initialize()
HBUnicodeDecompose,
nullptr, nullptr);
#if MOZ_HB_SHAPER_USE_ICU_NORMALIZATION
UErrorCode error = U_ZERO_ERROR;
sNormalizer = unorm2_getNFCInstance(&error);
NS_ASSERTION(U_SUCCESS(error), "failed to get ICU normalizer");
#endif
MOZ_ASSERT(U_SUCCESS(error), "failed to get ICU normalizer");
}
gfxFontEntry *entry = mFont->GetFontEntry();

View File

@ -233,12 +233,10 @@ if CONFIG['MOZ_ENABLE_SKIA_PDF']:
'PrintTargetSkPDF.cpp',
]
# We prefer to use ICU for normalization functions, but currently it is only
# available if we're building with the Intl API enabled:
if CONFIG['ENABLE_INTL_API']:
USE_LIBS += [
'icu',
]
# We use ICU for normalization functions:
USE_LIBS += [
'icu',
]
include('/ipc/chromium/chromium-config.mozbuild')