-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
269 changed files
with
6,047 additions
and
7,838 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
# Builds fonts either when a prerelease version tag (e.g. v1.2-foo) | ||
# is created, or when source is changed. | ||
# | ||
# When a version tag is created, a pre-release is automatically created. | ||
# | ||
# Otherwise, when source changes without a tag being created, | ||
# the build artifacts are uploaded to github and saved for 1 day. | ||
# They can be found at https://github.com/rsms/inter/actions/runs/RUNID | ||
name: Build fonts | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
paths: | ||
- "src/**" | ||
- "scripts/**" | ||
- Makefile | ||
- requirements.txt | ||
tags: | ||
- "v*" | ||
pull_request: | ||
branches: [main] | ||
paths: | ||
- "src/**" | ||
- "scripts/**" | ||
- Makefile | ||
- requirements.txt | ||
workflow_dispatch: | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.12' | ||
|
||
- name: Install utilities | ||
run: sudo apt-get install -y zip | ||
|
||
- name: make init | ||
run: make init | ||
|
||
- name: Define version (tag) | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
run: | | ||
VERSION=${{ github.ref }} | ||
VERSION=${VERSION:11} # refs/tags/v1.2.3 => 1.2.3 | ||
echo "NeoHanSans_version=$VERSION" >> $GITHUB_ENV | ||
- name: Define version (branch) | ||
if: ${{ ! startsWith(github.ref, 'refs/tags/v') }} | ||
run: | | ||
python misc/scripts/get_ver.py | ||
GITSHA=${{ github.sha }} | ||
VERSION=$(cat version.txt) | ||
echo "NeoHanSans_version=${VERSION}-${GITSHA:0:7}" >> $GITHUB_ENV | ||
- name: make build | ||
run: | | ||
ZIP=NeoHanSans-${{ env.NeoHanSans_version }}.zip | ||
echo "NeoHanSans_zip=$ZIP" >> $GITHUB_ENV | ||
make zip | ||
mv NeoHanSans.zip "$ZIP" | ||
- name: Upload archive (unless tag) | ||
if: ${{ ! startsWith(github.ref, 'refs/tags/v') }} | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: "${{ env.NeoHanSans_version }}" | ||
path: ${{ env.NeoHanSans_zip }} | ||
retention-days: 1 | ||
|
||
- name: Create release (if tag) | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
prerelease: true | ||
name: "${{ env.NeoHanSans_version }}" | ||
body: "This release was created automatically" | ||
files: ${{ env.NeoHanSans_zip }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
.DS_STORE | ||
src/NeoHanSans-Variable(自动存储).glyphspackage | ||
src/NeoHanSans-Variable(自动存储).glyphspackage | ||
fonts | ||
fonts-temp | ||
version.txt | ||
*.stamp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
help: | ||
@echo "###" | ||
@echo "# Build targets for Neo Han Sans SC" | ||
@echo "###" | ||
@echo | ||
@echo " make build: Builds the fonts and places them in the fonts/ directory" | ||
@echo " make zip: Zip all fonts into a zip" | ||
@echo | ||
|
||
init: requirements.txt | ||
pip install -Ur requirements.txt | ||
touch init.stamp | ||
|
||
build: build.stamp | ||
|
||
# fontmake -m "fonts-temp/master-ufo/InterNumeric.designspace" -o variable --output-path "fonts/variable/InterNumeric[wght,RDNS].ttf" --filter DecomposeTransformedComponentsFilter --verbose DEBUG | ||
# fontmake -m "fonts-temp/master-ufo/InterNumeric.designspace" -o variable-cff2 --output-path "fonts/variable/InterNumeric[wght,RDNS].otf" | ||
|
||
|
||
build.stamp: init.stamp | ||
fontmake -g "src/NeoHanSans-Variable.glyphspackage" -o variable --output-path "fonts/variable/NeoHanSansSC[wght].ttf" | ||
python scripts/stat.py | ||
touch build.stamp | ||
|
||
zip: build.stamp | ||
cp -rf fonts NeoHanSansSC | ||
zip -r NeoHanSans.zip NeoHanSansSC | ||
rm -rf NeoHanSansSC | ||
|
||
|
||
# fontbakery check-adobefonts "fonts/variable/InterNumeric[wght,RDNS].ttf" | ||
|
||
test: build.stamp | ||
fontbakery check-universal "fonts/variable/NeoHanSansSC[wght].ttf" -x com.google.fonts/check/gpos_kerning_info -x com.google.fonts/check/tabular_kerning -x com.google.fonts/check/monospace | ||
|
||
test-google: build.stamp | ||
fontbakery check-googlefonts "fonts/variable/NeoHanSansSC[wght].ttf" -x com.google.fonts/check/gpos_kerning_info -x com.google.fonts/check/tabular_kerning -x com.google.fonts/check/monospace | ||
|
||
clean: | ||
rm -rf fonts | ||
rm build.stamp | ||
|
||
update: | ||
pip install -Ur requirements.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
fontmake | ||
gftools | ||
fonttools | ||
fontbakery | ||
shaperglot | ||
chws-tool |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from glyphsLib import GSFont | ||
|
||
""" | ||
Get font version from Glyphspackage source file, store it in verion.txt | ||
No need to keep track of version in a seperate file. | ||
Only used in GitHub Workflows to give artifacts a file name. | ||
""" | ||
|
||
def get_font_version(glyphspackage_path): | ||
font = GSFont(glyphspackage_path) | ||
|
||
return f"{font.versionMajor}.{font.versionMinor:03}" | ||
|
||
inter_numeric_src_path = "src/NeoHanSans-Variable.glyphspackage" | ||
|
||
with open("version.txt", "w") as version_file: | ||
version_file.write(get_font_version(inter_numeric_src_path)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from fontTools.ttLib import TTFont | ||
from fontTools.otlLib import builder | ||
|
||
""" | ||
Add a STAT table to the Designspace document as a preprocessing before | ||
using fontmake to compile the UFOs to the final binary font. | ||
""" | ||
|
||
path = "fonts/variable/NeoHanSansSC[wght].ttf" | ||
font = TTFont(path) | ||
|
||
axes = [ | ||
dict( | ||
tag="wght", | ||
name="Weight", | ||
values=[ | ||
dict(value=100, name='Thin'), | ||
dict(value=200, name='ExtraLight'), | ||
dict(value=300, name='Light'), | ||
dict(value=400, name='Regular', flags=0x2), | ||
dict(value=500, name='Medium'), | ||
dict(value=600, name='SemiBold'), | ||
dict(value=700, name='Bold'), | ||
dict(value=800, name='ExtraBold'), | ||
dict(value=900, name='Black'), | ||
], | ||
) | ||
] | ||
|
||
builder.buildStatTable(font, axes) | ||
font.save(path) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/NeoHanSans-Variable.glyphspackage/glyphs/nbspace.glyph
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
color = 8; | ||
glyphname = nbspace; | ||
layers = ( | ||
{ | ||
layerId = m01; | ||
width = 600; | ||
}, | ||
{ | ||
layerId = "5029AEDF-C899-4409-998A-C73D58F94579"; | ||
width = 200; | ||
} | ||
); | ||
metricWidth = space; | ||
unicode = 160; | ||
} |
Oops, something went wrong.