Compare commits

...

6 Commits

Author SHA1 Message Date
caad673733 31.6.1 2024-09-10 14:52:47 +03:00
98e564e9ad 31.4.1 2024-08-28 12:03:11 +03:00
065784f373 Путь к файлам 2024-08-28 12:02:27 +03:00
4d1e80cec4 30.3.0 2024-06-24 13:20:50 +03:00
69d448d38f 26.0.0 2023-08-05 08:19:20 +03:00
ded8ca449c 25.1.1 2023-07-24 15:03:27 +03:00
5 changed files with 184 additions and 31 deletions

View File

@ -12,13 +12,17 @@ v:
dist: $(BUILD_DIR)/iosevka-prog-$(V).tar.xz dist: $(BUILD_DIR)/iosevka-prog-$(V).tar.xz
$(BUILD_DIR)/iosevka-prog-$(V).tar.xz: $(BUILD_DIR)/iosevka-prog/ttf/*.ttf $(BUILD_DIR)/iosevka-prog-$(V).tar.xz: $(BUILD_DIR)/IosevkaProg/TTF/iosevka-prog-$(V)/*.ttf
cd $(BUILD_DIR)/iosevka-prog/ttf; tar Jcf $(BUILD_DIR)/iosevka-prog-$(V).tar.xz *.ttf cd $(BUILD_DIR)/iosevka-prog/ttf/iosevka-prog-$(V); tar Jcf $(BUILD_DIR)/iosevka-prog-$(V).tar.xz *.ttf
$(BUILD_DIR)/iosevka-prog-nerd-$(V).tar.xz: $(BUILD_DIR)/IosevkaProg/TTF/iosevka-prog-nerd-$(V)/*.ttf
cd $(BUILD_DIR)/iosevka-prog/ttf/iosevka-prog-nerd-$(V); tar Jcf $(BUILD_DIR)/iosevka-prog-nerd-$(V).tar.xz *.ttf
upload: dist upload: dist
git tag $(V) git tag $(V)
gitea-tea r c --repo f1x1t/iosevka-prog-font-builder -t $(V) --tag $(V) \ gitea-tea r c --repo f1x1t/iosevka-prog-font-builder -t $(V) --tag $(V) \
-a $(BUILD_DIR)/iosevka-prog-$(V).tar.xz -a $(BUILD_DIR)/iosevka-prog-$(V).tar.xz \
-a $(BUILD_DIR)/iosevka-prog-nerd-$(V).tar.xz
git tag -d $(V) git tag -d $(V)
git push git push

View File

@ -4,13 +4,14 @@
В основе лежит моноширинный шрифт [Iosevka](https://github.com/be5invis/Iosevka/) и В основе лежит моноширинный шрифт [Iosevka](https://github.com/be5invis/Iosevka/) и
встраиваемый в шрифт набор иконок [Nerd Fonts](https://www.nerdfonts.com/). встраиваемый в шрифт набор иконок [Nerd Fonts](https://www.nerdfonts.com/).
Для сборки требуется установка [Docker](https://www.docker.com/): Для сборки требуется установка [Docker](https://www.docker.com/) и библиотека
для работы со шрифтами [fonttools](https://pypi.org/project/fonttools/):
```sh ```sh
sudo apt-get install docker.io sudo apt-get install docker.io python3-fonttools
``` ```
Сборка шрифта выполняется командой `make`, результат сохраняется в каталог `dist`. Сборка шрифта выполняется командой `make`, результат сохраняется в каталог `dist`.
Готовый шрифт версии [22.1.2](../../../releases/download/22.1.2/iosevka-prog-22.1.2.tar.xz). Готовый шрифт версии [31.6.1](../../../releases/download/31.6.1/iosevka-prog-31.6.1.tar.xz).

View File

@ -2,32 +2,46 @@
set -e set -e
IOSEVKA_VERSION=22.1.2 IOSEVKA_VERSION=31.6.1
FONT_NAME=iosevka-prog FONT_NAME=IosevkaProg
FILE=$( readlink -f "${BASH_SOURCE[0]}" ) FILE=$( readlink -f "${BASH_SOURCE[0]}" )
DIR=$( dirname "${FILE}" ) DIR=$( dirname "${FILE}" )
DIST="${DIR}/dist" DIST="${DIR}/dist"
OBLIQUE="${DIST}/oblique" OBLIQUE="${DIST}/Oblique"
REGULAR="${DIST}/regular" REGULAR="${DIST}/Regular"
CONFIG="${DIR}/private-build-plans.toml" CONFIG="${DIR}/private-build-plans.toml"
OUT_DIR="${DIST}/${FONT_NAME}/ttf" OUT_DIR="${DIST}/${FONT_NAME}/TTF"
if [ -r "${CONFIG}" ]; then if [ -r "${CONFIG}" ]; then
if command -v docker >/dev/null 2>&1; then if command -v docker >/dev/null 2>&1; then
docker pull avivace/iosevka-build wget -c https://github.com/be5invis/Iosevka/archive/refs/tags/v${IOSEVKA_VERSION}.tar.gz
docker pull nerdfonts/patcher tar axf v${IOSEVKA_VERSION}.tar.gz
docker run -e FONT_VERSION="${IOSEVKA_VERSION}" -it -v "$DIR":/build avivace/iosevka-build ttf::${FONT_NAME} pushd Iosevka-${IOSEVKA_VERSION}/docker
docker build -t=iosevka-builder .
popd
rm -rf Iosevka-${IOSEVKA_VERSION} v${IOSEVKA_VERSION}.tar.gz
docker pull cdalvaro/docker-nerd-fonts-patcher:latest
docker run -e FONT_VERSION="${IOSEVKA_VERSION}" -it -v "$DIR":/work iosevka-builder ttf::${FONT_NAME}
sudo chown -R "$(id -u)":"$(id -g)" "${DIST}" sudo chown -R "$(id -u)":"$(id -g)" "${DIST}"
mkdir -p "${OBLIQUE}" mkdir -p "${OBLIQUE}"
cp -af "${OUT_DIR}/${FONT_NAME}-oblique.ttf" "${OBLIQUE}" cp -af "${OUT_DIR}/${FONT_NAME}-Oblique.ttf" "${OBLIQUE}"
docker run -v "${OBLIQUE}":/in -v "${OUT_DIR}":/out nerdfonts/patcher --complete --careful --adjust-line-height --makegroups || true docker run --rm -v "${OBLIQUE}":/in -v "${OUT_DIR}":/out nerdfonts/patcher --complete --adjust-line-height --makegroups 1
mkdir -p "${REGULAR}" mkdir -p "${REGULAR}"
cp -af "${OUT_DIR}/${FONT_NAME}-regular.ttf" "${REGULAR}" cp -af "${OUT_DIR}/${FONT_NAME}-Regular.ttf" "${REGULAR}"
docker run -v "${REGULAR}":/in -v "${OUT_DIR}":/out nerdfonts/patcher --complete --careful --adjust-line-height --makegroups --mono --removeligatures || true docker run --rm -v "${REGULAR}":/in -v "${OUT_DIR}":/out nerdfonts/patcher --complete --adjust-line-height --makegroups 1 --mono --removeligatures
sudo chown -R "$(id -u)":"$(id -g)" "${DIST}"
cd "${OUT_DIR}" cd "${OUT_DIR}"
tar acf "${DIST}/fonts-iosevka-prog-nerd_${IOSEVKA_VERSION}.orig.tar.xz" Iosevka*Nerd*ttf python3 "${DIR}/fontname.py" "Iosevka Prog Nerd Font" IosevkaProgNerdFont-Oblique.ttf
tar acf "${DIST}/fonts-iosevka-prog_${IOSEVKA_VERSION}.orig.tar.xz" iosevka*ttf python3 "${DIR}/fontname.py" "Iosevka Prog Nerd Font Mono" IosevkaProgNerdFontMono-Regular.ttf
tar acf "${DIST}/iosevka-prog-${IOSEVKA_VERSION}.tar.xz" *ttf mkdir -p "iosevka-prog-nerd-$IOSEVKA_VERSION"
mv Iosevka*Nerd*ttf "iosevka-prog-nerd-$IOSEVKA_VERSION"
tar acf "${DIST}/iosevka-prog-nerd-${IOSEVKA_VERSION}.tar.xz" "iosevka-prog-nerd-$IOSEVKA_VERSION"
mkdir -p "iosevka-prog-$IOSEVKA_VERSION"
mv Iosevka*ttf "iosevka-prog-$IOSEVKA_VERSION"
tar acf "${DIST}/iosevka-prog-${IOSEVKA_VERSION}.tar.xz" "iosevka-prog-$IOSEVKA_VERSION"
cd "${DIST}"
ln -s "iosevka-prog-nerd-${IOSEVKA_VERSION}.tar.xz" "fonts-iosevka-prog-nerd_${IOSEVKA_VERSION}.orig.tar.xz"
ln -s "iosevka-prog-${IOSEVKA_VERSION}.tar.xz" "fonts-iosevka-prog_${IOSEVKA_VERSION}.orig.tar.xz"
else else
echo "Docker executable not found" echo "Docker executable not found"
fi fi

134
fontname.py Normal file
View File

@ -0,0 +1,134 @@
#!/usr/bin/env python3
# ==========================================================================
# fontname.py
# Copyright 2019 Christopher Simpkins
# MIT License
#
# Dependencies:
# 1) Python 3.6+ interpreter
# 2) fonttools Python library (https://github.com/fonttools/fonttools)
# - install with `pip3 install fonttools`
#
# Usage:
# python3 fontname.py [FONT FAMILY NAME] [FONT PATH 1] <FONT PATH ...>
#
# Notes:
# Use quotes around font family name arguments that include spaces
# ===========================================================================
import os
import sys
from fontTools import ttLib
def main(argv):
# command argument tests
print(" ")
if len(argv) < 2:
sys.stderr.write(
f"[fontname.py] ERROR: you did not include enough arguments to the script.{os.linesep}"
)
sys.stderr.write(
f"Usage: python3 fontname.py [FONT FAMILY NAME] [FONT PATH 1] <FONT PATH ...>{os.linesep}"
)
sys.exit(1)
# begin parsing command line arguments
try:
font_name = str(argv[0]) # the first argument is the new typeface name
except Exception as e:
sys.stderr.write(
f"[fontname.py] ERROR: Unable to convert argument to string. {e}{os.linesep}"
)
sys.exit(1)
# all remaining arguments on command line are file paths to fonts
font_path_list = argv[1:]
# iterate through all paths provided on command line and rename to `font_name` defined by user
for font_path in font_path_list:
# test for existence of font file on requested file path
if not file_exists(font_path):
sys.stderr.write(
f"[fontname.py] ERROR: the path '{font_path}' does not appear to be a valid file path.{os.linesep}"
)
sys.exit(1)
tt = ttLib.TTFont(font_path)
namerecord_list = tt["name"].names
style = ""
# determine font style for this file path from name record nameID 2
for record in namerecord_list:
if record.nameID == 2:
style = str(record)
break
# test that a style name was found in the OpenType tables of the font
if len(style) == 0:
sys.stderr.write(
f"[fontname.py] Unable to detect the font style from the OpenType name table in '{font_path}'. {os.linesep}"
)
sys.stderr.write("Unable to complete execution of the script.")
sys.exit(1)
else:
# used for the Postscript name in the name table (no spaces allowed)
postscript_font_name = font_name.replace(" ", "")
# font family name
nameID1_string = font_name
nameID16_string = font_name
# full font name
nameID4_string = f"{font_name} {style}"
# Postscript name
# - no spaces allowed in family name or the PostScript suffix. should be dash delimited
nameID6_string = f"{postscript_font_name}-{style.replace(' ', '')}"
# nameID6_string = postscript_font_name + "-" + style.replace(" ", "")
# modify the opentype table data in memory with updated values
for record in namerecord_list:
if record.nameID == 1:
record.string = nameID1_string
elif record.nameID == 4:
record.string = nameID4_string
elif record.nameID == 6:
record.string = nameID6_string
elif record.nameID == 16:
record.string = nameID16_string
# CFF table naming for CFF fonts (only)
if "CFF " in tt:
try:
cff = tt["CFF "]
cff.cff[0].FamilyName = nameID1_string
cff.cff[0].FullName = nameID4_string
cff.cff.fontNames = [nameID6_string]
except Exception as e:
sys.stderr.write(
f"[fontname.py] ERROR: unable to write new names to CFF table: {e}"
)
# write changes to the font file
try:
tt.save(font_path)
print(f"[OK] Updated '{font_path}' with the name '{nameID4_string}'")
except Exception as e:
sys.stderr.write(
f"[fontname.py] ERROR: unable to write new name to OpenType name table for '{font_path}'. {os.linesep}"
)
sys.stderr.write(f"{e}{os.linesep}")
sys.exit(1)
# Utilities
def file_exists(filepath):
"""Tests for existence of a file on the string filepath"""
return os.path.exists(filepath) and os.path.isfile(filepath)
if __name__ == "__main__":
main(sys.argv[1:])

View File

@ -1,34 +1,34 @@
[buildPlans.iosevka-prog] [buildPlans.IosevkaProg]
family = "Iosevka Prog" family = "Iosevka Prog"
spacing = "fontconfig-mono" spacing = "fontconfig-mono"
serifs = "sans" serifs = "sans"
no-cv-ss = false noCvSs = false
no-ligation = true noLigation = true
export-glyph-names = true exportGlyphNames = true
[buildPlans.iosevka-prog.variants] [buildPlans.IosevkaProg.variants]
inherits = "ss08" inherits = "ss08"
[buildPlans.iosevka-prog.metric-override] [buildPlans.IosevkaProg.metricOverride]
sb = 55 sb = 55
leading = 1200 leading = 1200
[buildPlans.iosevka-prog.widths.normal] [buildPlans.IosevkaProg.widths.Normal]
shape = 420 shape = 420
menu = 5 menu = 5
css = "normal" css = "normal"
[buildPlans.iosevka-prog.weights.thin] [buildPlans.IosevkaProg.weights.Thin]
shape = 100 shape = 100
menu = 100 menu = 100
css = 100 css = 100
[buildPlans.iosevka-prog.weights.regular] [buildPlans.IosevkaProg.weights.Regular]
shape = 400 shape = 400
menu = 400 menu = 400
css = 400 css = 400
[buildPlans.iosevka-prog.weights.bold] [buildPlans.IosevkaProg.weights.Bold]
shape = 700 shape = 700
menu = 700 menu = 700
css = 700 css = 700