Last active
October 8, 2024 07:16
-
-
Save ravshansbox/fa3e5423e5f00d7ac9ba9ed39840252a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fontforge | |
import sys | |
import math | |
if len(sys.argv) != 8: | |
print("Usage: python italicize.py <input-font> <output-font> <font-name> <family-name> <full-name> <font-weight> <italic-degree>") | |
sys.exit(1) | |
input_font = sys.argv[1] | |
output_font = sys.argv[2] | |
font_name = sys.argv[3] | |
family_name = sys.argv[4] | |
full_name = sys.argv[5] | |
font_weight = sys.argv[6] | |
italic_degree = float(sys.argv[7]) | |
font = fontforge.open(input_font) | |
slant_value = math.tan(math.radians(italic_degree)) | |
font.selection.all() | |
font.transform((1, 0, slant_value, 1, 0, 0)) | |
font.fontname = font_name | |
font.familyname = family_name | |
font.fullname = full_name | |
font.weight = font_weight | |
font.generate(output_font) | |
font.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment