author | Jonathan Kew <jfkthame@gmail.com> |
Fri, 24 Feb 2012 10:15:46 +0000 | |
changeset 87620 | e90a72c46e97e27d39f239106fcd481284323ca8 |
parent 87619 | 4e2e861f136b1bf55544e7c8c8c82b684b97cfe6 |
child 87621 | 8be318596af5f276606d669deb5ba67f4d5b8731 |
push id | 22137 |
push user | mak77@bonardo.net |
push date | Fri, 24 Feb 2012 17:21:39 +0000 |
treeherder | mozilla-central@58dd942011a8 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | smontagu |
bugs | 724826 |
milestone | 13.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/gfx/thebes/Makefile.in +++ b/gfx/thebes/Makefile.in @@ -70,18 +70,16 @@ EXPORTS = \ gfxPoint3D.h \ gfxPointH3D.h \ gfxQuad.h \ gfxQuaternion.h \ gfxRect.h \ gfxSkipChars.h \ gfxTeeSurface.h \ gfxTypes.h \ - gfxUnicodeProperties.h \ - gfxUnicodeScriptCodes.h \ gfxUtils.h \ gfxUserFontSet.h \ nsCoreAnimationSupport.h \ nsIOSurface.h \ gfxSharedImageSurface.h \ $(NULL) ifeq ($(MOZ_WIDGET_TOOLKIT),android) @@ -199,17 +197,16 @@ CPPSRCS = \ gfxPattern.cpp \ gfxPlatform.cpp \ gfxPlatformFontList.cpp \ gfxRect.cpp \ gfxSkipChars.cpp \ gfxTeeSurface.cpp \ gfxUserFontSet.cpp \ gfxUtils.cpp \ - gfxUnicodeProperties.cpp \ gfxScriptItemizer.cpp \ gfxHarfBuzzShaper.cpp \ gfxSharedImageSurface.cpp \ $(NULL) ifdef MOZ_GRAPHITE DEFINES += -DGRAPHITE2_STATIC CPPSRCS += \
--- a/gfx/thebes/gfxFT2Fonts.cpp +++ b/gfx/thebes/gfxFT2Fonts.cpp @@ -54,17 +54,16 @@ #include "gfxFT2FontBase.h" #include "gfxFT2Utils.h" #include "gfxFT2FontList.h" #include <locale.h> #include "gfxHarfBuzzShaper.h" #ifdef MOZ_GRAPHITE #include "gfxGraphiteShaper.h" #endif -#include "gfxUnicodeProperties.h" #include "gfxAtoms.h" #include "nsTArray.h" #include "nsUnicodeRange.h" #include "nsCRT.h" #include "nsXULAppAPI.h" #include "prlog.h" #include "prinit.h"
--- a/gfx/thebes/gfxFont.cpp +++ b/gfx/thebes/gfxFont.cpp @@ -57,17 +57,17 @@ #include "prtypes.h" #include "gfxTypes.h" #include "nsAlgorithm.h" #include "gfxContext.h" #include "gfxFontMissingGlyphs.h" #include "gfxUserFontSet.h" #include "gfxPlatformFontList.h" #include "gfxScriptItemizer.h" -#include "gfxUnicodeProperties.h" +#include "nsUnicodeProperties.h" #include "nsMathUtils.h" #include "nsBidiUtils.h" #include "nsUnicodeRange.h" #include "nsCompressedCharMap.h" #include "nsStyleConsts.h" #include "mozilla/Preferences.h" #include "mozilla/Services.h" #include "mozilla/Telemetry.h" @@ -78,16 +78,17 @@ #include "harfbuzz/hb-blob.h" #include "nsCRT.h" #include <algorithm> using namespace mozilla; using namespace mozilla::gfx; +using namespace mozilla::unicode; using mozilla::services::GetObserverService; gfxFontCache *gfxFontCache::gGlobalCache = nsnull; #ifdef DEBUG_roc #define DEBUG_TEXT_RUN_STORAGE_METRICS #endif @@ -718,17 +719,17 @@ gfxFontFamily::FindFontForChar(FontSearc rank += 20; aMatchData->mCount++; #ifdef PR_LOGGING PRLogModuleInfo *log = gfxPlatform::GetLog(eGfxLog_textrun); if (NS_UNLIKELY(log)) { PRUint32 charRange = gfxFontUtils::CharRangeBit(aMatchData->mCh); PRUint32 unicodeRange = FindCharUnicodeRange(aMatchData->mCh); - PRUint32 script = gfxUnicodeProperties::GetScriptCode(aMatchData->mCh); + PRUint32 script = GetScriptCode(aMatchData->mCh); PR_LOG(log, PR_LOG_DEBUG,\ ("(textrun-systemfallback-fonts) char: u+%6.6x " "char-range: %d unicode-range: %d script: %d match: [%s]\n", aMatchData->mCh, charRange, unicodeRange, script, NS_ConvertUTF16toUTF8(fe->Name()).get())); } #endif @@ -1873,17 +1874,17 @@ gfxFont::Measure(gfxTextRun *aTextRun, #define BACKTRACK_LIMIT 1024 // If we can't find a space or a cluster start // within 1K chars, just chop arbitrarily. // Limiting backtrack here avoids pathological // behavior on long runs with no whitespace. static bool IsClusterExtender(PRUint32 aUSV) { - PRUint8 category = gfxUnicodeProperties::GetGeneralCategory(aUSV); + PRUint8 category = GetGeneralCategory(aUSV); return ((category >= HB_UNICODE_GENERAL_CATEGORY_SPACING_MARK && category <= HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK) || (aUSV >= 0x200c && aUSV <= 0x200d) || // ZWJ, ZWNJ (aUSV >= 0xff9e && aUSV <= 0xff9f)); // katakana sound marks } static bool IsBoundarySpace(PRUnichar aChar, PRUnichar aNextChar) @@ -3327,17 +3328,17 @@ gfxFontGroup::FindFontForChar(PRUint32 a PRUint8 *aMatchType) { nsRefPtr<gfxFont> selectedFont; if (aPrevMatchedFont) { // Don't switch fonts for control characters, regardless of // whether they are present in the current font, as they won't // actually be rendered (see bug 716229) - PRUint8 category = gfxUnicodeProperties::GetGeneralCategory(aCh); + PRUint8 category = GetGeneralCategory(aCh); if (category == HB_UNICODE_GENERAL_CATEGORY_CONTROL) { selectedFont = aPrevMatchedFont; return selectedFont.forget(); } // if this character is a join-control or the previous is a join-causer, // use the same font as the previous range if we can if (gfxFontUtils::IsJoinControl(aCh) || @@ -3401,17 +3402,17 @@ gfxFontGroup::FindFontForChar(PRUint32 a if (!selectedFont && aPrevMatchedFont && aPrevMatchedFont->HasCharacter(aCh)) { *aMatchType = gfxTextRange::kSystemFallback; selectedFont = aPrevMatchedFont; return selectedFont.forget(); } // for known "space" characters, don't do a full system-fallback search; // we'll synthesize appropriate-width spaces instead of missing-glyph boxes - if (gfxUnicodeProperties::GetGeneralCategory(aCh) == + if (GetGeneralCategory(aCh) == HB_UNICODE_GENERAL_CATEGORY_SPACE_SEPARATOR && GetFontAt(0)->SynthesizeSpaceWidth(aCh) >= 0.0) { return nsnull; } // -- otherwise look for other stuff if (!selectedFont) { @@ -3791,30 +3792,30 @@ gfxFontStyle::ComputeWeight() const // anything but still need to set cluster info. /*static*/ void gfxShapedWord::SetupClusterBoundaries(CompressedGlyph *aGlyphs, const PRUnichar *aString, PRUint32 aLength) { gfxTextRun::CompressedGlyph extendCluster; extendCluster.SetComplex(false, true, 0); - gfxUnicodeProperties::HSType hangulState = gfxUnicodeProperties::HST_NONE; + HSType hangulState = HST_NONE; for (PRUint32 i = 0; i < aLength; ++i) { bool surrogatePair = false; PRUint32 ch = aString[i]; if (NS_IS_HIGH_SURROGATE(ch) && i < aLength - 1 && NS_IS_LOW_SURROGATE(aString[i+1])) { ch = SURROGATE_TO_UCS4(ch, aString[i+1]); surrogatePair = true; } - PRUint8 category = gfxUnicodeProperties::GetGeneralCategory(ch); - gfxUnicodeProperties::HSType hangulType = gfxUnicodeProperties::HST_NONE; + PRUint8 category = GetGeneralCategory(ch); + HSType hangulType = HST_NONE; // combining marks extend the cluster if (IsClusterExtender(ch)) { aGlyphs[i] = extendCluster; } else if (category == HB_UNICODE_GENERAL_CATEGORY_OTHER_LETTER) { // handle special cases in Letter_Other category #if 0 // Currently disabled. This would follow the UAX#29 specification @@ -3845,35 +3846,35 @@ gfxShapedWord::SetupClusterBoundaries(Co } } else #endif if ((ch & ~0xff) == 0x1100 || (ch >= 0xa960 && ch <= 0xa97f) || (ch >= 0xac00 && ch <= 0xd7ff)) { // no break within Hangul syllables - hangulType = gfxUnicodeProperties::GetHangulSyllableType(ch); + hangulType = GetHangulSyllableType(ch); switch (hangulType) { - case gfxUnicodeProperties::HST_L: - case gfxUnicodeProperties::HST_LV: - case gfxUnicodeProperties::HST_LVT: - if (hangulState == gfxUnicodeProperties::HST_L) { + case HST_L: + case HST_LV: + case HST_LVT: + if (hangulState == HST_L) { aGlyphs[i] = extendCluster; } break; - case gfxUnicodeProperties::HST_V: - if ( (hangulState != gfxUnicodeProperties::HST_NONE) && - !(hangulState & gfxUnicodeProperties::HST_T)) + case HST_V: + if ( (hangulState != HST_NONE) && + !(hangulState & HST_T)) { aGlyphs[i] = extendCluster; } break; - case gfxUnicodeProperties::HST_T: - if (hangulState & (gfxUnicodeProperties::HST_V | - gfxUnicodeProperties::HST_T)) + case HST_T: + if (hangulState & (HST_V | + HST_T)) { aGlyphs[i] = extendCluster; } break; default: break; } } @@ -5016,17 +5017,17 @@ gfxTextRun::SetGlyphs(PRUint32 aIndex, C memcpy(details, aGlyphs, sizeof(DetailedGlyph)*glyphCount); } mCharacterGlyphs[aIndex] = aGlyph; } void gfxTextRun::SetMissingGlyph(PRUint32 aIndex, PRUint32 aChar) { - PRUint8 category = gfxUnicodeProperties::GetGeneralCategory(aChar); + PRUint8 category = GetGeneralCategory(aChar); if (category >= HB_UNICODE_GENERAL_CATEGORY_SPACING_MARK && category <= HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK) { mCharacterGlyphs[aIndex].SetComplex(false, true, 0); } DetailedGlyph *details = AllocateDetailedGlyphs(aIndex, 1); if (!details)
--- a/gfx/thebes/gfxGDIFont.cpp +++ b/gfx/thebes/gfxGDIFont.cpp @@ -43,17 +43,16 @@ #include "gfxGDIShaper.h" #include "gfxUniscribeShaper.h" #include "gfxHarfBuzzShaper.h" #ifdef MOZ_GRAPHITE #include "gfxGraphiteShaper.h" #endif #include "gfxWindowsPlatform.h" #include "gfxContext.h" -#include "gfxUnicodeProperties.h" #include "cairo-win32.h" #define ROUND(x) floor((x) + 0.5) static inline cairo_antialias_t GetCairoAntialiasOption(gfxFont::AntialiasOption anAntialiasOption) {
--- a/gfx/thebes/gfxGraphiteShaper.cpp +++ b/gfx/thebes/gfxGraphiteShaper.cpp @@ -43,17 +43,16 @@ #include "nsHashSets.h" #include "gfxTypes.h" #include "gfxContext.h" #include "gfxPlatform.h" #include "gfxGraphiteShaper.h" #include "gfxFontUtils.h" -#include "gfxUnicodeProperties.h" #include "graphite2/Font.h" #include "graphite2/Segment.h" #include "harfbuzz/hb-blob.h" #include "cairo.h"
--- a/gfx/thebes/gfxHarfBuzzShaper.cpp +++ b/gfx/thebes/gfxHarfBuzzShaper.cpp @@ -44,17 +44,18 @@ #include "nsMathUtils.h" #include "gfxTypes.h" #include "gfxContext.h" #include "gfxPlatform.h" #include "gfxHarfBuzzShaper.h" #include "gfxFontUtils.h" -#include "gfxUnicodeProperties.h" +#include "nsUnicodeProperties.h" +#include "nsUnicodeScriptCodes.h" #include "nsUnicodeNormalizer.h" #include "harfbuzz/hb-unicode.h" #include "harfbuzz/hb-ot.h" #include "cairo.h" #include "nsCRT.h" @@ -67,16 +68,17 @@ #define FixedToFloat(f) ((f) * (1.0 / 65536.0)) // Right shifts of negative (signed) integers are undefined, as are overflows // when converting unsigned to negative signed integers. // (If speed were an issue we could make some 2's complement assumptions.) #define FixedToIntRound(f) ((f) > 0 ? ((32768 + (f)) >> 16) \ : -((32767 - (f)) >> 16)) using namespace mozilla; // for AutoSwap_* types +using namespace mozilla::unicode; // for Unicode property lookup /* * Creation and destruction; on deletion, release any font tables we're holding */ gfxHarfBuzzShaper::gfxHarfBuzzShaper(gfxFont *aFont) : gfxFontShaper(aFont), mHBFace(nsnull), @@ -667,42 +669,42 @@ HBGetHKerning(hb_font_t *font, void *fon /* * HarfBuzz unicode property callbacks */ static hb_codepoint_t HBGetMirroring(hb_unicode_funcs_t *ufuncs, hb_codepoint_t aCh, void *user_data) { - return gfxUnicodeProperties::GetMirroredChar(aCh); + return GetMirroredChar(aCh); } static hb_unicode_general_category_t HBGetGeneralCategory(hb_unicode_funcs_t *ufuncs, hb_codepoint_t aCh, void *user_data) { - return hb_unicode_general_category_t(gfxUnicodeProperties::GetGeneralCategory(aCh)); + return hb_unicode_general_category_t(GetGeneralCategory(aCh)); } static hb_script_t HBGetScript(hb_unicode_funcs_t *ufuncs, hb_codepoint_t aCh, void *user_data) { - return hb_script_t(gfxUnicodeProperties::GetScriptTagForCode - (gfxUnicodeProperties::GetScriptCode(aCh))); + return hb_script_t(GetScriptTagForCode + (GetScriptCode(aCh))); } static unsigned int HBGetCombiningClass(hb_unicode_funcs_t *ufuncs, hb_codepoint_t aCh, void *user_data) { - return gfxUnicodeProperties::GetCombiningClass(aCh); + return GetCombiningClass(aCh); } static unsigned int HBGetEastAsianWidth(hb_unicode_funcs_t *ufuncs, hb_codepoint_t aCh, void *user_data) { - return gfxUnicodeProperties::GetEastAsianWidth(aCh); + return GetEastAsianWidth(aCh); } // Hebrew presentation forms with dagesh, for characters 0x05D0..0x05EA; // note that some letters do not have a dagesh presForm encoded static const PRUnichar sDageshForms[0x05EA - 0x05D0 + 1] = { 0xFB30, // ALEF 0xFB31, // BET 0xFB32, // GIMEL @@ -1000,17 +1002,17 @@ gfxHarfBuzzShaper::ShapeWord(gfxContext hb_buffer_set_direction(buffer, isRightToLeft ? HB_DIRECTION_RTL : HB_DIRECTION_LTR); // For unresolved "common" or "inherited" runs, default to Latin for now. // (Should we somehow use the language or locale to try and infer // a better default?) PRInt32 scriptCode = aShapedWord->Script(); hb_script_t scriptTag = (scriptCode <= MOZ_SCRIPT_INHERITED) ? HB_SCRIPT_LATIN : - hb_script_t(gfxUnicodeProperties::GetScriptTagForCode(scriptCode)); + hb_script_t(GetScriptTagForCode(scriptCode)); hb_buffer_set_script(buffer, scriptTag); hb_language_t language; if (style->languageOverride) { language = hb_ot_tag_to_language(style->languageOverride); } else if (entry->mLanguageOverride) { language = hb_ot_tag_to_language(entry->mLanguageOverride); } else {
--- a/gfx/thebes/gfxMacFont.cpp +++ b/gfx/thebes/gfxMacFont.cpp @@ -41,17 +41,16 @@ #include "gfxMacFont.h" #include "gfxCoreTextShaper.h" #include "gfxHarfBuzzShaper.h" #ifdef MOZ_GRAPHITE #include "gfxGraphiteShaper.h" #endif #include "gfxPlatformMac.h" #include "gfxContext.h" -#include "gfxUnicodeProperties.h" #include "gfxFontUtils.h" #include "cairo-quartz.h" using namespace mozilla; using namespace mozilla::gfx; gfxMacFont::gfxMacFont(MacOSFontEntry *aFontEntry, const gfxFontStyle *aFontStyle,
--- a/gfx/thebes/gfxPangoFonts.cpp +++ b/gfx/thebes/gfxPangoFonts.cpp @@ -64,17 +64,18 @@ #include "gfxFT2FontBase.h" #include "gfxFT2Utils.h" #include "harfbuzz/hb-unicode.h" #include "harfbuzz/hb-ot-tag.h" #include "gfxHarfBuzzShaper.h" #ifdef MOZ_GRAPHITE #include "gfxGraphiteShaper.h" #endif -#include "gfxUnicodeProperties.h" +#include "nsUnicodeProperties.h" +#include "nsUnicodeScriptCodes.h" #include "gfxFontconfigUtils.h" #include "gfxUserFontSet.h" #include "gfxAtoms.h" #include <cairo.h> #include <cairo-ft.h> #include <fontconfig/fcfreetype.h> @@ -85,16 +86,17 @@ #ifdef MOZ_WIDGET_GTK2 #include <gdk/gdk.h> #endif #include <math.h> using namespace mozilla; +using namespace mozilla::unicode; #define FLOAT_PANGO_SCALE ((gfxFloat)PANGO_SCALE) #ifndef PANGO_VERSION_CHECK #define PANGO_VERSION_CHECK(x,y,z) 0 #endif #ifndef PANGO_GLYPH_UNKNOWN_FLAG #define PANGO_GLYPH_UNKNOWN_FLAG ((PangoGlyph)0x10000000) @@ -324,17 +326,17 @@ gfxFcFontEntry::ShouldUseHarfBuzz(PRInt3 { mSkipGraphiteCheck = true; return true; } // Mimicing gfxHarfBuzzShaper::ShapeWord hb_script_t script = (aRunScript <= MOZ_SCRIPT_INHERITED) ? HB_SCRIPT_LATIN : - hb_script_t(gfxUnicodeProperties::GetScriptTagForCode(aRunScript)); + hb_script_t(GetScriptTagForCode(aRunScript)); // Prefer HarfBuzz if the font also has support for OpenType shaping of // this script. const FcChar8 otCapTemplate[] = "otlayout:XXXX"; FcChar8 otCap[NS_ARRAY_LENGTH(otCapTemplate)]; memcpy(otCap, otCapTemplate, ArrayLength(otCapTemplate)); // Subtract 5, for 4 characters and NUL. const PRUint32 scriptOffset = ArrayLength(otCapTemplate) - 5; @@ -2048,17 +2050,17 @@ gfxPangoFontGroup::FindFontForChar(PRUin PRInt32 aRunScript, gfxFont *aPrevMatchedFont, PRUint8 *aMatchType) { if (aPrevMatchedFont) { // Don't switch fonts for control characters, regardless of // whether they are present in the current font, as they won't // actually be rendered (see bug 716229) - PRUint8 category = gfxUnicodeProperties::GetGeneralCategory(aCh); + PRUint8 category = GetGeneralCategory(aCh); if (category == HB_UNICODE_GENERAL_CATEGORY_CONTROL) { return nsRefPtr<gfxFont>(aPrevMatchedFont).forget(); } // if this character is a join-control or the previous is a join-causer, // use the same font as the previous range if we can if (gfxFontUtils::IsJoinControl(aCh) || gfxFontUtils::IsJoinCauser(aPrevCh)) {
--- a/gfx/thebes/gfxPlatform.cpp +++ b/gfx/thebes/gfxPlatform.cpp @@ -57,17 +57,17 @@ #include "gfxAndroidPlatform.h" #endif #include "gfxAtoms.h" #include "gfxPlatformFontList.h" #include "gfxContext.h" #include "gfxImageSurface.h" #include "gfxUserFontSet.h" -#include "gfxUnicodeProperties.h" +#include "nsUnicodeProperties.h" #include "harfbuzz/hb-unicode.h" #ifdef MOZ_GRAPHITE #include "gfxGraphiteShaper.h" #endif #include "nsUnicodeRange.h" #include "nsServiceManagerUtils.h" #include "nsTArray.h" @@ -144,17 +144,17 @@ SRGBOverrideObserver::Observe(nsISupport ShutdownCMS(); return NS_OK; } #define GFX_DOWNLOADABLE_FONTS_ENABLED "gfx.downloadable_fonts.enabled" #define GFX_DOWNLOADABLE_FONTS_SANITIZE "gfx.downloadable_fonts.sanitize" #define GFX_PREF_HARFBUZZ_SCRIPTS "gfx.font_rendering.harfbuzz.scripts" -#define HARFBUZZ_SCRIPTS_DEFAULT gfxUnicodeProperties::SHAPING_DEFAULT +#define HARFBUZZ_SCRIPTS_DEFAULT mozilla::unicode::SHAPING_DEFAULT #ifdef MOZ_GRAPHITE #define GFX_PREF_GRAPHITE_SHAPING "gfx.font_rendering.graphite.enabled" #endif #define BIDI_NUMERAL_PREF "bidi.numeral" static const char* kObservedPrefs[] = { @@ -692,17 +692,17 @@ gfxPlatform::UseGraphiteShaping() bool gfxPlatform::UseHarfBuzzForScript(PRInt32 aScriptCode) { if (mUseHarfBuzzScripts == UNINITIALIZED_VALUE) { mUseHarfBuzzScripts = Preferences::GetInt(GFX_PREF_HARFBUZZ_SCRIPTS, HARFBUZZ_SCRIPTS_DEFAULT); } - PRInt32 shapingType = gfxUnicodeProperties::ScriptShapingType(aScriptCode); + PRInt32 shapingType = mozilla::unicode::ScriptShapingType(aScriptCode); return (mUseHarfBuzzScripts & shapingType) != 0; } gfxFontEntry* gfxPlatform::MakePlatformFont(const gfxProxyFontEntry *aProxyEntry, const PRUint8 *aFontData, PRUint32 aLength)
--- a/gfx/thebes/gfxPlatformFontList.cpp +++ b/gfx/thebes/gfxPlatformFontList.cpp @@ -68,17 +68,17 @@ #define FORCE_PR_LOG /* Allow logging in the release build */ #endif #include "prlog.h" #include "gfxPlatformFontList.h" #include "nsUnicharUtils.h" #include "nsUnicodeRange.h" -#include "gfxUnicodeProperties.h" +#include "nsUnicodeProperties.h" #include "mozilla/Preferences.h" #include "mozilla/Telemetry.h" #include "mozilla/TimeStamp.h" using namespace mozilla; // font info loader constants @@ -417,17 +417,17 @@ gfxPlatformFontList::FindFontForChar(con TimeDuration elapsed = TimeStamp::Now() - start; #ifdef PR_LOGGING PRLogModuleInfo *log = gfxPlatform::GetLog(eGfxLog_textrun); if (NS_UNLIKELY(log)) { PRUint32 charRange = gfxFontUtils::CharRangeBit(aCh); PRUint32 unicodeRange = FindCharUnicodeRange(aCh); - PRInt32 script = gfxUnicodeProperties::GetScriptCode(aCh); + PRInt32 script = mozilla::unicode::GetScriptCode(aCh); PR_LOG(log, PR_LOG_DEBUG,\ ("(textrun-systemfallback) char: u+%6.6x " "char-range: %d unicode-range: %d script: %d match: [%s]" " count: %d time: %dus\n", aCh, charRange, unicodeRange, script, (data.mBestMatch ? NS_ConvertUTF16toUTF8(data.mBestMatch->Name()).get() :
--- a/gfx/thebes/gfxScriptItemizer.cpp +++ b/gfx/thebes/gfxScriptItemizer.cpp @@ -73,18 +73,18 @@ * dealings in this Software without prior written authorization of the * copyright holder. * * All trademarks and registered trademarks mentioned herein are the property * of their respective owners. */ #include "gfxScriptItemizer.h" -#include "gfxUnicodeProperties.h" #include "gfxFontUtils.h" // for the FindHighestBit function +#include "nsUnicodeProperties.h" #include "nsCharTraits.h" #define ARRAY_SIZE(array) (sizeof array / sizeof array[0]) #define MOD(sp) ((sp) % PAREN_STACK_DEPTH) #define LIMIT_INC(sp) (((sp) < PAREN_STACK_DEPTH)? (sp) + 1 : PAREN_STACK_DEPTH) #define INC(sp,count) (MOD((sp) + (count))) @@ -276,17 +276,17 @@ gfxScriptItemizer::Next(PRUint32& aRunSt if (NS_IS_HIGH_SURROGATE(ch) && scriptLimit < textLength - 1) { PRUint32 low = textPtr[scriptLimit + 1]; if (NS_IS_LOW_SURROGATE(low)) { ch = SURROGATE_TO_UCS4(ch, low); scriptLimit += 1; } } - sc = gfxUnicodeProperties::GetScriptCode(ch); + sc = mozilla::unicode::GetScriptCode(ch); pairIndex = getPairIndex(ch); /* * Paired character handling: * * if it's an open character, push it onto the stack. * if it's a close character, find the matching open on the
--- a/gfx/thebes/gfxScriptItemizer.h +++ b/gfx/thebes/gfxScriptItemizer.h @@ -78,17 +78,17 @@ */ #ifndef GFX_SCRIPTITEMIZER_H #define GFX_SCRIPTITEMIZER_H #include "mozilla/StdInt.h" #include "prtypes.h" #include "harfbuzz/hb.h" -#include "gfxUnicodeScriptCodes.h" +#include "nsUnicodeScriptCodes.h" #define PAREN_STACK_DEPTH 32 class gfxScriptItemizer { public: gfxScriptItemizer(const PRUnichar *src, PRUint32 length);
--- a/intl/unicharutil/public/Makefile.in +++ b/intl/unicharutil/public/Makefile.in @@ -44,12 +44,14 @@ include $(DEPTH)/config/autoconf.mk MODULE = unicharutil EXPORTS = \ nsICaseConversion.h \ nsIUGenCategory.h \ nsUnicharUtilCIID.h \ nsUnicodeNormalizer.h \ + nsUnicodeProperties.h \ + nsUnicodeScriptCodes.h \ $(NULL) include $(topsrcdir)/config/rules.mk
rename from gfx/thebes/gfxUnicodeProperties.h rename to intl/unicharutil/public/nsUnicodeProperties.h --- a/gfx/thebes/gfxUnicodeProperties.h +++ b/intl/unicharutil/public/nsUnicodeProperties.h @@ -30,55 +30,57 @@ * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ -#ifndef GFX_UNICODEPROPERTIES_H -#define GFX_UNICODEPROPERTIES_H +#ifndef NS_UNICODEPROPERTIES_H +#define NS_UNICODEPROPERTIES_H #include "prtypes.h" -#include "gfxTypes.h" -#include "gfxUnicodeScriptCodes.h" -class THEBES_API gfxUnicodeProperties -{ -public: - static PRUint32 GetMirroredChar(PRUint32 aCh); +namespace mozilla { + +namespace unicode { - static PRUint8 GetCombiningClass(PRUint32 aCh); - - static PRUint8 GetGeneralCategory(PRUint32 aCh); +PRUint32 GetMirroredChar(PRUint32 aCh); - static PRUint8 GetEastAsianWidth(PRUint32 aCh); +PRUint8 GetCombiningClass(PRUint32 aCh); - static PRInt32 GetScriptCode(PRUint32 aCh); - - static PRUint32 GetScriptTagForCode(PRInt32 aScriptCode); +PRUint8 GetGeneralCategory(PRUint32 aCh); - enum HSType { - HST_NONE = 0x00, - HST_L = 0x01, - HST_V = 0x02, - HST_T = 0x04, - HST_LV = 0x03, - HST_LVT = 0x07 - }; +PRUint8 GetEastAsianWidth(PRUint32 aCh); - static HSType GetHangulSyllableType(PRUint32 aCh); +PRInt32 GetScriptCode(PRUint32 aCh); + +PRUint32 GetScriptTagForCode(PRInt32 aScriptCode); - enum ShapingType { - SHAPING_DEFAULT = 0x0001, - SHAPING_ARABIC = 0x0002, - SHAPING_HEBREW = 0x0004, - SHAPING_HANGUL = 0x0008, - SHAPING_MONGOLIAN = 0x0010, - SHAPING_INDIC = 0x0020, - SHAPING_THAI = 0x0040 - }; - - static PRInt32 ScriptShapingType(PRInt32 aScriptCode); +enum HSType { + HST_NONE = 0x00, + HST_L = 0x01, + HST_V = 0x02, + HST_T = 0x04, + HST_LV = 0x03, + HST_LVT = 0x07 }; -#endif /* GFX_UNICODEPROPERTIES_H */ +HSType GetHangulSyllableType(PRUint32 aCh); + +enum ShapingType { + SHAPING_DEFAULT = 0x0001, + SHAPING_ARABIC = 0x0002, + SHAPING_HEBREW = 0x0004, + SHAPING_HANGUL = 0x0008, + SHAPING_MONGOLIAN = 0x0010, + SHAPING_INDIC = 0x0020, + SHAPING_THAI = 0x0040 +}; + +PRInt32 ScriptShapingType(PRInt32 aScriptCode); + +} // end namespace unicode + +} // end namespace mozilla + +#endif /* NS_UNICODEPROPERTIES_H */
rename from gfx/thebes/gfxUnicodeScriptCodes.h rename to intl/unicharutil/public/nsUnicodeScriptCodes.h --- a/gfx/thebes/gfxUnicodeScriptCodes.h +++ b/intl/unicharutil/public/nsUnicodeScriptCodes.h @@ -29,24 +29,24 @@ * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * - * Derived from the Unicode Character Database by genUnicodeScriptData.pl + * Derived from the Unicode Character Database by genUnicodePropertyData.pl * * For Unicode terms of use, see http://www.unicode.org/terms_of_use.html * * ***** END LICENSE BLOCK ***** */ /* - * Created on Mon Feb 13 09:25:50 2012 from UCD data files with version info: + * Created on Thu Feb 23 13:15:51 2012 from UCD data files with version info: * # Date: 2012-01-26, 22:03:00 GMT [KW] # # Unicode Character Database # Copyright (c) 1991-2012 Unicode, Inc. # For terms of use, see http://www.unicode.org/terms_of_use.html # @@ -69,18 +69,18 @@ for the Unicode Character Database (UCD) # HangulSyllableType-6.1.0.txt # Date: 2011-08-25, 00:02:18 GMT [MD] * * * * * * This file contains MACHINE-GENERATED DATA, do not edit! * * * * * */ -#ifndef GFX_UNICODE_SCRIPT_CODES -#define GFX_UNICODE_SCRIPT_CODES +#ifndef NS_UNICODE_SCRIPT_CODES +#define NS_UNICODE_SCRIPT_CODES enum { MOZ_SCRIPT_COMMON = 0, MOZ_SCRIPT_INHERITED = 1, MOZ_SCRIPT_ARABIC = 2, MOZ_SCRIPT_ARMENIAN = 3, MOZ_SCRIPT_BENGALI = 4, MOZ_SCRIPT_BOPOMOFO = 5, MOZ_SCRIPT_CHEROKEE = 6,
--- a/intl/unicharutil/src/Makefile.in +++ b/intl/unicharutil/src/Makefile.in @@ -42,18 +42,20 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk MODULE = unicharutil LIBRARY_NAME = ucharucomp_s FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 +DEFINES += -DHB_DONT_DEFINE_STDINT CPPSRCS = \ nsCaseConversionImp2.cpp \ nsCategoryImp.cpp \ nsEntityConverter.cpp \ nsSaveAsCharset.cpp \ nsUnicodeNormalizer.cpp \ + nsUnicodeProperties.cpp \ $(NULL) include $(topsrcdir)/config/rules.mk
rename from gfx/thebes/gfxUnicodeProperties.cpp rename to intl/unicharutil/src/nsUnicodeProperties.cpp --- a/gfx/thebes/gfxUnicodeProperties.cpp +++ b/intl/unicharutil/src/nsUnicodeProperties.cpp @@ -30,29 +30,32 @@ * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ -#include "gfxUnicodeProperties.h" -#include "gfxUnicodePropertyData.cpp" +#include "nsUnicodeProperties.h" +#include "nsUnicodeScriptCodes.h" +#include "nsUnicodePropertyData.cpp" #include "mozilla/Util.h" #include "nsMemory.h" #include "harfbuzz/hb-unicode.h" -using namespace mozilla; - #define UNICODE_BMP_LIMIT 0x10000 #define UNICODE_LIMIT 0x110000 +namespace mozilla { + +namespace unicode { + /* To store properties for a million Unicode codepoints compactly, we use a three-level array structure, with the Unicode values considered as three elements: Plane, Page, and Char. Space optimization happens because multiple Planes can refer to the same Page array, and multiple Pages can refer to the same Char array holding the actual values. In practice, most of the higher planes are empty and @@ -65,17 +68,17 @@ array. The division of the remaining 16 bits into Page and Char fields is adjusted for each property (by experiment using the generation tool) to provide the most compact storage, depending on the distribution of values. */ PRUint32 -gfxUnicodeProperties::GetMirroredChar(PRUint32 aCh) +GetMirroredChar(PRUint32 aCh) { // all mirrored chars are in plane 0 if (aCh < UNICODE_BMP_LIMIT) { int v = sMirrorValues[sMirrorPages[0][aCh >> kMirrorCharBits]] [aCh & ((1 << kMirrorCharBits) - 1)]; // The mirror value is stored as either an offset (if less than // kSmallMirrorOffset) from the input character code, or as // an index into the sDistantMirrors list. This allows the @@ -85,91 +88,91 @@ gfxUnicodeProperties::GetMirroredChar(PR return aCh + v; } return sDistantMirrors[v - kSmallMirrorOffset]; } return aCh; } PRUint8 -gfxUnicodeProperties::GetCombiningClass(PRUint32 aCh) +GetCombiningClass(PRUint32 aCh) { if (aCh < UNICODE_BMP_LIMIT) { return sCClassValues[sCClassPages[0][aCh >> kCClassCharBits]] [aCh & ((1 << kCClassCharBits) - 1)]; } if (aCh < UNICODE_LIMIT) { return sCClassValues[sCClassPages[sCClassPlanes[(aCh >> 16) - 1]] [(aCh & 0xffff) >> kCClassCharBits]] [aCh & ((1 << kCClassCharBits) - 1)]; } NS_NOTREACHED("invalid Unicode character!"); return 0; } PRUint8 -gfxUnicodeProperties::GetGeneralCategory(PRUint32 aCh) +GetGeneralCategory(PRUint32 aCh) { if (aCh < UNICODE_BMP_LIMIT) { return sCatEAWValues[sCatEAWPages[0][aCh >> kCatEAWCharBits]] [aCh & ((1 << kCatEAWCharBits) - 1)].mCategory; } if (aCh < UNICODE_LIMIT) { return sCatEAWValues[sCatEAWPages[sCatEAWPlanes[(aCh >> 16) - 1]] [(aCh & 0xffff) >> kCatEAWCharBits]] [aCh & ((1 << kCatEAWCharBits) - 1)].mCategory; } NS_NOTREACHED("invalid Unicode character!"); return PRUint8(HB_UNICODE_GENERAL_CATEGORY_UNASSIGNED); } PRUint8 -gfxUnicodeProperties::GetEastAsianWidth(PRUint32 aCh) +GetEastAsianWidth(PRUint32 aCh) { if (aCh < UNICODE_BMP_LIMIT) { return sCatEAWValues[sCatEAWPages[0][aCh >> kCatEAWCharBits]] [aCh & ((1 << kCatEAWCharBits) - 1)].mEAW; } if (aCh < UNICODE_LIMIT) { return sCatEAWValues[sCatEAWPages[sCatEAWPlanes[(aCh >> 16) - 1]] [(aCh & 0xffff) >> kCatEAWCharBits]] [aCh & ((1 << kCatEAWCharBits) - 1)].mEAW; } NS_NOTREACHED("invalid Unicode character!"); return 0; } PRInt32 -gfxUnicodeProperties::GetScriptCode(PRUint32 aCh) +GetScriptCode(PRUint32 aCh) { if (aCh < UNICODE_BMP_LIMIT) { return sScriptValues[sScriptPages[0][aCh >> kScriptCharBits]] [aCh & ((1 << kScriptCharBits) - 1)]; } if (aCh < UNICODE_LIMIT) { return sScriptValues[sScriptPages[sScriptPlanes[(aCh >> 16) - 1]] [(aCh & 0xffff) >> kScriptCharBits]] [aCh & ((1 << kScriptCharBits) - 1)]; } NS_NOTREACHED("invalid Unicode character!"); return MOZ_SCRIPT_UNKNOWN; } PRUint32 -gfxUnicodeProperties::GetScriptTagForCode(PRInt32 aScriptCode) +GetScriptTagForCode(PRInt32 aScriptCode) { // this will safely return 0 for negative script codes, too :) if (PRUint32(aScriptCode) > ArrayLength(sScriptCodeToTag)) { return 0; } return sScriptCodeToTag[aScriptCode]; } -gfxUnicodeProperties::HSType -gfxUnicodeProperties::GetHangulSyllableType(PRUint32 aCh) +HSType +GetHangulSyllableType(PRUint32 aCh) { // all Hangul chars are in plane 0 if (aCh < UNICODE_BMP_LIMIT) { return HSType(sHangulValues[sHangulPages[0][aCh >> kHangulCharBits]] [aCh & ((1 << kHangulCharBits) - 1)]); } return HST_NONE; } @@ -178,17 +181,17 @@ gfxUnicodeProperties::GetHangulSyllableT // expect this to evolve as harfbuzz shaping support matures. // // The "shaping type" of each script run, as returned by this // function, is compared to the bits set in the // gfx.font_rendering.harfbuzz.scripts // preference to decide whether to use the harfbuzz shaper. // PRInt32 -gfxUnicodeProperties::ScriptShapingType(PRInt32 aScriptCode) +ScriptShapingType(PRInt32 aScriptCode) { switch (aScriptCode) { default: return SHAPING_DEFAULT; // scripts not explicitly listed here are // assumed to just use default shaping case MOZ_SCRIPT_ARABIC: case MOZ_SCRIPT_SYRIAC: @@ -226,8 +229,12 @@ gfxUnicodeProperties::ScriptShapingType( case MOZ_SCRIPT_TAI_LE: case MOZ_SCRIPT_MYANMAR: case MOZ_SCRIPT_PHAGS_PA: case MOZ_SCRIPT_BATAK: case MOZ_SCRIPT_BRAHMI: return SHAPING_INDIC; // scripts that require Indic or other "special" shaping } } + +} // end namespace unicode + +} // end namespace mozilla
rename from gfx/thebes/gfxUnicodePropertyData.cpp rename to intl/unicharutil/src/nsUnicodePropertyData.cpp --- a/gfx/thebes/gfxUnicodePropertyData.cpp +++ b/intl/unicharutil/src/nsUnicodePropertyData.cpp @@ -29,24 +29,24 @@ * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * - * Derived from the Unicode Character Database by genUnicodeScriptData.pl + * Derived from the Unicode Character Database by genUnicodePropertyData.pl * * For Unicode terms of use, see http://www.unicode.org/terms_of_use.html * * ***** END LICENSE BLOCK ***** */ /* - * Created on Mon Feb 13 09:25:50 2012 from UCD data files with version info: + * Created on Thu Feb 23 13:15:51 2012 from UCD data files with version info: * # Date: 2012-01-26, 22:03:00 GMT [KW] # # Unicode Character Database # Copyright (c) 1991-2012 Unicode, Inc. # For terms of use, see http://www.unicode.org/terms_of_use.html #
rename from gfx/thebes/genUnicodeScriptData.pl rename to intl/unicharutil/tools/genUnicodePropertyData.pl --- a/gfx/thebes/genUnicodeScriptData.pl +++ b/intl/unicharutil/tools/genUnicodePropertyData.pl @@ -36,17 +36,17 @@ # # ***** END LICENSE BLOCK ***** # This tool is used to prepare lookup tables of Unicode character properties # needed by gfx code to support text shaping operations. The properties are # read from the Unicode Character Database and compiled into multi-level arrays # for efficient lookup. # -# To regenerate the tables in gfxUnicodePropertyData.cpp: +# To regenerate the tables in nsUnicodePropertyData.cpp: # # (1) Download the current Unicode data files from # # http://www.unicode.org/Public/UNIDATA/ # # NB: not all the files are actually needed; currently, we require # - UnicodeData.txt # - Scripts.txt @@ -55,46 +55,69 @@ # - HangulSyllableType.txt # - ReadMe.txt (to record version/date of the UCD) # though this may change if we find a need for additional properties. # # The Unicode data files should be together in a single directory. # # (2) Run this tool using a command line of the form # -# perl genUnicodeScriptData.pl \ -# /path/to/hb-common.h \ +# perl genUnicodePropertyData.pl \ +# /path/to/hb-common.h \ # /path/to/UCD-directory # # (where hb-common.h is found in the gfx/harfbuzz/src directory). # # This will generate (or overwrite!) the files # -# gfxUnicodePropertyData.cpp -# gfxUnicodeScriptCodes.h +# nsUnicodePropertyData.cpp +# nsUnicodeScriptCodes.h # # in the current directory. use strict; +if ($#ARGV != 1) { + print <<__EOT; +# Run this tool using a command line of the form +# +# perl genUnicodePropertyData.pl \ +# /path/to/hb-common.h \ +# /path/to/UCD-directory +# +# where hb-common.h is currently found in the gfx/harfbuzz/src directory, +# and UCD-directory is a directory containing the current Unicode Character +# Database files (UnicodeData.txt, etc), available from +# http://www.unicode.org/Public/UNIDATA/ +# +# This will generate (or overwrite!) the files +# +# nsUnicodePropertyData.cpp +# nsUnicodeScriptCodes.h +# +# in the current directory. +__EOT + exit 0; +} + # load HB_Script and HB_Category constants # NOTE that HB_SCRIPT_* constants are now "tag" values, NOT sequentially-allocated # script codes as used by Glib/Pango/etc. # We therefore define a set of MOZ_SCRIPT_* constants that are script _codes_ # compatible with those libraries, and map these to HB_SCRIPT_* _tags_ as needed. my $sc = -1; my $cc = -1; my %scriptCode; my %catCode; my @scriptCodeToTag; my @scriptCodeToName; -open FH, "< $ARGV[0]" or die "can't open $ARGV[0] (header file hb-unicode.h)\n"; +open FH, "< $ARGV[0]" or die "can't open $ARGV[0] (should be header file hb-common.h)\n"; while (<FH>) { if (m/HB_SCRIPT_([A-Z_]+)\s*=\s*HB_TAG\s*\(('.','.','.','.')\)\s*,/) { $scriptCodeToTag[++$sc] = $2; $scriptCodeToName[$sc] = $1; $scriptCode{$1} = $sc; } if (m/HB_UNICODE_GENERAL_CATEGORY_([A-Z_]+)/) { $cc++; @@ -289,17 +312,17 @@ while (<FH>) { $hangul[$i] = $hangul; } } } close FH; my $timestamp = gmtime(); -open DATA_TABLES, "> gfxUnicodePropertyData.cpp" or die "unable to open gfxUnicodePropertyData.cpp for output"; +open DATA_TABLES, "> nsUnicodePropertyData.cpp" or die "unable to open nsUnicodePropertyData.cpp for output"; my $licenseBlock = q[ /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with @@ -327,17 +350,17 @@ my $licenseBlock = q[ * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * - * Derived from the Unicode Character Database by genUnicodeScriptData.pl + * Derived from the Unicode Character Database by genUnicodePropertyData.pl * * For Unicode terms of use, see http://www.unicode.org/terms_of_use.html * * ***** END LICENSE BLOCK ***** */ ]; my $versionInfo = join("\n", @versionInfo); @@ -481,32 +504,32 @@ sub genTables print DATA_TABLES <<__END; /* * * * * * This file contains MACHINE-GENERATED DATA, do not edit! * * * * * */ __END close DATA_TABLES; -open HEADER, "> gfxUnicodeScriptCodes.h" or die "unable to open gfxUnicodeScriptCodes.h for output"; +open HEADER, "> nsUnicodeScriptCodes.h" or die "unable to open nsUnicodeScriptCodes.h for output"; print HEADER <<__END; $licenseBlock /* * Created on $timestamp from UCD data files with version info: * $versionInfo * * * * * * This file contains MACHINE-GENERATED DATA, do not edit! * * * * * */ -#ifndef GFX_UNICODE_SCRIPT_CODES -#define GFX_UNICODE_SCRIPT_CODES +#ifndef NS_UNICODE_SCRIPT_CODES +#define NS_UNICODE_SCRIPT_CODES __END print HEADER "enum {\n"; for (my $i = 0; $i < scalar @scriptCodeToName; ++$i) { print HEADER " MOZ_SCRIPT_", $scriptCodeToName[$i], " = ", $i, ",\n"; } print HEADER " MOZ_SCRIPT_INVALID = -1\n"; print HEADER "};\n\n";
--- a/layout/base/nsBidiPresUtils.cpp +++ b/layout/base/nsBidiPresUtils.cpp @@ -49,17 +49,17 @@ #include "nsFrameManager.h" #include "nsBidiUtils.h" #include "nsCSSFrameConstructor.h" #include "nsContainerFrame.h" #include "nsInlineFrame.h" #include "nsPlaceholderFrame.h" #include "nsContainerFrame.h" #include "nsFirstLetterFrame.h" -#include "gfxUnicodeProperties.h" +#include "nsUnicodeProperties.h" #include "nsTextFrame.h" #undef NOISY_BIDI #undef REALLY_NOISY_BIDI using namespace mozilla; static const PRUnichar kSpace = 0x0020; @@ -2015,17 +2015,17 @@ void nsBidiPresUtils::WriteReverse(const } } else if (NS_IS_HIGH_SURROGATE(*src)) { // paired high surrogates are handled above, so this is a lone high surrogate UTF32Char = UCS2_REPLACEMENT_CHAR; } else { UTF32Char = *src; } - UTF32Char = gfxUnicodeProperties::GetMirroredChar(UTF32Char); + UTF32Char = mozilla::unicode::GetMirroredChar(UTF32Char); if (IS_IN_BMP(UTF32Char)) { *(dest++) = UTF32Char; } else { *(dest++) = H_SURROGATE(UTF32Char); *(dest++) = L_SURROGATE(UTF32Char); } }