encoding

Unicode tools, glyph name to hex/uni conversion etc.

all_glyphs(groups_dict)[source]
auto_unicode(g)[source]

Automatically set unicode value(s) for the specified glyph.

The method uses RoboFab’s glyph.autoUnicodes() function for common glyphs, and complements it with additional values from unicodes_extra.

auto_unicodes(font)[source]

Automatically set unicode values for all glyphs in the font.

Parameters:font (RFont) – The font as an RFont object.
char2glyphname(char)[source]

Get the PostScript glyph name for a given unicode character.

chars2glyphnames(char_list)[source]

Get a list of PostScript glyph names for a list of unicode characters.

clear_unicodes(font)[source]

Remove unicodes from all glyphs in the font.

Parameters:font (RFont) – The font as an RFont object.
crop_glyphset(font, glyph_names)[source]
import_encoding(file_path)[source]

Import glyph names from an encoding file.

Parameters:file_path (str) – The path to the encoding file.
Returns:A list of glyph names, or None if the file does not exist.
import_groups_from_encoding(file_path)[source]

Import group and glyphs names from an encoding file.

Parameters:file_path (str) – The path to the encoding file.
Returns:A dictionary of groups (keys) and glyph names (values), and a list with the order of the groups; or None if the file does not exist.
paint_groups(font, crop=False)[source]

Paint the glyphs in the font according to their groups.

If a groups_order lib is available, it is used to set the order of the glyphs in the font.

Parameters:font (RFont) – The font as an RFont object.
unicode_hexstr_to_int(hexUnicode, replaceUni=True)[source]

Converts a unicode hexadecimal value into an integer.

It does exactly the reverse of unicode_int_to_hexstr.

unicode_int_to_hexstr(intUnicode, _0x=False, uni=False)[source]

Converts unicode integers to hexadecimal.

See also the reverse function unicode_hexstr_to_int.

Note that glyph.unicodes is a list (a glyph can have many unicodes), so we need to pass the first value only.

The optional parameters uni and _0x add the respective prefixes.

Previous topic

color

Next topic

fileutils

This Page