mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-22 23:27:30 +09:00
ported from mozilla: Bug 1819025 - Don't consider following join-controls when determining whether a space is collapsible. r=emilio (fad4426b7b)
This commit is contained in:
parent
ff8673e87e
commit
854fac5c4c
3 changed files with 17 additions and 1 deletions
|
|
@ -158,6 +158,16 @@ IsClusterExtender(uint32_t aCh, uint8_t aCategory)
|
||||||
(aCh >= 0xe0020 && aCh <= 0xe007f)); // emoji (flag) tag characters
|
(aCh >= 0xe0020 && aCh <= 0xe007f)); // emoji (flag) tag characters
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IsClusterExtenderExcludingJoiners(uint32_t aCh, uint8_t aCategory)
|
||||||
|
{
|
||||||
|
return ((aCategory >= HB_UNICODE_GENERAL_CATEGORY_SPACING_MARK &&
|
||||||
|
aCategory <= HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK) ||
|
||||||
|
(aCh >= 0xff9e && aCh <= 0xff9f) || // katakana sound marks
|
||||||
|
(aCh >= 0x1F3FB && aCh <= 0x1F3FF) || // fitzpatrick skin tone modifiers
|
||||||
|
(aCh >= 0xe0020 && aCh <= 0xe007f)); // emoji (flag) tag characters
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
enum HSType {
|
enum HSType {
|
||||||
HST_NONE = U_HST_NOT_APPLICABLE,
|
HST_NONE = U_HST_NOT_APPLICABLE,
|
||||||
HST_L = U_HST_LEADING_JAMO,
|
HST_L = U_HST_LEADING_JAMO,
|
||||||
|
|
|
||||||
|
|
@ -216,6 +216,12 @@ inline bool IsClusterExtender(uint32_t aCh) {
|
||||||
return IsClusterExtender(aCh, GetGeneralCategory(aCh));
|
return IsClusterExtender(aCh, GetGeneralCategory(aCh));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IsClusterExtenderExcludingJoiners(uint32_t aCh, uint8_t aCategory);
|
||||||
|
|
||||||
|
inline bool IsClusterExtenderExcludingJoiners(uint32_t aCh) {
|
||||||
|
return IsClusterExtenderExcludingJoiners(aCh, GetGeneralCategory(aCh));
|
||||||
|
}
|
||||||
|
|
||||||
// A simple iterator for a string of char16_t codepoints that advances
|
// A simple iterator for a string of char16_t codepoints that advances
|
||||||
// by Unicode grapheme clusters
|
// by Unicode grapheme clusters
|
||||||
class ClusterIterator
|
class ClusterIterator
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ public:
|
||||||
static bool
|
static bool
|
||||||
IsSpaceCombiningSequenceTail(const char16_t* aChars, int32_t aLength) {
|
IsSpaceCombiningSequenceTail(const char16_t* aChars, int32_t aLength) {
|
||||||
return aLength > 0 &&
|
return aLength > 0 &&
|
||||||
(mozilla::unicode::IsClusterExtender(aChars[0]) ||
|
(mozilla::unicode::IsClusterExtenderExcludingJoiners(aChars[0]) ||
|
||||||
(IsBidiControl(aChars[0]) &&
|
(IsBidiControl(aChars[0]) &&
|
||||||
IsSpaceCombiningSequenceTail(aChars + 1, aLength - 1)
|
IsSpaceCombiningSequenceTail(aChars + 1, aLength - 1)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue