Search code examples
unicodefontsrastermeasure

Unifont & UnicodeData.txt how do I deduce if character is full or half width (x-advance)


Is there reliable way for determining if glyph in unifont is half width like latin characters (ie all in chart 0002) which take left half space only or full width like character 0x06E9 (from chart 0006)?

Pixel analysis is not good solution for me as it would fail on many characters like spaces.

I'd prefer to use information from UnicodeData.txt:

http://www.unicode.org/Public/UNIDATA/UnicodeData.txt

Unfortunately I'm not able to find good match between unifont and any field from data.

Chart 0002: http://unifoundry.com/png/plane00/uni0002.png enter image description here

Chart 0006: http://unifoundry.com/png/plane00/uni0006.png enter image description here


Solution

  • Looks like you'll need the source code '.hex' for the version of unifont you're using and the appropriate versions of the Unicode Utilities from [1]. 'unigenwidth' [2] seems to generate code related to the width of characters in Unifont; perhaps you'll need to write a parser to look through that code and give you what you want?

    [1] http://unifoundry.com/unicode-utilities.html

    [2] http://manpages.ubuntu.com/manpages/trusty/man1/unigenwidth.1.html