ttf-didact-gothic-hinted
LOW
maintainer gaougalos
0 votes
scanned 2026-11-03 00:04:01.898975
Why flagged
Uploaded within the last 14 days with 2 or fewer community votes — little peer review so far.
Triggered rules
Low
Few votes, recently uploaded
zero_votes_recent
Uploaded within the last 14 days with 2 or fewer community votes — little peer review so far.
PKGBUILD
1
# Maintainer: gaou-piou <i.am.piou@gmail.com>
2
pkgname=ttf-didact-gothic-hinted
3
_gmver=2.101
4
_gfcommit=c741144416d5635d5de832dff8ba09292c112036
5
_nfver=3.5.1
6
pkgver="${_gmver}"
7
pkgrel=1
8
pkgdesc='Didact Gothic (Google Fonts), a single-weight geometric sans with Greek (incl. polytonic) and Cyrillic, optionally re-hinted with ttfautohint for FreeType / Nerd Fonts patched'
9
arch=('any')
10
url='https://fonts.google.com/specimen/Didact+Gothic'
11
license=('OFL-1.1')
12
makedepends=('python' 'python-fonttools' 'fontforge' 'parallel' 'ttfautohint')
13
options=(!strip)
14
provides=('ttf-didact-gothic')
15
conflicts=('ttf-didact-gothic')
16
source=(
17
"DidactGothic-Regular.ttf::https://raw.githubusercontent.com/google/fonts/${_gfcommit}/ofl/didactgothic/DidactGothic-Regular.ttf"
18
"OFL.txt::https://raw.githubusercontent.com/google/fonts/${_gfcommit}/ofl/didactgothic/OFL.txt"
19
"font-patcher-${_nfver}.zip::https://github.com/ryanoasis/nerd-fonts/releases/download/v${_nfver}/FontPatcher.zip"
20
"make_features.py"
21
"set_gasp.py"
22
"measure.py"
23
"README.md"
24
"FEATURES.md"
25
)
26
noextract=("font-patcher-${_nfver}.zip")
27
sha256sums=('b98f9e091b6337a86f4e0f69c94c31905e1e287782853f472e176b4e28d3f81f'
28
'36e2f1debc9778bac79fac1a0cb5a5ef51c102f00b58ef7d8a05324144b68166'
29
'42bcb32145499a35732274c7fc48deb434ad0d2e0e118f98527c1479c6fa251a'
30
'200fc13d7cf288ebd10c2832a0c9e1cf5a8b7c7e4e6283311778a2df7057581e'
31
'0b0464b268525569b5fa28b4735791efb22f22829ad178629776ae3ea82d7f99'
32
'3ad4eb1296ca40b68d32fe5220fe03cb0c8b0d7725b1f179d3df2176430b0ff8'
33
'1de31dc6b0d3f5d8c81754cfa0852b1e54137ef13fb2497ebecec00b16c98f2c'
34
'0c913d31f504a3d28c2749411f03cbdba9f17b6b1181bacbcef1f2928e8479f7')
35
36
# ── What this package does ──────────────────────────────────────────────────
37
#
38
# Didact Gothic (Daniel Johnson, Cyreal; Google Fonts) is a single-weight
39
# (Regular) geometric sans with Latin, Greek (monotonic and polytonic) and
40
# Cyrillic, version 2.101. The source is pinned to the google/fonts commit above.
41
#
42
# Unlike most families in this series, upstream ALREADY ships hinting (fpgm/cvt,
43
# ttfautohint-style bytecode). Measured at hintmedium (README.md section 3) a
44
# re-hint with ttfautohint gives the same result as the upstream bytecode
45
# (natural: dev 12.2 vs 11.9, 0 glued dots, 0 height errors in both), so
46
# HINTING defaults to false and the upstream file is installed untouched.
47
# HINTING=true re-hints with your preset. A Nerd Fonts patch drops the bytecode,
48
# so NERD_PATCH=true defaults HINTING to true.
49
#
50
# FreeType only runs TrueType bytecode at hintstyle hintmedium/hintfull. The
51
# package ships (not enabled) /usr/share/fontconfig/conf.avail/80-$pkgname.conf
52
# that turns it on for the installed family, excluding Chromium/Electron by
53
# prgname (at device scale 1 they round every advance at hintmedium).
54
#
55
# ── Build-time options ───────────────────────────────────────────────────────
56
#
57
# Run from a terminal, prepare() asks for NERD_PATCH, FEATURE_DEFAULTS,
58
# HINTING and HINT_PRESET (Enter keeps the default). Anything already set in the
59
# environment is not asked. Without a TTY the environment / defaults apply.
60
# Answers are saved to $srcdir/.build_opts.
61
#
62
# NERD_PATCH true/false Patch with Nerd Fonts glyphs (default: false).
63
# Patching drops the upstream bytecode, so HINTING
64
# then defaults to true. Family "Didact Gothic Nerd Font
65
# (Mono|Propo)".
66
#
67
# HINTING true/false Re-hint with ttfautohint. Default: false (keep the
68
# upstream bytecode), true with NERD_PATCH=true.
69
#
70
# HINT_PRESET natural|balanced|sharp|light|custom (default: natural)
71
# natural stem=nnn range 8-48 x-height 0 (closest to the
72
# outline; default)
73
# balanced stem=qsq range 8-48 x-height 14 (ttfautohint
74
# defaults; opens
75
# a few more dots,
76
# same dev at 400)
77
# sharp stem=sss range 6-48 x-height 14 (higher dev)
78
# light stem=nnn range 12-48 x-height 0 (HiDPI)
79
# custom use the HINT_* variables below verbatim
80
# Individual knobs (override the preset; empty = preset value):
81
# HINT_MODE HINT_RANGE_MIN HINT_RANGE_MAX HINT_LIMIT HINT_XHEIGHT
82
# HINT_XSNAP_EXC HINT_DEFAULT_SCRIPT HINT_FALLBACK_SCRIPT HINT_WINCOMPAT
83
# HINT_TTFA_TABLE HINT_FAMILY_SUFFIX HINT_INTEGER_PPEM (off: it grows text on
84
# Linux, +16-19% ink at small sizes) GASP_MODE keep|sized|smooth|gridfit
85
#
86
# FEATURE_DEFAULTS "tag,tag,..." (default: empty = leave the fonts alone)
87
# Bake these GSUB features into calt so EVERY renderer applies
88
# them (fontconfig fontfeatures only reaches pango). Didact
89
# Gothic's candidates: case, frac, lnum, onum, sups, ss01 (see
90
# FEATURES.md); liga is already on in every shaper.
91
# make_features.py refuses aalt/ordn/dlig/salt. Few are right for
92
# running text; frac and sups fire inside ordinary words.
93
# FEATURE_DEFAULTS=fonts.conf takes the features that are ACTIVE
94
# (uncommented) in the <match> for family "Didact Gothic" of
95
# ${DG_FONTS_CONF:-~/.config/fontconfig/fonts.conf}. Dropped with
96
# a note: negated tags (-liga), tags the font lacks in GSUB, tags
97
# HarfBuzz always applies (kern liga ccmp locl mark mkmk calt) and
98
# the ones make_features.py refuses (aalt ordn dlig ...).
99
# FEATURE_FAMILY "Name" Install the result under this family instead.
100
#
101
# Examples:
102
# makepkg -si (asks, when run from a terminal)
103
# makepkg -si </dev/null (never asks: defaults only)
104
# HINTING=true makepkg -si
105
# HINT_PRESET=balanced makepkg -si
106
# NERD_PATCH=true makepkg -si
107
# ────────────────────────────────────────────────────────────────────────────
108
109
_opt_keys=(FEATURE_DEFAULTS FEATURE_FAMILY
110
NERD_PATCH
111
HINTING HINT_PRESET HINT_MODE HINT_RANGE_MIN HINT_RANGE_MAX
112
HINT_LIMIT HINT_XHEIGHT HINT_XSNAP_EXC HINT_DEFAULT_SCRIPT
113
HINT_FALLBACK_SCRIPT HINT_WINCOMPAT HINT_TTFA_TABLE
114
HINT_FAMILY_SUFFIX HINT_INTEGER_PPEM GASP_MODE)
115
116
_ask_yn() {
117
local _ans
118
read -r -p " $1? [$2] " _ans || _ans=""
119
[[ "${_ans:-$2}" =~ ^[yY] ]] && _yn=true || _yn=false
120
}
121
122
# _ask_choice TITLE DEFAULT KEY:description ... -> sets _choice to a KEY.
123
_ask_choice() {
124
local _title="$1" _default="$2"; shift 2
125
local -a _items=("$@")
126
local _i _ans
127
echo " $_title:"
128
for _i in "${!_items[@]}"; do
129
printf " %d) %-12s %s%s\n" "$((_i + 1))" "${_items[$_i]%%:*}" "${_items[$_i]#*:}" \
130
"$([[ "${_items[$_i]%%:*}" == "$_default" ]] && echo " (default)")"
131
done
132
while :; do
133
read -r -p " > " _ans || _ans=""
134
if [[ -z "$_ans" ]]; then _choice="$_default"; return; fi
135
if [[ "$_ans" =~ ^[0-9]+$ ]] && (( _ans >= 1 && _ans <= ${#_items[@]} )); then
136
_choice="${_items[$((_ans - 1))]%%:*}"; return
137
fi
138
echo " Enter 1-${#_items[@]}, or press Enter for $_default."
139
done
140
}
141
142
# Prints the bakeable tags active for family "Didact Gothic" in the user's fonts.conf.
143
_features_from_fontsconf() {
144
local _conf="${DG_FONTS_CONF:-${XDG_CONFIG_HOME:-$HOME/.config}/fontconfig/fonts.conf}"
145
if [[ ! -f "$_conf" ]]; then
146
echo "Error: $_conf not found (set DG_FONTS_CONF)." >&2; return 1
147
fi
148
python - "$_conf" "$srcdir/DidactGothic-Regular.ttf" <<'PY'
149
import sys
150
import xml.etree.ElementTree as ET
151
from fontTools.ttLib import TTFont
152
conf, font = sys.argv[1:3]
153
always = {"kern", "liga", "ccmp", "locl", "mark", "mkmk", "calt", "clig", "rlig", "rvrn"}
154
refused = {"aalt", "ordn", "dlig", "salt", "hlig", "hist"}
155
gsub = {r.FeatureTag for r in TTFont(font, lazy=True)["GSUB"].table.FeatureList.FeatureRecord}
156
tags = []
157
for m in ET.parse(conf).getroot().iter("match"):
158
if m.get("target") != "font":
159
continue
160
if not any(t.get("name") == "family" and (t.findtext("string") or "").strip() == "Didact Gothic"
161
for t in m.findall("test")):
162
continue
163
for e in m.findall("edit"):
164
if e.get("name") != "fontfeatures":
165
continue
166
for st in e.findall("string"):
167
tag = (st.text or "").strip()
168
why = None
169
if tag.startswith("-"): why = "negated"
170
elif tag in always: why = "already applied by every shaper"
171
elif tag in refused: why = "refused by make_features.py"
172
elif tag not in gsub: why = "not a GSUB feature of the font"
173
if why:
174
print(f" note: fonts.conf: '{tag}' skipped ({why})", file=sys.stderr)
175
elif tag not in tags:
176
tags.append(tag)
177
print(",".join(tags))
178
PY
179
}
180
181
_prompt_options() {
182
if [[ -t 0 ]]; then
183
echo ""
184
echo " $pkgname: build options (Enter = default)"
185
echo ""
186
if [[ -z "${NERD_PATCH:-}" ]]; then
187
_ask_yn "Patch with Nerd Fonts glyphs (forces static fonts)" n; NERD_PATCH=$_yn
188
fi
189
if [[ "${FEATURE_DEFAULTS+set}" != set ]]; then
190
echo ""
191
echo " A font cannot declare a feature \"on by default\"; baking moves its lookups"
192
echo " into calt, which every program applies (see the header of this PKGBUILD)."
193
_ask_choice "Bake features into calt" none \
194
"none:leave the fonts as upstream ships them (default)" \
195
"fonts.conf:the features active for \"Didact Gothic\" in ~/.config/fontconfig/fonts.conf" \
196
"custom:type the tag list yourself"
197
case $_choice in
198
none) FEATURE_DEFAULTS="" ;;
199
fonts.conf) FEATURE_DEFAULTS="fonts.conf" ;;
200
custom)
201
echo " Tags, comma or space separated (e.g. \"case,frac\"):"
202
read -r -p " > " _tags || _tags=""
203
_tags="${_tags//[[:space:]]/,}"
204
while [[ "$_tags" == *,,* ]]; do _tags="${_tags//,,/,}"; done
205
_tags="${_tags#,}"; _tags="${_tags%,}"
206
FEATURE_DEFAULTS="$_tags" ;;
207
esac
208
fi
209
if [[ -z "${HINTING:-}" ]]; then
210
echo " Upstream already ships hinting; re-hinting measured the same (README.md)."
211
if [[ "$NERD_PATCH" == true ]]; then
212
_ask_yn "Hint with ttfautohint (n = unhinted; patching removed upstream hints)" y
213
else
214
_ask_yn "Re-hint with ttfautohint (n = keep upstream hints)" n
215
fi
216
HINTING=$_yn
217
fi
218
if [[ "$HINTING" == true && -z "${HINT_PRESET:-}" ]]; then
219
_ask_choice "Hinting preset" natural \
220
"natural:stem n, 8-48px, no x-height boost (closest to the design)" \
221
"balanced:stem q, 8-48px (opens the dots, a few more dots open)" \
222
"sharp:stem s, 6-48px (highest contrast, higher dev)" \
223
"light:stem n, 12-48px, no x-height boost (HiDPI)" \
224
"custom:use the HINT_* environment variables"
225
HINT_PRESET=$_choice
226
fi
227
echo ""
228
else
229
echo "==> Non-interactive build (no TTY): using environment variables / defaults."
230
fi
231
232
if [[ "${FEATURE_DEFAULTS:-}" == fonts.conf ]]; then
233
FEATURE_DEFAULTS="$(_features_from_fontsconf)" || exit 1
234
echo "==> FEATURE_DEFAULTS from fonts.conf: ${FEATURE_DEFAULTS:-<none>}"
235
fi
236
237
local _k
238
: > "$srcdir/.build_opts"
239
for _k in "${_opt_keys[@]}"; do
240
# "set" rather than non-empty: HINT_XSNAP_EXC="" differs from unset.
241
if [[ "${!_k+set}" == set ]]; then
242
printf '%s=%s\n' "$_k" "${!_k}" >> "$srcdir/.build_opts"
243
fi
244
done
245
}
246
247
# makepkg runs build() and package() in separate shells, so both call this.
248
_resolve_options() {
249
local _k _v
250
if [[ ! -f "$srcdir/.build_opts" ]]; then
251
echo "Error: $srcdir/.build_opts missing; run a full makepkg (prepare() writes it)." >&2
252
exit 1
253
fi
254
while IFS='=' read -r _k _v; do
255
if [[ " ${_opt_keys[*]} " == *" $_k "* ]]; then
256
printf -v "$_k" '%s' "$_v"
257
fi
258
done < "$srcdir/.build_opts"
259
260
FEATURE_DEFAULTS="${FEATURE_DEFAULTS:-}"
261
FEATURE_FAMILY="${FEATURE_FAMILY:-}"
262
NERD_PATCH="${NERD_PATCH:-false}"
263
if [[ "$NERD_PATCH" == true ]]; then HINTING="${HINTING:-true}"; else HINTING="${HINTING:-false}"; fi
264
HINT_PRESET="${HINT_PRESET:-natural}"
265
GASP_MODE="${GASP_MODE:-keep}"
266
HINT_WINCOMPAT="${HINT_WINCOMPAT:-false}"
267
HINT_TTFA_TABLE="${HINT_TTFA_TABLE:-false}"
268
HINT_INTEGER_PPEM="${HINT_INTEGER_PPEM:-false}"
269
HINT_DEFAULT_SCRIPT="${HINT_DEFAULT_SCRIPT:-latn}"
270
HINT_FALLBACK_SCRIPT="${HINT_FALLBACK_SCRIPT:-latn}"
271
272
for _v in NERD_PATCH HINTING HINT_WINCOMPAT HINT_TTFA_TABLE HINT_INTEGER_PPEM; do
273
case "${!_v}" in
274
true|false) ;;
275
*) echo "Error: $_v='${!_v}' must be true or false." >&2; exit 1 ;;
276
esac
277
done
278
for _v in ${FEATURE_DEFAULTS//,/ }; do
279
if [[ ! "$_v" =~ ^[A-Za-z0-9]{4}$ ]]; then
280
echo "Error: FEATURE_DEFAULTS: '$_v' is not a feature tag (e.g. case)." >&2
281
exit 1
282
fi
283
done
284
local _m _lo _hi _xh
285
case "$HINT_PRESET" in
286
natural) _m=nnn; _lo=8; _hi=48; _xh=0 ;;
287
balanced) _m=qsq; _lo=8; _hi=48; _xh=14 ;;
288
sharp) _m=sss; _lo=6; _hi=48; _xh=14 ;;
289
light) _m=nnn; _lo=12; _hi=48; _xh=0 ;;
290
custom) _m=nnn; _lo=8; _hi=48; _xh=0 ;;
291
*)
292
echo "Error: unknown HINT_PRESET='$HINT_PRESET'." >&2
293
echo " Valid: natural balanced sharp light custom" >&2
294
exit 1 ;;
295
esac
296
HINT_MODE="${HINT_MODE:-$_m}"
297
HINT_RANGE_MIN="${HINT_RANGE_MIN:-$_lo}"
298
HINT_RANGE_MAX="${HINT_RANGE_MAX:-$_hi}"
299
HINT_LIMIT="${HINT_LIMIT:-$HINT_RANGE_MAX}"
300
HINT_XHEIGHT="${HINT_XHEIGHT:-$_xh}"
301
302
if [[ ! "$HINT_MODE" =~ ^[nqs]{3}$ ]]; then
303
echo "Error: HINT_MODE='$HINT_MODE' must be 3 chars from n/q/s (e.g. nnn)." >&2
304
exit 1
305
fi
306
for _v in HINT_RANGE_MIN HINT_RANGE_MAX HINT_LIMIT HINT_XHEIGHT; do
307
if [[ ! "${!_v}" =~ ^[0-9]+$ ]]; then
308
echo "Error: $_v='${!_v}' must be a non-negative integer." >&2; exit 1
309
fi
310
done
311
if (( HINT_RANGE_MIN > HINT_RANGE_MAX )); then
312
echo "Error: HINT_RANGE_MIN ($HINT_RANGE_MIN) > HINT_RANGE_MAX ($HINT_RANGE_MAX)." >&2
313
exit 1
314
fi
315
for _v in HINT_DEFAULT_SCRIPT HINT_FALLBACK_SCRIPT; do
316
if [[ ! "${!_v}" =~ ^[a-z0-9]{3,4}$ ]]; then
317
echo "Error: $_v='${!_v}' must be a script tag (e.g. latn, none)." >&2; exit 1
318
fi
319
done
320
case "$GASP_MODE" in
321
keep|sized|smooth|gridfit) ;;
322
*) echo "Error: GASP_MODE='$GASP_MODE' invalid (keep|sized|smooth|gridfit)." >&2; exit 1 ;;
323
esac
324
}
325
326
prepare() {
327
_prompt_options
328
_resolve_options # validate now, so a typo fails before the long steps
329
330
rm -rf "$srcdir/font-patcher"
331
if [[ "$NERD_PATCH" == true ]]; then
332
mkdir -p "$srcdir/font-patcher"
333
bsdtar xf "$srcdir/font-patcher-${_nfver}.zip" -C "$srcdir/font-patcher"
334
fi
335
}
336
337
# _bake_features SRCDIR: move the lookups of FEATURE_DEFAULTS into calt into
338
# $srcdir/featured. Last step on purpose: ttfautohint never sees them.
339
_bake_features() {
340
local _src="$1" _fam=()
341
[[ -n "$FEATURE_DEFAULTS" ]] || return 0
342
[[ -n "$FEATURE_FAMILY" ]] && _fam=(--family "$FEATURE_FAMILY")
343
echo "==> Baking $FEATURE_DEFAULTS into calt" \
344
"${FEATURE_FAMILY:+(installed as '$FEATURE_FAMILY')}..."
345
python "$srcdir/make_features.py" --features "$FEATURE_DEFAULTS" \
346
"${_fam[@]+"${_fam[@]}"}" -o "$srcdir/featured" "$_src"/*.ttf
347
}
348
349
build() {
350
_resolve_options
351
352
echo "==> Options: nerd=$NERD_PATCH hinting=$HINTING"
353
if [[ "$HINTING" == true ]]; then
354
echo "==> ttfautohint: preset=$HINT_PRESET stem=$HINT_MODE" \
355
"range=$HINT_RANGE_MIN-$HINT_RANGE_MAX limit=$HINT_LIMIT x-height=$HINT_XHEIGHT" \
356
"x-snap-exc='${HINT_XSNAP_EXC-<default>}' gasp=$GASP_MODE integer-ppem=$HINT_INTEGER_PPEM" \
357
"ttfa-table=$HINT_TTFA_TABLE${HINT_FAMILY_SUFFIX:+ suffix='$HINT_FAMILY_SUFFIX'}"
358
fi
359
360
rm -rf "$srcdir/selected" "$srcdir/patched" "$srcdir/hinted" "$srcdir/featured"
361
mkdir -p "$srcdir/selected" "$srcdir/patched" "$srcdir/hinted"
362
363
# ── Step 1: select ──────────────────────────────────────────────────────────
364
install -m644 "$srcdir/DidactGothic-Regular.ttf" "$srcdir/selected/DidactGothic-Regular.ttf"
365
local _count
366
_count=$(find "$srcdir/selected" -name '*.ttf' | wc -l)
367
echo "==> Selected $_count font file(s)."
368
369
local _hintsrc="$srcdir/selected"
370
371
# ── Step 2: Nerd Fonts patching ─────────────────────────────────────────────
372
# Patch first, hint afterwards: font-patcher does not keep hint bytecode.
373
if [[ "$NERD_PATCH" == true ]]; then
374
echo "==> Patching with Nerd Fonts glyphs (this takes a while)..."
375
find "$srcdir/selected" -type f | sort | \
376
parallel --will-cite -j"$(nproc)" python "$srcdir/font-patcher/font-patcher" \
377
--variable-width-glyphs -q -c {} -out "$srcdir/patched" '>/dev/null'
378
_count=$(find "$srcdir/patched" -maxdepth 1 -name '*.ttf' | wc -l)
379
if (( _count == 0 )); then
380
echo "Error: font-patcher produced no output. See messages above." >&2; exit 1
381
fi
382
echo "==> Patched $_count font(s)."
383
_hintsrc="$srcdir/patched"
384
fi
385
386
if [[ "$HINTING" != true ]]; then
387
_bake_features "$_hintsrc"
388
return 0
389
fi
390
391
# ── Step 3: ttfautohint ─────────────────────────────────────────────────────
392
local -a _ta_opts=(
393
--hinting-range-min="$HINT_RANGE_MIN"
394
--hinting-range-max="$HINT_RANGE_MAX"
395
--hinting-limit="$HINT_LIMIT"
396
--increase-x-height="$HINT_XHEIGHT"
397
--stem-width-mode="$HINT_MODE"
398
--default-script="$HINT_DEFAULT_SCRIPT"
399
--ignore-restrictions
400
)
401
if [[ "$NERD_PATCH" == true ]]; then
402
_ta_opts+=(--fallback-script=none --fallback-scaling)
403
else
404
_ta_opts+=(--fallback-script="$HINT_FALLBACK_SCRIPT")
405
fi
406
if [[ "${HINT_XSNAP_EXC+set}" == set ]]; then
407
_ta_opts+=(--x-height-snapping-exceptions="$HINT_XSNAP_EXC")
408
fi
409
if [[ "$HINT_WINCOMPAT" == true ]]; then _ta_opts+=(--windows-compatibility); fi
410
if [[ -n "${HINT_FAMILY_SUFFIX:-}" ]]; then _ta_opts+=(--family-suffix="$HINT_FAMILY_SUFFIX"); fi
411
if [[ "$HINT_TTFA_TABLE" == true ]]; then _ta_opts+=(--ttfa-table); else _ta_opts+=(--no-info); fi
412
413
# Serial on purpose: GNU parallel splits arguments that contain spaces.
414
echo "==> Hinting with ttfautohint..."
415
local _f
416
for _f in "$_hintsrc"/*.ttf; do
417
ttfautohint "${_ta_opts[@]}" "$_f" "$srcdir/hinted/${_f##*/}"
418
done
419
420
if [[ "$HINT_INTEGER_PPEM" == true ]]; then
421
echo "==> Setting head.flags bit 3 (integer ppem)..."
422
python - "$srcdir/hinted/"*.ttf <<'PY'
423
import sys
424
from fontTools.ttLib import TTFont
425
for path in sys.argv[1:]:
426
font = TTFont(path)
427
font["head"].flags |= 1 << 3
428
font.save(path)
429
PY
430
fi
431
432
if [[ "$GASP_MODE" != keep ]]; then
433
echo "==> Applying gasp mode '$GASP_MODE'..."
434
python "$srcdir/set_gasp.py" "$GASP_MODE" "$srcdir/hinted/"*.ttf
435
fi
436
437
_bake_features "$srcdir/hinted"
438
}
439
440
package() {
441
_resolve_options
442
443
local _out="$srcdir/selected"
444
if [[ "$HINTING" == true ]]; then
445
_out="$srcdir/hinted"
446
elif [[ "$NERD_PATCH" == true ]]; then
447
_out="$srcdir/patched"
448
fi
449
if [[ -n "$FEATURE_DEFAULTS" ]]; then _out="$srcdir/featured"; fi
450
if ! compgen -G "$_out/*.ttf" >/dev/null; then
451
echo "Error: no fonts to install in $_out." >&2; exit 1
452
fi
453
local _fontdir="$pkgdir/usr/share/fonts/didact-gothic"
454
install -Dm644 -t "$_fontdir" "$_out/"*.ttf
455
install -Dm644 "$srcdir/OFL.txt" "$pkgdir/usr/share/licenses/$pkgname/OFL.txt"
456
457
# Opt-in rendering tweak: bytecode hinting for the families this build
458
# installed. Shipped in conf.avail and deliberately not enabled.
459
if [[ "$HINTING" == true || "$NERD_PATCH" != true ]]; then
460
local _avail="$pkgdir/usr/share/fontconfig/conf.avail"
461
install -d "$_avail"
462
local _fam _conf="$_avail/80-$pkgname.conf"
463
local _chromium_prgnames=(chrome chromium brave helium electron code slack signal-desktop vesktop)
464
local _prg _prgtests=""
465
for _prg in "${_chromium_prgnames[@]}"; do
466
_prgtests+=" <test qual=\"all\" name=\"prgname\" compare=\"not_eq\"><string>$_prg</string></test>"$'\n'
467
done
468
{
469
echo '<?xml version="1.0" encoding="UTF-8"?>'
470
echo '<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">'
471
echo "<!-- Installed by $pkgname. NOT enabled by default. Enable with:"
472
echo ""
473
echo " sudo ln -s /usr/share/fontconfig/conf.avail/80-$pkgname.conf /etc/fonts/conf.d/"
474
echo ""
475
echo " Use the ttfautohint bytecode hints in these fonts rather than"
476
echo " FreeType's light autohinter. hintmedium, not hintfull: same rendering"
477
echo " in cairo/pango, and Blink keeps subpixel positioning at hintmedium."
478
echo " Chromium and Electron apps are excluded: at device scale 1 they use"
479
echo " linear advances only for hintslight/none, so hintmedium would round"
480
echo " every glyph advance to a whole pixel (uneven letter gaps)."
481
echo " Firefox also rounds advances at hintmedium unless"
482
echo " gfx.text.subpixel-position.force-enabled is true. See README.md. -->"
483
echo '<fontconfig>'
484
while IFS= read -r _fam; do
485
_fam="${_fam//&/&}"; _fam="${_fam//</<}"
486
cat <<EOF
487
<match target="font">
488
<test name="family" compare="eq"><string>$_fam</string></test>
489
${_prgtests%$'\n'}
490
<edit name="hinting" mode="assign"><bool>true</bool></edit>
491
<edit name="autohint" mode="assign"><bool>false</bool></edit>
492
<edit name="hintstyle" mode="assign"><const>hintmedium</const></edit>
493
</match>
494
EOF
495
done < <(python - "$_fontdir/"*.ttf <<'PY' | sort -u
496
import sys
497
from fontTools.ttLib import TTFont
498
for path in sys.argv[1:]:
499
name = TTFont(path, lazy=True)["name"]
500
print(name.getDebugName(16) or name.getDebugName(1))
501
PY
502
)
503
echo '</fontconfig>'
504
} > "$_conf"
505
chmod 644 "$_conf"
506
fi
507
508
install -Dm644 -t "$pkgdir/usr/share/doc/$pkgname" "$srcdir/README.md" "$srcdir/FEATURES.md"
509
}
510
Scan history
| Scanned at (UTC) | Severity | Rules |
|---|---|---|
| 2026-11-03 00:04:01 | Low | 1 |