windowspython-2.7fontsironpython

Given a font and a specific character, is there a way to tell which subrange the character belongs to?


I need to determine if a given character in a given font belongs to a given subrange. For example, U+0041 according to Windows Character Map app belongs to the Latin Subrange. Is there a way to get this using Python 2.7 (or more precisely IronPython 2.7)?

enter image description here

Sincerely; Michelle


Solution

  • I don't know of a way to do this easily in Python.

    The solution I would recommend would be to compare a character's code point value against the block ranges supplied directly from the Unicode character database.

    You can download the most recent version of the block ranges from the following link: https://www.unicode.org/Public/UCD/latest/ucd/Blocks.txt