Sha256: ec7a945872d5485347f4e8c2ff234416e8a3abd9b304c19cbad758baf69cbc7e

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

Contents

#!/usr/bin/python
import fontforge
import utils

SPACE_UNICODE_ID = 0x20
NB_SPACE_UNICODE_ID = 0xA0
NB_SPACE_NAME = "uni00A0"

parsed = utils.parse_input()
assert parsed.has_key('input_filename'), "Input Filename Required"
assert parsed.has_key('output_filename'), "Output Filename Required"


# Iterate over every gylph in the font and remove it if it's not in the
# included list. This is done because we can preserve the other information in
# the font such as ligatures and kerning (without doing complicated things like
# copying).
try:
    source = fontforge.open(parsed['input_filename'])
    original_metrics = utils.original_metrics(source)
    glyphs = {}
    for glyph in source.glyphs():
        glyphs[glyph.unicode] = glyph
    utils.lossless_save(original_metrics, source, parsed["output_filename"])
except EnvironmentError, e:
    # Apparently font forge chokes on some fonts, fun
    utils.complete({'status' : 'Failure', 'message' : str(e)})
else:
    # Tells ruby we are finished
    utils.complete({'status' : 'Success'})

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fontprocessor-27.1.3 lib/fontprocessor/external/fontforge/subset.py