I create a lot of online ads where I create the texts as graphics (PNG) before I load them into HYPE. Now I would like to load a custom font into HYPE, which is no problem. Since the font file is saved with a complete set of glyphs when exported, I thought there might be a way to include "subsetting for fonts" in an export script? The fonts used should only contain the letters that actually appear in the banner. I was thinking of "Glyphhanger" or the Fontsquirrel API. Does anyone have any ideas on how to implement this?
Thank you very much.
Here's a starting point to do this in Python which could be run via a Hype Export Script if anyone want to run with this.
# start by installing fontforge with brew install fontforge
import fontforge
# Open the TTF font
font = fontforge.open('/path/to/your/font.ttf')
# Clear current selection
font.selection.none()
# Select glyphs for "My Headline"
for char in "My Headline":
font.selection.select(('more',), ord(char))
# Invert the selection to select everything but "My Headline"
font.selection.invert()
# Delete the selected glyphs
font.clear()
# Save the font as a new file
font.generate('/path/to/your/modified_font.ttf')
# Close the font
font.close()
Thank you very much for your answers. I know I could reduce the font characters manually using various tools. Since I will be creating over 100 banners, this is a big (time) effort. I therefore thought that this could be included in the export script.
I will follow Daniel's approach and adapt the export script. In addition, the query for the text used should be made in the index.html so that the letters used do not have to be entered manually each time.