mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-10 02:08:38 +09:00
Issue #2492 - Standardized use of Emoji Character Properties
Detection of Emoji Components, for use as suffixes of TextDefault. Detection of Non-Presentation Emojis as TextDefault. Detection of all Extended Pictographics as EmojiDefault.
This commit is contained in:
parent
5c296d7c4a
commit
69f3b4e199
5 changed files with 33 additions and 32 deletions
|
|
@ -212,13 +212,12 @@ gfxPlatformGtk::GetCommonFallbackFonts(uint32_t aCh, uint32_t aNextCh,
|
||||||
nsTArray<const char*>& aFontList)
|
nsTArray<const char*>& aFontList)
|
||||||
{
|
{
|
||||||
EmojiPresentation emoji = GetEmojiPresentation(aCh);
|
EmojiPresentation emoji = GetEmojiPresentation(aCh);
|
||||||
if (emoji != EmojiPresentation::TextOnly) {
|
EmojiPresentation eNext = GetEmojiPresentation(aNextCh);
|
||||||
if (aNextCh == kVariationSelector16 ||
|
if (aNextCh != kVariationSelector15 &&
|
||||||
(aNextCh != kVariationSelector15 &&
|
emoji != EmojiPresentation::TextOnly &&
|
||||||
emoji == EmojiPresentation::EmojiDefault)) {
|
(emoji != EmojiPresentation::TextDefault ||
|
||||||
// if char is followed by VS16, try for a color emoji glyph
|
eNext == EmojiPresentation::EmojiComponent)) {
|
||||||
aFontList.AppendElement(kFontTwemojiMozilla);
|
aFontList.AppendElement(kFontTwemojiMozilla);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
aFontList.AppendElement(kFontDejaVuSerif);
|
aFontList.AppendElement(kFontDejaVuSerif);
|
||||||
|
|
|
||||||
|
|
@ -191,13 +191,12 @@ gfxPlatformMac::GetCommonFallbackFonts(uint32_t aCh, uint32_t aNextCh,
|
||||||
nsTArray<const char*>& aFontList)
|
nsTArray<const char*>& aFontList)
|
||||||
{
|
{
|
||||||
EmojiPresentation emoji = GetEmojiPresentation(aCh);
|
EmojiPresentation emoji = GetEmojiPresentation(aCh);
|
||||||
if (emoji != EmojiPresentation::TextOnly) {
|
EmojiPresentation eNext = GetEmojiPresentation(aNextCh);
|
||||||
if (aNextCh == kVariationSelector16 ||
|
if (aNextCh != kVariationSelector15 &&
|
||||||
(aNextCh != kVariationSelector15 &&
|
emoji != EmojiPresentation::TextOnly &&
|
||||||
emoji == EmojiPresentation::EmojiDefault)) {
|
(emoji != EmojiPresentation::TextDefault ||
|
||||||
// if char is followed by VS16, try for a color emoji glyph
|
eNext == EmojiPresentation::EmojiComponent)) {
|
||||||
aFontList.AppendElement(kFontAppleColorEmoji);
|
aFontList.AppendElement(kFontAppleColorEmoji);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
aFontList.AppendElement(kFontLucidaGrande);
|
aFontList.AppendElement(kFontLucidaGrande);
|
||||||
|
|
|
||||||
|
|
@ -3113,10 +3113,11 @@ gfxFontGroup::WhichPrefFontSupportsChar(uint32_t aCh, uint32_t aNextCh)
|
||||||
gfxPlatformFontList* pfl = gfxPlatformFontList::PlatformFontList();
|
gfxPlatformFontList* pfl = gfxPlatformFontList::PlatformFontList();
|
||||||
|
|
||||||
EmojiPresentation emoji = GetEmojiPresentation(aCh);
|
EmojiPresentation emoji = GetEmojiPresentation(aCh);
|
||||||
if ((emoji != EmojiPresentation::TextOnly &&
|
EmojiPresentation eNext = GetEmojiPresentation(aNextCh);
|
||||||
(aNextCh == kVariationSelector16 ||
|
if (aNextCh != kVariationSelector15 &&
|
||||||
(emoji == EmojiPresentation::EmojiDefault &&
|
emoji != EmojiPresentation::TextOnly &&
|
||||||
aNextCh != kVariationSelector15)))) {
|
(emoji != EmojiPresentation::TextDefault ||
|
||||||
|
eNext == EmojiPresentation::EmojiComponent)) {
|
||||||
charLang = eFontPrefLang_Emoji;
|
charLang = eFontPrefLang_Emoji;
|
||||||
} else {
|
} else {
|
||||||
// get the pref font list if it hasn't been set up already
|
// get the pref font list if it hasn't been set up already
|
||||||
|
|
|
||||||
|
|
@ -638,14 +638,12 @@ gfxWindowsPlatform::GetCommonFallbackFonts(uint32_t aCh, uint32_t aNextCh,
|
||||||
nsTArray<const char*>& aFontList)
|
nsTArray<const char*>& aFontList)
|
||||||
{
|
{
|
||||||
EmojiPresentation emoji = GetEmojiPresentation(aCh);
|
EmojiPresentation emoji = GetEmojiPresentation(aCh);
|
||||||
if (emoji != EmojiPresentation::TextOnly) {
|
EmojiPresentation eNext = GetEmojiPresentation(aNextCh);
|
||||||
if (aNextCh == kVariationSelector16 ||
|
if (aNextCh != kVariationSelector15 &&
|
||||||
(aNextCh != kVariationSelector15 &&
|
emoji != EmojiPresentation::TextOnly &&
|
||||||
emoji == EmojiPresentation::EmojiDefault)) {
|
(emoji != EmojiPresentation::TextDefault ||
|
||||||
// if char is followed by VS16, try for a color emoji glyph
|
eNext == EmojiPresentation::EmojiComponent)) {
|
||||||
// XXX: For Win8+ native, aFontList.AppendElement(kFontSegoeUIEmoji);
|
aFontList.AppendElement(kFontTwemojiMozilla);
|
||||||
aFontList.AppendElement(kFontTwemojiMozilla);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Arial is used as the default fallback for system fallback
|
// Arial is used as the default fallback for system fallback
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,8 @@ enum IdentifierType {
|
||||||
enum EmojiPresentation {
|
enum EmojiPresentation {
|
||||||
TextOnly = 0,
|
TextOnly = 0,
|
||||||
TextDefault = 1,
|
TextDefault = 1,
|
||||||
EmojiDefault = 2
|
EmojiDefault = 2,
|
||||||
|
EmojiComponent = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint32_t kVariationSelector15 = 0xFE0E; // text presentation
|
const uint32_t kVariationSelector15 = 0xFE0E; // text presentation
|
||||||
|
|
@ -179,14 +180,17 @@ IsDefaultIgnorable(uint32_t aCh)
|
||||||
inline EmojiPresentation
|
inline EmojiPresentation
|
||||||
GetEmojiPresentation(uint32_t aCh)
|
GetEmojiPresentation(uint32_t aCh)
|
||||||
{
|
{
|
||||||
if (!u_hasBinaryProperty(aCh, UCHAR_EMOJI)) {
|
if (u_hasBinaryProperty(aCh, UCHAR_EMOJI_COMPONENT)) {
|
||||||
return TextOnly;
|
return EmojiComponent;
|
||||||
}
|
}
|
||||||
|
if (u_hasBinaryProperty(aCh, UCHAR_EMOJI) &&
|
||||||
if (u_hasBinaryProperty(aCh, UCHAR_EMOJI_PRESENTATION)) {
|
!u_hasBinaryProperty(aCh, UCHAR_EMOJI_PRESENTATION)) {
|
||||||
|
return TextDefault;
|
||||||
|
}
|
||||||
|
if (u_hasBinaryProperty(aCh, UCHAR_EXTENDED_PICTOGRAPHIC)) {
|
||||||
return EmojiDefault;
|
return EmojiDefault;
|
||||||
}
|
}
|
||||||
return TextDefault;
|
return TextOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns the simplified Gen Category as defined in nsIUGenCategory
|
// returns the simplified Gen Category as defined in nsIUGenCategory
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue