<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Unicode Category of Glyph]]></title><description><![CDATA[<p dir="auto">Hey there,</p>
<p dir="auto">I am looking for the best/easiest way to get the unicode and the unicode category of a glyph. The unicode itself is part of the RGlyph object, but not the unicode category, right?</p>
<p dir="auto">I tried investigating <a class="plugin-mentions-user plugin-mentions-a" href="https://forum.robofont.com/uid/20">@erik</a>’s <a href="https://github.com/LettError/glyphNameFormatter" rel="nofollow">glyphNameFormatter</a> and <a class="plugin-mentions-user plugin-mentions-a" href="https://forum.robofont.com/uid/75">@jens</a>’ <a href="https://github.com/jenskutilek/RFUnicodeInfo" rel="nofollow">RFUnicodeInfo</a>, but did not find the right thing yet. Should I be looking elsewhere?</p>
<p dir="auto">Thanks in advance for your help!</p>
]]></description><link>https://forum.robofont.com/topic/522/unicode-category-of-glyph</link><generator>RSS for Node</generator><lastBuildDate>Tue, 14 Jul 2026 19:36:19 GMT</lastBuildDate><atom:link href="https://forum.robofont.com/topic/522.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 16 Oct 2018 11:50:32 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Unicode Category of Glyph on Tue, 16 Oct 2018 13:04:29 GMT]]></title><description><![CDATA[<p dir="auto">Hey there,</p>
<p dir="auto">I am looking for the best/easiest way to get the unicode and the unicode category of a glyph. The unicode itself is part of the RGlyph object, but not the unicode category, right?</p>
<p dir="auto">I tried investigating <a class="plugin-mentions-user plugin-mentions-a" href="https://forum.robofont.com/uid/20">@erik</a>’s <a href="https://github.com/LettError/glyphNameFormatter" rel="nofollow">glyphNameFormatter</a> and <a class="plugin-mentions-user plugin-mentions-a" href="https://forum.robofont.com/uid/75">@jens</a>’ <a href="https://github.com/jenskutilek/RFUnicodeInfo" rel="nofollow">RFUnicodeInfo</a>, but did not find the right thing yet. Should I be looking elsewhere?</p>
<p dir="auto">Thanks in advance for your help!</p>
]]></description><link>https://forum.robofont.com/post/1769</link><guid isPermaLink="true">https://forum.robofont.com/post/1769</guid><dc:creator><![CDATA[benedikt]]></dc:creator><pubDate>Tue, 16 Oct 2018 13:04:29 GMT</pubDate></item><item><title><![CDATA[Reply to Unicode Category of Glyph on Tue, 16 Oct 2018 13:37:00 GMT]]></title><description><![CDATA[<p dir="auto">hello <a class="plugin-mentions-user plugin-mentions-a" href="https://forum.robofont.com/uid/245">@benedikt</a></p>
<p dir="auto">to get the unicode for a glyph you can use <a href="http://robofont.com/documentation/building-tools/api/fontParts/rglyph/#RGlyph.autoUnicodes" rel="nofollow">RGlyph.autoUnicodes</a>.</p>
<p dir="auto">to get unicode categories I would try using the data provided by the Unicode Consortium. I’ve found these:</p>
<ul>
<li><a href="http://www.unicode.org/notes/tn36/" rel="nofollow">A Categorization of Unicode Characters</a></li>
<li><a href="http://www.unicode.org/notes/tn36/Categories.txt" rel="nofollow">Categories.txt</a></li>
</ul>
<p dir="auto">you can write a script to load data from <code>Categories.txt</code>, and then search for the unicode value to get its category.</p>
<p dir="auto">hope this helps! let us know if it works…</p>
]]></description><link>https://forum.robofont.com/post/1770</link><guid isPermaLink="true">https://forum.robofont.com/post/1770</guid><dc:creator><![CDATA[gferreira]]></dc:creator><pubDate>Tue, 16 Oct 2018 13:37:00 GMT</pubDate></item><item><title><![CDATA[Reply to Unicode Category of Glyph on Tue, 16 Oct 2018 16:42:27 GMT]]></title><description><![CDATA[<p dir="auto">there’s a catch: in order look up the category, you’ll need to convert the unicode value from integer to hex:</p>
<pre><code class="language-python"># load categories data from txt file
filePath = '/Users/gferreira/Desktop/Categories.txt'
with open(filePath, 'r') as f:
    rawData = f.readlines()

# convert raw data into dict
categories = {}
for line in rawData:
    uni, gc, level1, level2, level3, level4, name = line.split('\t')
    categories[uni] = level1, level2, level3, level4

# get unicode for glyph
g = CurrentGlyph()
g.autoUnicodes()
print(g.name)
print(g.unicode)

if g.unicode is not None:

    # convert unicode integer to hexadecimal
    uni = "%X" % g.unicode
    uni = uni.zfill(4)
    print(uni)

    # get category for unicode value
    if uni in categories:
        print(categories[uni])
</code></pre>
<pre><code class="language-console">&gt;&gt;&gt; fi
&gt;&gt;&gt; 64257
&gt;&gt;&gt; FB01
&gt;&gt;&gt; ('Letter', 'Ligature', '', '')
</code></pre>
]]></description><link>https://forum.robofont.com/post/1771</link><guid isPermaLink="true">https://forum.robofont.com/post/1771</guid><dc:creator><![CDATA[gferreira]]></dc:creator><pubDate>Tue, 16 Oct 2018 16:42:27 GMT</pubDate></item><item><title><![CDATA[Reply to Unicode Category of Glyph on Tue, 16 Oct 2018 18:44:12 GMT]]></title><description><![CDATA[<p dir="auto">I guess glyphNameFormatter has the data you are looking for :)</p>
<pre><code class="language-python">from glyphNameFormatter import GlyphName

g = GlyphName(65)
print(g.uniRangeName)
g = GlyphName(1234)
print(g.uniRangeName)
</code></pre>
]]></description><link>https://forum.robofont.com/post/1773</link><guid isPermaLink="true">https://forum.robofont.com/post/1773</guid><dc:creator><![CDATA[frederik]]></dc:creator><pubDate>Tue, 16 Oct 2018 18:44:12 GMT</pubDate></item><item><title><![CDATA[Reply to Unicode Category of Glyph on Tue, 16 Oct 2018 21:06:21 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.robofont.com/uid/1">@frederik</a> this returns the unicode <strong>range</strong> for a glyph, not the unicode <strong>category</strong> :)</p>
<p dir="auto">for example, the first codepoint in your script belongs to the <code>Basic Latin</code> range, and the second to <code>Cyrillic</code>. but both glyphs belong to the category <code>Letter</code>.</p>
]]></description><link>https://forum.robofont.com/post/1775</link><guid isPermaLink="true">https://forum.robofont.com/post/1775</guid><dc:creator><![CDATA[gferreira]]></dc:creator><pubDate>Tue, 16 Oct 2018 21:06:21 GMT</pubDate></item><item><title><![CDATA[Reply to Unicode Category of Glyph on Wed, 17 Oct 2018 07:23:31 GMT]]></title><description><![CDATA[<p dir="auto">try:</p>
<pre><code class="language-python">from glyphNameFormatter.data import unicodeCategories

print(unicodeCategories[65])
</code></pre>
]]></description><link>https://forum.robofont.com/post/1777</link><guid isPermaLink="true">https://forum.robofont.com/post/1777</guid><dc:creator><![CDATA[frederik]]></dc:creator><pubDate>Wed, 17 Oct 2018 07:23:31 GMT</pubDate></item><item><title><![CDATA[Reply to Unicode Category of Glyph on Fri, 19 Oct 2018 11:43:47 GMT]]></title><description><![CDATA[<p dir="auto">Wow, awesome. That’s exactly what I was looking for. Thanks for the pointers!</p>
]]></description><link>https://forum.robofont.com/post/1780</link><guid isPermaLink="true">https://forum.robofont.com/post/1780</guid><dc:creator><![CDATA[benedikt]]></dc:creator><pubDate>Fri, 19 Oct 2018 11:43:47 GMT</pubDate></item><item><title><![CDATA[Reply to Unicode Category of Glyph on Tue, 14 May 2019 18:40:17 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.robofont.com/uid/245">@benedikt</a><br />
FWIW, the <code>glyphNameFormatter</code> in RF has a couple of functions that might be useful. It uses the <code>glyphNamesToUnicodeAndCategories.txt</code> names list which is buried somewhere in RF. This is not the full unicode list (I think CJ and K is not included), but it contains a lot of good stuff.</p>
<pre><code class="language-python">import glyphNameFormatter.reader
name = "flyingSaucer"
value = 0x1F6F8

# unicode to name
print(glyphNameFormatter.reader.u2n(value))
&gt; "flyingSaucer"

# name to unicode
print(glyphNameFormatter.reader.n2u(name))
&gt; 128760

# unicode to category
print(glyphNameFormatter.reader.u2c(value))
&gt; "So"

# name to category
print(glyphNameFormatter.reader.n2c(name))
&gt; "So"
</code></pre>
]]></description><link>https://forum.robofont.com/post/1785</link><guid isPermaLink="true">https://forum.robofont.com/post/1785</guid><dc:creator><![CDATA[erik]]></dc:creator><pubDate>Tue, 14 May 2019 18:40:17 GMT</pubDate></item></channel></rss>