commit af1e2e1414ceebf2335dd430602b2c502484f0db Author: syui Date: Mon Mar 30 11:33:44 2026 +0900 init diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..1a904ee --- /dev/null +++ b/LICENSE @@ -0,0 +1,12 @@ +aifont is built from the following components: + +## Meslo LG (Base font) +Apache License 2.0 +https://github.com/andreberg/Meslo-Font + +## Nerd Fonts (Icon patches) +MIT License +https://github.com/ryanoasis/nerd-fonts + +## ai.svg, syui.svg (Custom icons) +Created by syui diff --git a/aifont.py b/aifont.py new file mode 100755 index 0000000..ba23f55 --- /dev/null +++ b/aifont.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python3 +import subprocess, sys, os + +# download MesloLGS NF +meslo = "/tmp/MesloLGS NF Regular.ttf" +if not os.path.exists(meslo): + meslo_url = "https://github.com/ryanoasis/nerd-fonts/releases/latest/download/Meslo.tar.xz" + subprocess.run(["curl", "-sL", "-o", "/tmp/Meslo.tar.xz", meslo_url], check=True) + subprocess.run(["tar", "xf", "/tmp/Meslo.tar.xz", "-C", "/tmp", "MesloLGSNerdFont-Regular.ttf"], check=True) + os.rename("/tmp/MesloLGSNerdFont-Regular.ttf", meslo) + +# download SVG icons +base = "https://git.syui.ai/ai/app/raw/branch/main/icon" +for name in ["ai.svg", "syui.svg"]: + subprocess.run(["curl", "-sL", "-o", f"/tmp/{name}", f"{base}/{name}"], check=True) + +subprocess.run(["fontforge", "-script", "/dev/stdin"], input=b""" +import fontforge + +icons = fontforge.font() +icons.em = 1024 + +glyph = icons.createChar(0xE001, "ai") +glyph.importOutlines("/tmp/ai.svg") +glyph.width = 1024 + +glyph = icons.createChar(0xE002, "syui") +glyph.importOutlines("/tmp/syui.svg") +glyph.width = 1024 + +icons.generate("/tmp/icons.ttf") +icons.close() + +font = fontforge.open("/tmp/MesloLGS NF Regular.ttf") +font.selection.select(0xE001) +font.clear() +font.selection.select(0xE002) +font.clear() +font.selection.none() + +font.mergeFonts("/tmp/icons.ttf") + +font.fontname = "aifont" +font.familyname = "aifont" +font.fullname = "aifont" +font.appendSFNTName("English (US)", "Family", "aifont") +font.appendSFNTName("English (US)", "SubFamily", "Regular") +font.appendSFNTName("English (US)", "UniqueID", "aifont-regular") +font.appendSFNTName("English (US)", "Fullname", "aifont") +font.appendSFNTName("English (US)", "PostScriptName", "aifont") +font.appendSFNTName("English (US)", "Preferred Family", "aifont") +font.appendSFNTName("English (US)", "Preferred Styles", "Regular") + +font.generate("/tmp/aifont.ttf") +font.close() +print("done: /tmp/aifont.ttf") +""", check=True) diff --git a/aifont.ttf b/aifont.ttf new file mode 100644 index 0000000..6f10f18 Binary files /dev/null and b/aifont.ttf differ