Skip to content

Instantly share code, notes, and snippets.

@frankrolf
Created June 20, 2019 07:50
Show Gist options
  • Save frankrolf/44ebc3c8157bef1591e0174d95fe09a6 to your computer and use it in GitHub Desktop.
Save frankrolf/44ebc3c8157bef1591e0174d95fe09a6 to your computer and use it in GitHub Desktop.
Source Serif scale values
f = CurrentFont()
x_height_scale = 1.05
ascender_scale = 0.98
descender_scale = 0.88
hor_scale_factor_lc = 1.12
hor_scale_factor_uc = 1.1
lime = (0.502, 1.0, 0.0, 1.0)
f.info.xHeight = int(round(x_height_scale * f.info.xHeight))
f.info.ascender = int(round(ascender_scale * f.info.ascender))
f.info.descender = int(round(descender_scale * f.info.descender))
for g_name in 'abcdefghijklmnopqrstuvwxyz':
g = f[g_name]
g.scaleBy((hor_scale_factor_lc, x_height_scale), origin=(0, 0))
g.width = int(round(g.width * hor_scale_factor_lc))
g.mark = lime
for g_name in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ':
g = f[g_name]
g.scaleBy((hor_scale_factor_uc, 1), origin=(0, 0))
g.width = int(round(g.width * hor_scale_factor_uc))
g.mark = lime
f = CurrentFont()
x_height_scale = .95
ascender_scale = 1.01
descender_scale = 1.08
hor_scale_factor_lc = .91
hor_scale_factor_uc = .94
lime = (0.502, 1.0, 0.0, 1.0)
f.info.xHeight = int(round(x_height_scale * f.info.xHeight))
f.info.ascender = int(round(ascender_scale * f.info.ascender))
f.info.descender = int(round(descender_scale * f.info.descender))
for g_name in 'abcdefghijklmnopqrstuvwxyz':
g = f[g_name]
g.scaleBy((hor_scale_factor_lc, x_height_scale), origin=(0, 0))
g.width = int(round(g.width * hor_scale_factor_lc))
g.mark = lime
for g_name in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ':
g = f[g_name]
g.scaleBy((hor_scale_factor_uc, 1), origin=(0, 0))
g.width = int(round(g.width * hor_scale_factor_uc))
g.mark = lime
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment