make fonts better

Signed-off-by: Xe Iaso <me@xeiaso.net>
This commit is contained in:
Xe Iaso
2023-03-23 14:09:58 -04:00
parent 09abe22e07
commit ad76cfc0be
5 changed files with 142 additions and 26 deletions

1
.envrc Normal file
View File

@@ -0,0 +1 @@
use flake

2
.gitignore vendored
View File

@@ -1,2 +1,2 @@
result
.direnv
result

View File

@@ -60,7 +60,7 @@
set = "aile";
privateBuildPlan = {
family = "Iosevka Aile Iaso";
spacing = "quasi-proportional-extension-only";
spacing = "quasi-proportional";
no-ligation = true;
no-cv-ss = true;
variants = {
@@ -86,14 +86,9 @@
};
};
weights.regular = {
shape = 400;
menu = 400;
css = 400;
};
widths.normal = {
shape = 550;
menu = 7;
css = "expanded";
shape = 300;
menu = 300;
css = 300;
};
inherit metric-override;
};
@@ -144,11 +139,6 @@
menu = 400;
css = 400;
};
widths.normal = {
shape = 600;
menu = 7;
css = "expanded";
};
inherit metric-override;
};
};
@@ -157,6 +147,8 @@
for ttf in ${iosevka-curly}/share/fonts/truetype/*.ttf ${iosevka-aile}/share/fonts/truetype/*.ttf ${iosevka-etoile}/share/fonts/truetype/*.ttf; do
cp $ttf .
echo "processing $ttf"
name=`basename -s .ttf $ttf`
pyftsubset \
$ttf \
@@ -168,14 +160,23 @@
--unicodes="U+0000-00A0,U+00A2-00A9,U+00AC-00AE,U+00B0-00B7,U+00B9-00BA,U+00BC-00BE,U+00D7,U+00F7,U+2000-206F,U+2074,U+20AC,U+2122,U+2190-21BB,U+2212,U+2215,U+F8FF,U+FEFF,U+FFFD"
mv *.ttf ttf
done
${pkgs.zip}/bin/zip ttf.zip ttf/*.ttf
${pkgs.python3}/bin/python3 ${./src/specimen.py}
'';
installPhase = ''
mkdir -p $out
cp *.woff2 $out
cp ttf/*.ttf $out
cp ttf.zip $out
cp ${src/family.css} $out/family.css
cp *.html $out
'';
};
devShells.default = pkgs.mkShell {
buildInputs = [pkgs.python3];
};
});
}

View File

@@ -1,22 +1,36 @@
@font-face {
font-family: "Iosevka Etoile Iaso";
font-weight: 100 900;
src: local("Iosevka Etoile Iaso")
, url("iosevka-etoile-regular.woff2") format("woff2")
, url("iosevka-etoile-italic.woff2") format("woff2");
}
@font-face {
font-family: "Iosevka Aile Iaso";
font-weight: 100 900;
font-style: normal;
src: local("Iosevka Aile Iaso")
, url("iosevka-aile-regular.woff2") format("woff2");
}
@font-face {
font-family: "Iosevka Aile Iaso";
font-weight: 100 900;
font-style: italic;
src: local("Iosevka Aile Iaso")
, url("iosevka-aile-regular.woff2") format("woff2")
, url("iosevka-aile-italic.woff2") format("woff2");
}
@font-face {
font-family: "Iosevka Curly Iaso";
font-weight: 100 900;
src: local("Iosevka Curly Iaso")
, url("iosevka-curly-regular.woff2") format("woff2");
}
@font-face {
font-family: "Iosevka Etoile Iaso";
font-weight: 100 900;
font-style: normal;
src: local("Iosevka Etoile Iaso")
, url("iosevka-etoile-regular.woff2") format("woff2");
}
@font-face {
font-family: "Iosevka Etoile Iaso";
font-weight: 100 900;
font-style: italic;
src: local("Iosevka Etoile Iaso")
, url("iosevka-etoile-italic.woff2") format("woff2");
}

100
src/specimen.py Normal file
View File

@@ -0,0 +1,100 @@
#!/usr/bin/env python
header = '''
<!DOCTYPE html>
<html>
<head>
<title>Iosevka Iaso Specimen</title>
<link type="text/css" rel="stylesheet" href="https://within.website/static/gruvbox.css">
<link type="text/css" rel="stylesheet" href="./family.css">
<style>
.aile {
font-family: "Iosevka Aile Iaso";
font-weight: 400;
}
.curly {
font-family: "Iosevka Curly Iaso";
}
.etoile {
font-family: "Iosevka Etoile Iaso";
}
big {
font-size: xx-large;
}
main {
max-width: 60rem;
}
</style>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body class="snow" id="top">
<main>
<h1 class="etoile">Iosevka Iaso Specimen</h1>
<p class="aile">This page will demonstrate the Iosevka Iaso font family.</p>
<h2 class="etoile">Usage</h2>
<p class="aile">To use this font family, import this CSS:</p>
<code class="curly"><pre>&lt;link rel="stylesheet" href="https://cdn.xeiaso.net/static/css/iosevka/family.css" /&gt;</pre></code>
<p class="aile">Then use the fonts as normal.</p>
'''
footer = '''
<footer>
<p>Xe Iaso</p>
</footer>
</main>
</body>
</html>
'''
blurbs = {
"Aile": "Designed for body text. A quasi-proportional font that evokes moods of the terminal days gone past.",
"Curly": "Designed for code. The hacker's canvas and ink.",
"Etoile": "Designed for titles. A serifed font that oozes modernity and classic sensibilities.",
}
with open("specimen.html", "w") as fout:
fout.write(header)
for family in ["Aile", "Curly", "Etoile"]:
fout.write(f'''
<h2 class="{family.lower()}">{family}</h2>
<p class="{family.lower()}">{blurbs[family]}</p>
<big class="{family.lower()}">Sphinx of black quartz, hear my vow!</big><br />
<big class="{family.lower()}">SPHINX OF BLACK QUARTZ, HEAR MY VOW!</big><br />
<big class="{family.lower()}">sphinx of black quartz, hear my vow!</big><br />
<table class="{family.lower()}"><tr>
''')
i = 0
for ch in range(0x20, 0xA0):
if i == 10:
fout.write("</tr><tr>")
i = 0
fout.write(f'''<td><big>&#x{ch:02x}</big><br />0x{ch:02x}</td>''')
i += 1
for ch in range(0xA2, 0xA9):
if i == 10:
fout.write("</tr><tr>")
i = 0
fout.write(f'''<td><big>&#x{ch:02x}</big><br />0x{ch:02x}</td>''')
i += 1
for ch in range(0xAC, 0xAE):
if i == 10:
fout.write("</tr><tr>")
i = 0
fout.write(f'''<td><big>&#x{ch:02x}</big><br />0x{ch:02x}</td>''')
i += 1
fout.write("</tr></table>")
fout.write(footer)