Icomoon manifest parser¶
- class icomoon.store.WebfontStore(manifest_filename)[source]¶
Webfont store to collect every given manifest.
Store assume every webfont manifest file are located inside their webfont directory set in their
fontdir_pathoption.Store does not create any file, it just parse manifest and store icon maps.
Manifest filename is the same for every webfont, it is given as
WebfontStoreinit argumentmanifest_filename, commonlyselection.json.- Parameters:
manifest_filename (string) – Manifest filename to search for in webfont directory.
- parse_manifest(fp)[source]¶
Open manifest JSON file and build icon map
- Parameters:
fp (string or fileobject) – Either manifest filepath to open or manifest File object.
- Returns:
Webfont icon map. Contains:
class_name: Builded icon classname with prefix configured in manifest (from parameters in Icomoon interface);int: Icon integer code like59649;hex: Icon hexadecimal code like0xe901;unicode: Icon unicode likeU+E901;utf8: Icon UTF8 code like\e901;
- Return type:
dict
- get(webfont_name, webfont_settings)[source]¶
Get a manifest file, parse and store it.
- Parameters:
webfont_name (string) – Webfont key name. Used to store manifest and potentially its parser error.
webfont_settings (dict) – Webfont settings (an item value from
settings.ICOMOON_WEBFONTS).