File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 9494# (gray) is the one that matters. n=natural, q=quantized, s=strong.
9595# - Remaining two chars are for GDI and DirectWrite (not used on Kobo).
9696# - Other options are left at ttfautohint defaults; uncomment to override.
97+ AUTOHINT_CTRL = os .path .join (SRC_DIR , "ttfautohint-ctrl.txt" )
9798AUTOHINT_OPTS = [
9899 "--no-info" ,
99- "--stem-width-mode=qss " ,
100+ "--stem-width-mode=nss " ,
100101 # "--hinting-range-min=8",
101102 # "--hinting-range-max=50",
102103 # "--hinting-limit=200",
@@ -772,8 +773,11 @@ def autohint_ttf(ttf_path):
772773 return
773774
774775 tmp_path = ttf_path + ".autohint.tmp"
776+ opts = list (AUTOHINT_OPTS )
777+ if os .path .isfile (AUTOHINT_CTRL ) and os .path .getsize (AUTOHINT_CTRL ) > 0 :
778+ opts += [f"--control-file={ AUTOHINT_CTRL } " ]
775779 result = subprocess .run (
776- ["ttfautohint" ] + AUTOHINT_OPTS + [ttf_path , tmp_path ],
780+ ["ttfautohint" ] + opts + [ttf_path , tmp_path ],
777781 capture_output = True , text = True ,
778782 )
779783 if result .returncode != 0 :
Original file line number Diff line number Diff line change 1+ # ttfautohint control instructions for Readerly
2+ # See: https://freetype.org/ttfautohint/doc/ttfautohint.html
3+ #
4+ # Syntax reference:
5+ # glyph_name left|right point_idx [(left_offset, right_offset)]
6+ # → create artificial one-point segment (fixes serif detection)
7+ # glyph_name touch points yshift N @ ppems
8+ # → shift points vertically at specific sizes (in 1/8 pixel units)
9+ # glyph_name nodir points
10+ # → remove points from segment detection
11+ #
12+ # Add entries below for glyphs with serif hinting issues.
13+ # Use `ttfautohint --debug -l N -r N font.ttf out.ttf` to inspect
14+ # segment/edge detection at a specific PPEM size.
You can’t perform that action at this time.
0 commit comments