Skip to content

Commit 3cfb531

Browse files
committed
enable anchor on xkcd-script-mono
modify _make_lslash add .notdef glyph
1 parent b6c7ae4 commit 3cfb531

12 files changed

Lines changed: 484 additions & 97 deletions
268 KB
Binary file not shown.

xkcd-script/font/xkcd-script-mono.sfd

Lines changed: 379 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
3.85 KB
Binary file not shown.
1.63 KB
Binary file not shown.

xkcd-script/font/xkcd-script.otf

7.93 KB
Binary file not shown.

xkcd-script/font/xkcd-script.sfd

Lines changed: 74 additions & 71 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

xkcd-script/font/xkcd-script.ttf

1.16 KB
Binary file not shown.

xkcd-script/font/xkcd-script.woff

-88 Bytes
Binary file not shown.

xkcd-script/generator/pt5_svg_to_font.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,9 @@ def fit_glyph(c, line, position, bbox, fname, chars):
381381
c = font.createMappedChar(32)
382382
c.width = 256
383383

384+
c = font[".notdef"]
385+
c.addReference("numbersign")
386+
c.addReference("at")
384387

385388
# ---------------------------------------------------------------------------
386389
# Glyphs imported from xkcd comic images

xkcd-script/generator/pt6_derived_chars.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -469,10 +469,16 @@ def _accented(cp, base_name, mark_name, gap=20, x_adj=0):
469469
_make_accented(font, cp, base, '_caron_mark')
470470

471471
# ď ť ľ (lowercase) / Ľ (uppercase): raised apostrophe to the right.
472-
_make_dstroke(font, 0x010F, 'd', gap=-30)
473-
_make_dstroke(font, 0x0165, 't', gap=-50)
474-
_make_dstroke(font, 0x013E, 'l', gap=-50, width_extra=80)
475-
_make_dstroke(font, 0x013D, 'L', gap=-50, dy_offset=100, width_extra=80)
472+
if bodyname == 'xkcd-script-mono':
473+
_make_dstroke(font, 0x010F, 'd', gap=-80)
474+
_make_dstroke(font, 0x0165, 't', gap=-100)
475+
_make_dstroke(font, 0x013E, 'l', gap=-140, width_extra=40)
476+
_make_dstroke(font, 0x013D, 'L', gap=-140, dy_offset=100, width_extra=40)
477+
else:
478+
_make_dstroke(font, 0x010F, 'd', gap=-30)
479+
_make_dstroke(font, 0x0165, 't', gap=-50)
480+
_make_dstroke(font, 0x013E, 'l', gap=-50, width_extra=80)
481+
_make_dstroke(font, 0x013D, 'L', gap=-50, dy_offset=100, width_extra=80)
476482

477483
# ---------------------------------------------------------------------------
478484
# L with stroke: Ł U+0141 / ł U+0142
@@ -507,23 +513,26 @@ def _make_l_crossbar_mark(font, name, bar_width, rotation=0):
507513

508514

509515
def _make_lslash(font, cp, base_name, crossbar_name, y_frac, x_center):
510-
"""L-with-stroke: base glyph + crossbar mark at (x_center, y_frac * height)."""
516+
"""L-with-stroke: base glyph + crossbar mark at (x_center, y_frac * height).
517+
518+
The x-direction is based on the bounding box, and the y-direction is based on the font baseline.
519+
"""
511520
c = font.createMappedChar(cp)
512521
c.clear()
513522
c.addReference(base_name)
514523
c.width = font[base_name].width
515524
base_bb = font[base_name].boundingBox()
516525
target_y = base_bb[1] + (base_bb[3] - base_bb[1]) * y_frac
517-
c.addReference(crossbar_name, psMat.translate(x_center, target_y))
526+
c.addReference(crossbar_name, psMat.translate(base_bb[0] + x_center, target_y))
518527
return c
519528

520529

521530
_l_crossbar = _make_l_crossbar_mark(font, '_l_crossbar', bar_width=300, rotation=40)
522531

523532
# Ł U+0141 — crossbar at 42% of cap height, centered on the vertical stroke (x≈75)
524-
_make_lslash(font, 0x0141, 'L', '_l_crossbar', y_frac=0.42, x_center=75)
533+
_make_lslash(font, 0x0141, 'L', '_l_crossbar', y_frac=0.42, x_center=55)
525534
# ł U+0142 — crossbar at 60% of ascender height, l's stroke is at x≈75
526-
_make_lslash(font, 0x0142, 'l', '_l_crossbar', y_frac=0.60, x_center=75)
535+
_make_lslash(font, 0x0142, 'l', '_l_crossbar', y_frac=0.60, x_center=55)
527536

528537

529538
# ---------------------------------------------------------------------------

0 commit comments

Comments
 (0)