Bug 1719554 - Unify unicode::Script as intl::Script; r=platform-i18n-reviewers,gregtatum

Differential Revision: https://phabricator.services.mozilla.com/D132278
This commit is contained in:
Dan Minor
2021-12-03 20:49:32 +00:00
parent 1219282759
commit 438c13a7c2
31 changed files with 187 additions and 249 deletions

View File

@@ -11,9 +11,16 @@
#include "nsBidiUtils.h"
#include "nsUGenCategory.h"
#include "nsUnicodeScriptCodes.h"
#include "harfbuzz/hb.h"
struct nsCharProps2 {
// Currently only 4 bits are defined here, so 4 more could be added without
// affecting the storage requirements for this struct. Or we could pack two
// records per byte, at the cost of a slightly more complex accessor.
unsigned char mVertOrient : 2;
unsigned char mIdType : 2;
};
const nsCharProps2& GetCharProps2(uint32_t aCh);
namespace mozilla {
@@ -69,17 +76,8 @@ inline uint8_t GetLineBreakClass(uint32_t aCh) {
aCh, intl::UnicodeProperties::IntProperty::LineBreak);
}
inline Script GetScriptCode(uint32_t aCh) {
UErrorCode err = U_ZERO_ERROR;
return Script(uscript_getScript(aCh, &err));
}
inline bool HasScript(uint32_t aCh, Script aScript) {
return uscript_hasScript(aCh, UScriptCode(aScript));
}
inline uint32_t GetScriptTagForCode(Script aScriptCode) {
const char* tag = uscript_getShortName(UScriptCode(aScriptCode));
inline uint32_t GetScriptTagForCode(intl::Script aScriptCode) {
const char* tag = intl::UnicodeProperties::GetScriptShortName(aScriptCode);
if (tag) {
return HB_TAG(tag[0], tag[1], tag[2], tag[3]);
}