Last active
May 28, 2024 13:22
-
-
Save delagreen-v2/3214855b9246f8878360e6e7b0215f72 to your computer and use it in GitHub Desktop.
is_empty_unicode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from fontTools.ttLib import TTFont | |
| def is_empty_unicode(path_to_ttf, symbol): | |
| font = TTFont(path_to_ttf) | |
| cmap = font['cmap'].getBestCmap() | |
| unicodes = [chr(k) for k in cmap.keys()] | |
| if symbol in unicodes: | |
| return True | |
| else: | |
| return False | |
| print(is_empty_unicode( | |
| '/home/astraadmin/Desktop/rep/drawing_text_recognition/new/tesseract-tutorial/fonts/gost_2.304_italic.ttf', '`' | |
| )) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment