Prepare for initial release
This commit is contained in:
@@ -155,18 +155,19 @@ else:
|
||||
typo_extent = typo_ascender - typo_descender
|
||||
|
||||
# ── OS/2 Win metrics ─────────────────────────────────────────────────────────
|
||||
# Clipping boundaries on Windows. Must cover every glyph or Windows clips them.
|
||||
# usWinDescent is a *positive* distance below the baseline (unlike Typo/hhea).
|
||||
# Clipping boundaries on Windows. Based on the design ascender/descender
|
||||
# (not the full font bbox, which can be inflated by stacked diacritics like
|
||||
# Aringacute). A small margin prevents clipping of hinting artefacts.
|
||||
|
||||
margin = int(math.ceil(upm * CLIP_MARGIN))
|
||||
win_ascent = int(math.ceil(max(font_ymax, design_top))) + margin
|
||||
win_descent = int(math.ceil(max(abs(font_ymin), abs(design_bot)))) + margin
|
||||
win_ascent = int(math.ceil(design_top)) + margin
|
||||
win_descent = int(math.ceil(abs(design_bot))) + margin
|
||||
|
||||
# ── hhea metrics ──────────────────────────────────────────────────────────────
|
||||
# macOS/iOS always uses hhea for *both* line spacing and clipping (it ignores
|
||||
# USE_TYPO_METRICS). To keep line height consistent across platforms, we fold
|
||||
# the Typo lineGap into hhea ascent/descent so hhea_lineGap can be 0.
|
||||
# Then we take the max with the font bbox to also prevent Mac clipping.
|
||||
# Based on design ascender/descender, not the full font bbox.
|
||||
|
||||
half_gap = typo_linegap // 2
|
||||
extra = typo_linegap - 2 * half_gap # +1 rounding remainder → ascent side
|
||||
@@ -174,8 +175,8 @@ extra = typo_linegap - 2 * half_gap # +1 rounding remainder → ascent sid
|
||||
spacing_asc = typo_ascender + half_gap + extra
|
||||
spacing_dsc = typo_descender - half_gap # more negative
|
||||
|
||||
hhea_ascent = max(spacing_asc, int(math.ceil(font_ymax)) + margin)
|
||||
hhea_descent = min(spacing_dsc, int(math.floor(font_ymin)) - margin) # negative
|
||||
hhea_ascent = max(spacing_asc, int(math.ceil(design_top)) + margin)
|
||||
hhea_descent = min(spacing_dsc, int(math.floor(design_bot)) - margin) # negative
|
||||
hhea_linegap = 0
|
||||
|
||||
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
|
||||
70
scripts/rename.py
Normal file
70
scripts/rename.py
Normal file
@@ -0,0 +1,70 @@
|
||||
"""
|
||||
FontForge: Update font name metadata
|
||||
─────────────────────────────────────
|
||||
Replaces Newsreader references with Readerly in all name table entries
|
||||
and font-level properties.
|
||||
|
||||
Run inside FontForge (or via build.py which sets `f` before running this).
|
||||
"""
|
||||
|
||||
import fontforge
|
||||
|
||||
f = fontforge.activeFont()
|
||||
|
||||
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
# CONFIGURATION
|
||||
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
|
||||
FAMILY = "Readerly"
|
||||
|
||||
# Map style suffixes to weight strings
|
||||
STYLE_MAP = {
|
||||
"Regular": "Regular",
|
||||
"Bold": "Bold",
|
||||
"Italic": "Italic",
|
||||
"BoldItalic": "Bold Italic",
|
||||
}
|
||||
|
||||
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
# DETECT STYLE
|
||||
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
|
||||
# Determine style from the current fontname (e.g. "Readerly-BoldItalic")
|
||||
style_suffix = f.fontname.split("-")[-1] if "-" in f.fontname else "Regular"
|
||||
style_display = STYLE_MAP.get(style_suffix, style_suffix)
|
||||
|
||||
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
# UPDATE FONT PROPERTIES
|
||||
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
|
||||
f.fontname = f"{FAMILY}-{style_suffix}"
|
||||
f.familyname = FAMILY
|
||||
f.fullname = f"{FAMILY} {style_display}"
|
||||
|
||||
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
# UPDATE SFNT NAME TABLE
|
||||
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
|
||||
lang = "English (US)"
|
||||
|
||||
f.appendSFNTName(lang, "Family", FAMILY)
|
||||
f.appendSFNTName(lang, "SubFamily", style_display)
|
||||
f.appendSFNTName(lang, "Fullname", f"{FAMILY} {style_display}")
|
||||
f.appendSFNTName(lang, "PostScriptName", f"{FAMILY}-{style_suffix}")
|
||||
f.appendSFNTName(lang, "Preferred Family", FAMILY)
|
||||
f.appendSFNTName(lang, "Preferred Styles", style_display)
|
||||
f.appendSFNTName(lang, "Compatible Full", f"{FAMILY} {style_display}")
|
||||
f.appendSFNTName(lang, "UniqueID", f"{FAMILY} {style_display}")
|
||||
|
||||
# Clear Newsreader-specific entries
|
||||
f.appendSFNTName(lang, "Trademark", "")
|
||||
f.appendSFNTName(lang, "Manufacturer", "")
|
||||
f.appendSFNTName(lang, "Designer", "")
|
||||
f.appendSFNTName(lang, "Vendor URL", "")
|
||||
f.appendSFNTName(lang, "Designer URL", "")
|
||||
|
||||
count = 0
|
||||
for name in f.sfnt_names:
|
||||
count += 1
|
||||
print(f" Updated {count} name entries for {FAMILY} {style_display}")
|
||||
print("Done.")
|
||||
@@ -24,7 +24,7 @@ f = fontforge.activeFont()
|
||||
# CONFIGURATION
|
||||
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
|
||||
SCALE_X = 1.0
|
||||
SCALE_X = 1.03
|
||||
SCALE_Y = 1.10
|
||||
|
||||
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
|
||||
Reference in New Issue
Block a user