Skip to content

Instantly share code, notes, and snippets.

@htruong
Created January 11, 2012 20:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save htruong/1596735 to your computer and use it in GitHub Desktop.
Save htruong/1596735 to your computer and use it in GitHub Desktop.
Font Forge Glyph Stripper
#!/usr/bin/fontforge
/* --------------- (c) 2012 Huan Truong ---------------- */
/* Sexy script to strip unused glyphs from ttf file. */
/* ----------------------------------------------------- */
Open($argv[1]);
SelectNone();
/* Basic Latin */
SelectMore(0u00, 0u7f);
/* Latin 1 Supplements */
SelectMore(0u80, 0uff);
/* Latin Ext A */
SelectMore(0u0100, 0u017F);
/* Latin Ext B */
SelectMore(0u0180, 0u024f);
/* IPA Ext */
SelectMore(0u0250, 0u02af);
/* Spacing Modifiers */
SelectMore(0u02B0, 0u02ff);
/* Letterlike Symbols */
SelectMore(0u2100, 0u214f);
/* Greek/Coptic */
SelectMore(0u0370, 0u03ff);
/* Cyrillic */
SelectMore(0u0400, 0u04ff);
/* Cyrillic Supplemental */
SelectMore(0u0500, 0u052f);
/* Superscripts and Subscripts */
SelectMore(0u2070, 0u209F);
/* Currency Symbols */
SelectMore(0u20A0, 0u20CF);
/* Other Latin / Vietnamese gplyphs */
SelectMore(0u102, 0u103);
SelectMore(0u110, 0u111);
SelectMore(0u128, 0u129);
SelectMore(0u168, 0u169);
SelectMore(0u1a0, 0u1b0);
SelectMore(0u1ea0, 0u1ef9);
SelectMore(0u2c6, 0u323);
SelectInvert();
Cut();
/* SetFontNames("Font-Family-Regular", "Font Name", "Font Family Regular", "Regular", "Copyright"); */
Generate($argv[2], "", 4/* remove bitmap */);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment