TextService needs a method to check if a font supports a specific character

The Font class or TextService service in Roblox need to have a method IsCharacterSupported to handle checking if a specific character is not supported by a font.

e.g:

Font:IsCharacterSupported(string): boolean

or

TextService:IsCharacterSupported(string, Font): boolean

Alternatively the IsCharacterSupported function could take a utf8 codepoint instead of a string.

Currently it is too difficult to be able to check for every single font and what characters they support. To block unsupported characters in Montserrat, you have to manually find ranges and characters you need to block and then check against the utf8 codepoint of the character

e.g:

local kBlockedRanges = { 
	{0x10140, 0x1018F}, -- Ancient Greek numerals
	{0x1D2E0, 0x1D2FF}, -- Ancient Mayan numerals
	{0x13000, 0x1342F}, -- Egyptian Hieroglyphs
	{0x10400, 0x1044F}, -- Deseret
	{0x10500, 0x1052F}, -- Shavian
	{0x10A00, 0x10A5F}, -- Kharoshthi
	{0x3400,  0x4DBF},  -- CJK Ideographs Extension A
	{0x2F800, 0x2FA1F}, -- CJK Ideographs Extension C
	{0x20000, 0x2A6DF}, -- CJK Ideographs Extension B
	{0x1D400, 0x1D7FF}, -- Mathematical Alphanumeric Symbols
	{0x2C00,  0x2C5F},  -- Glagolitic
	{0x0800,  0x083F},  -- Samaritan
	{0x1200,  0x137F},  -- Ethiopic
	{0x0B80,  0x0BFF},  -- Tamil
	{0xA000,  0xA48F},  -- Yi Syllables
	{0x1F780, 0x1F7FF}, -- Geometric Shapes Extended
	{0xE000,  0xF8FF},  -- Private Use Area
	{0x10300, 0x1032F}, -- Old Persian
	{0x10C00, 0x10C4F}, -- Old Turkic (added so that "𐰀" is caught)
	{0x1800,  0x18AF},  -- Mongolian
	{0x16A0,  0x16FF},  -- Runic
	{0x2FF0, 0x2FFF},  -- Ideographic Description Characters
	{0x1D000, 0x1D0FF}, -- Byzantine Musical Symbols
	{0x1D100, 0x1D1FF}, -- Musical Symbols
	{0x16800, 0x16A3F}, -- Bamum Supplement
	{0x104B0, 0x104FF}, -- Osage
	{0x1BC00, 0x1BC9F}, -- Duployan
	{0x10080, 0x100FF}, -- Linear B Ideograms
	{0x10000, 0x1007F}, -- Linear B Syllabary
	{0x109A0, 0x109FF}, -- Meroitic Cursive
	{0x10980, 0x1099F}, -- Meroitic Hieroglyphs
	{0x10A60, 0x10A7F}, -- Old South Arabian
	{0x10A80, 0x10A9F}, -- Old North Arabian
	{0x10920, 0x1093F}, -- Lydian
	{0x10280, 0x1029F}, -- Lycian
	{0x102A0, 0x102DF}, -- Carian
	{0x10B80, 0x10BAF}, -- Avestan
	{0x10AC0, 0x10AFF}, -- Manichaean
	{0x10B60, 0x10B7F}, -- Inscriptional Pahlavi
	{0x10B40, 0x10B5F}, -- Inscriptional Parthian
	{0x10840, 0x1085F}, -- Imperial Aramaic
	{0x10350, 0x1037F}, -- Old Permic
	{0x10330, 0x1034F}, -- Gothic
	{0x14400, 0x1467F}, -- Anatolian Hieroglyphs
	{0x12400, 0x1247F}, -- Cuneiform Numbers and Punctuation
	{0x12000, 0x123FF}, -- Cuneiform
	{0x2700, 0x27BF}, -- Dingbats
	{0x2580, 0x259F}, -- Block Elements
	{0x25A0, 0x25FF}, -- Geometric Shapes
	{0x2200, 0x22FF}, -- Mathematical Operators
	{0x1EE00, 0x1EEFF}, -- Arab mathematical alphabetical symbols
	{0x2980, 0x29FF}, -- Miscellaneous Mathematical Symbols-B
	{0x27C0, 0x27EF}, -- Miscellaneous Mathematical Symbols-A
	{0x2A00, 0x2AFF}, -- Supplemental Mathematical Operators
	{0x1D400, 0x1D7FF}, -- Mathematical Alphanumeric Symbols
	{0x2F800, 0x2FA1F}, -- CJK Compatibility Ideographs Supplement
	{0x2CEB0, 0x2EBEF}, -- CJK Ideographs Extension F
	{0x2B820, 0x2CEAF}, -- CJK Ideographs Extension E
	{0x2B740, 0x2B81F}, -- CJK Ideographs Extension D
	{0x07C0, 0x07FF}, -- N'Ko Alphabet
	{0x1B80, 0x1BBF}, -- Sundanese
	{0x10840, 0x1085F}, -- Aramaic
	{0x0530, 0x058F}, -- Armenian
	{0x1400, 0x167F}, -- Canadian Scripts
	{0x1740, 0x175F}, -- Buhid
	{0x1400, 0x167F}, -- Carrier
	{0x11100, 0x1114F}, -- Chakma 
	{0xAA00, 0xAA5F}, -- Cham
	{0x13A0, 0x13FF}, -- Cherokee
	{0x2C80, 0x2CFF}, -- Coptic
	{0x1400, 0x167F}, -- Cree
	{0x0900, 0x097F}, -- Devanagari
	{0x0B00, 0x0B7F}, -- Odia
	{0x11D60, 0x11DAF}, -- Gunjala Gondi
	{0x0A00, 0x0A7F}, -- Gurmukhi 
	{0x1720, 0x173F}, -- Hanunó'o
	{0x0C80, 0x0CFF}, -- Kannada
	{0x0E80, 0x0EFF}, -- Lao
	{0x1900, 0x194F}, -- Limbu
	{0x0D00, 0x0D7F}, -- Malayalam
	{0x1E800, 0x1E8DF}, -- Mende Kikakui
	{0x1680, 0x169F}, -- Ogham
	{0x1C50, 0x1C7F}, -- Ol Chiki
	{0x10480, 0x104AF}, -- Osmanya
	{0x0F00, 0x0FFF}, -- Tibetan
	{0x110D0, 0x110FF}, -- Sorang Sompeng
	{0xA800, 0xA82F}, -- Sylheti
	{0x1760, 0x177F}, -- Tagbanwa
	{0xAA80, 0xAADF}, -- Tai Viet
	{0x0C00, 0x0C7F}, -- Telugu 
	{0x0780, 0x07BF} -- Thaana
}

function Unicode.isUnsupportedCodepoint(codepoint)
	for _, range in kBlockedRanges do
		if codepoint >= range[1] and codepoint <= range[2] then
			return true
		end
	end

	return false
end
20 Likes

In RoCitizens, we want to ensure that our Roleplay names are reflective of real names. Ex: no %, #, @. It would be a very great addition of instead of blacklisting lots of ascii characters, we could use the non-text rendering unicode characters as a baseline blacklist to avoid those boxes from rendering on our nameplates.

6 Likes