Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified xkcd-script/font/xkcd-script.otf
Binary file not shown.
3,536 changes: 2,685 additions & 851 deletions xkcd-script/font/xkcd-script.sfd

Large diffs are not rendered by default.

Binary file modified xkcd-script/font/xkcd-script.ttf
Binary file not shown.
Binary file modified xkcd-script/font/xkcd-script.woff
Binary file not shown.
Binary file added xkcd-script/generator/ai_extensions_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions xkcd-script/generator/pt4_additional_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ def extract_symbol(arr, y0, y1, x0, x1, name, exclude=None):
('lambda', '1145_sky_color_2x__lambda'), # λ U+03BB source
('tau', '2520_symbols_2x__tau'), # τ U+03C4 source
('varsigma', '2586_greek_letters_2x__sigma'), # ς U+03C2 source
('AElig', '2763_linguistics_gossip_2x__AE'), # Æ U+00C6 source
]

print('Extracting hand-drawn extras...')
Expand All @@ -166,3 +167,22 @@ def extract_symbol(arr, y0, y1, x0, x1, name, exclude=None):
arr_extra = np.array(Image.open(src_path).convert('L'))
h, w = arr_extra.shape
extract_symbol(arr_extra, 0, h, 0, w, name)


# ---------------------------------------------------------------------------
# ai_extensions_1.png — hand-drawn ligatures and IPA letters
# Coordinates measured from the 1774×887 px image.
# ---------------------------------------------------------------------------

AI_EXT_1 = {
# name y0 y1 x0 x1
'OElig': (155, 358, 835, 1107), # Œ U+0152
'aelig': (225, 357, 1363, 1515), # æ U+00E6
'oelig': (223, 354, 1582, 1750), # œ U+0153
}

_ai_ext_1_image = os.path.join(os.path.dirname(__file__), 'ai_extensions_1.png')
print(f'Extracting ligatures from {_ai_ext_1_image}...')
arr_ai1 = np.array(Image.open(_ai_ext_1_image).convert('L'))
for name, (y0, y1, x0, x1) in AI_EXT_1.items():
extract_symbol(arr_ai1, y0, y1, x0, x1, name)
25 changes: 25 additions & 0 deletions xkcd-script/generator/pt5_svg_to_font.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,31 @@ def _import_comic_glyph(font, name, svg_path, target_top, weight_delta=0):
_ch.width = _cap_eszett_glyph.width


# Æ/æ/Œ/œ — hand-drawn sources from ai_extensions_1.png.
# Œ is capital height; æ and œ are x-height.
for _name, _cp, _ref in [
('AElig', 0x00C6, 'A'), # Æ — capital
('OElig', 0x0152, 'O'), # Œ — capital
('aelig', 0x00E6, 'a'), # æ — lowercase
('oelig', 0x0153, 'o'), # œ — lowercase
]:
_svg = os.path.join(_COMIC_CHARS_DIR, f'{_name}.svg')
_target_top = font[_ref].boundingBox()[3]
_g = _import_comic_glyph(font, _name, _svg, target_top=_target_top, weight_delta=20)
_bb = _g.boundingBox()
if _bb[1] != 0:
_g.transform(psMat.translate(0, -_bb[1]))
_bb = _g.boundingBox()
if _bb[3] > 0:
_g.transform(psMat.scale(_target_top / _bb[3]))
_g.width = int(round(_g.boundingBox()[2] + 20))
_ch = font.createMappedChar(_cp)
_ch.clear()
for c in _g.foreground:
_ch.foreground += c
_ch.width = _g.width


# ---------------------------------------------------------------------------
# Save
# ---------------------------------------------------------------------------
Expand Down
Binary file modified xkcd-script/samples/charmap_latin_1_supplement.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified xkcd-script/samples/charmap_latin_extended_a.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading