Check if font supports multi code point emoji
See original GitHub issueIβm trying to check if a font has a glyph for a multi codepoint emoji like βπ±πΌββοΈβ, βπ±βπβ or βππΌβ in Python 3.x.
For single codepoint emoji like βπβ or βπβ Iβm able to validate their support via the following code:
from fontTools.ttLib import TTFont
def __isEmojiSupportedByFont(emoji: str) -> bool:
font = TTFont(r"C:\Windows\Fonts\seguiemj.ttf")
emojiCodepoint = ord(str) # Only works for single codepoint emoji
for table in font['cmap'].tables:
for char_code, glyph_name in table.cmap.items():
if char_code == emojiCodepoint:
return True
return False
How do I do this for multi codepoint emoji (is there a method for this), since cmp
only has single codepoint emoji in it?
Link to my stackoverflow question for this.
Issue Analytics
- State:
- Created 4 years ago
- Comments:15
Top Results From Across the Web
Python fonttools: Check if font supports multi codepoint emoji
An easier way to check if an Emoji is supported by a font in python is to use HarfBuzz or more exact harfpy....
Read more >Python fonttools: Check if font supports multi codepoint emoji
I'm trying to check if a font has a glyph for a multi codepoint emoji like "π±πΌββοΈ", "π±βπ" or "ππΌ" in Python 3.x....
Read more >Multi-codepoint emojis Β· Issue #39 Β· jquast/wcwidth - GitHub
Hi,. Can wcwidth help me with multi-codepoint emojis? For instance, here I want to get the cell width for a "woman_mechanic_dark_skin_tone"Β ...
Read more >Everything You Need To Know About Emoji
Units of a coded character set are known as code points. A code point value represents the position of a character in the...
Read more >font-variant-emoji - CSS: Cascading Style Sheets | MDN
The font-variant-emoji CSS property specifies the default presentation style for displaying emojis.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thatβs it! Thank you very much for your help!
And again as reference, my code:
Or
len(buf.glyph_infos) == 1 and buf.glyph_infos[0].codepoint
since the individual characters might not be supported but not the ligature (depending on your definition of supported, the presence of the ligature might be significant or not).