mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-28 18:17:29 +09:00
Issue #325 Part 3: Remove support for using legacy Gecko normalization in gfxHarfBuzzShaper.
This commit is contained in:
parent
6008e3c1f5
commit
cbc1d586e1
2 changed files with 6 additions and 34 deletions
|
|
@ -12,20 +12,14 @@
|
||||||
#include "mozilla/Sprintf.h"
|
#include "mozilla/Sprintf.h"
|
||||||
#include "nsUnicodeProperties.h"
|
#include "nsUnicodeProperties.h"
|
||||||
#include "nsUnicodeScriptCodes.h"
|
#include "nsUnicodeScriptCodes.h"
|
||||||
#include "nsUnicodeNormalizer.h"
|
|
||||||
|
|
||||||
#include "harfbuzz/hb.h"
|
#include "harfbuzz/hb.h"
|
||||||
#include "harfbuzz/hb-ot.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/unorm.h"
|
||||||
#include "unicode/utext.h"
|
#include "unicode/utext.h"
|
||||||
#define MOZ_HB_SHAPER_USE_ICU_NORMALIZATION 1
|
|
||||||
static const UNormalizer2 * sNormalizer = nullptr;
|
static const UNormalizer2 * sNormalizer = nullptr;
|
||||||
#else
|
|
||||||
#undef MOZ_HB_SHAPER_USE_ICU_NORMALIZATION
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
|
@ -1091,8 +1085,6 @@ HBUnicodeCompose(hb_unicode_funcs_t *ufuncs,
|
||||||
hb_codepoint_t *ab,
|
hb_codepoint_t *ab,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
#if MOZ_HB_SHAPER_USE_ICU_NORMALIZATION
|
|
||||||
|
|
||||||
if (sNormalizer) {
|
if (sNormalizer) {
|
||||||
UChar32 ch = unorm2_composePair(sNormalizer, a, b);
|
UChar32 ch = unorm2_composePair(sNormalizer, a, b);
|
||||||
if (ch >= 0) {
|
if (ch >= 0) {
|
||||||
|
|
@ -1101,14 +1093,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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1129,8 +1113,6 @@ HBUnicodeDecompose(hb_unicode_funcs_t *ufuncs,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MOZ_HB_SHAPER_USE_ICU_NORMALIZATION
|
|
||||||
|
|
||||||
if (!sNormalizer) {
|
if (!sNormalizer) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -1162,12 +1144,6 @@ HBUnicodeDecompose(hb_unicode_funcs_t *ufuncs,
|
||||||
utext_close(&text);
|
utext_close(&text);
|
||||||
|
|
||||||
return *b != 0 || *a != ab;
|
return *b != 0 || *a != ab;
|
||||||
|
|
||||||
#else // no ICU available, use the old nsUnicodeNormalizer
|
|
||||||
|
|
||||||
return nsUnicodeNormalizer::DecomposeNonRecursively(ab, a, b);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -1250,11 +1226,9 @@ gfxHarfBuzzShaper::Initialize()
|
||||||
HBUnicodeDecompose,
|
HBUnicodeDecompose,
|
||||||
nullptr, nullptr);
|
nullptr, nullptr);
|
||||||
|
|
||||||
#if MOZ_HB_SHAPER_USE_ICU_NORMALIZATION
|
|
||||||
UErrorCode error = U_ZERO_ERROR;
|
UErrorCode error = U_ZERO_ERROR;
|
||||||
sNormalizer = unorm2_getNFCInstance(&error);
|
sNormalizer = unorm2_getNFCInstance(&error);
|
||||||
NS_ASSERTION(U_SUCCESS(error), "failed to get ICU normalizer");
|
MOZ_ASSERT(U_SUCCESS(error), "failed to get ICU normalizer");
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gfxFontEntry *entry = mFont->GetFontEntry();
|
gfxFontEntry *entry = mFont->GetFontEntry();
|
||||||
|
|
|
||||||
|
|
@ -223,12 +223,10 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
|
||||||
'DeviceManagerDx.cpp',
|
'DeviceManagerDx.cpp',
|
||||||
]
|
]
|
||||||
|
|
||||||
# We prefer to use ICU for normalization functions, but currently it is only
|
# We use ICU for normalization functions
|
||||||
# available if we're building with the Intl API enabled:
|
USE_LIBS += [
|
||||||
if CONFIG['ENABLE_INTL_API']:
|
'icu',
|
||||||
USE_LIBS += [
|
]
|
||||||
'icu',
|
|
||||||
]
|
|
||||||
|
|
||||||
include('/ipc/chromium/chromium-config.mozbuild')
|
include('/ipc/chromium/chromium-config.mozbuild')
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue