Skip to content

Commit

Permalink
2024/04/22#3
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron-212 committed Apr 22, 2024
1 parent 0535891 commit 7f96e5d
Show file tree
Hide file tree
Showing 482 changed files with 7,471 additions and 11,867 deletions.
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ build: build.stamp


build.stamp: init.stamp
fontmake -g "src/NeoHanSans-Variable.glyphspackage" -o variable --output-path "fonts-temp/variable/NeoHanSansSC[wght].ttf"
# fontmake -g "src/NeoHanSans-Variable.glyphspackage" -o variable-cff2 --output-path "fonts/variable/NeoHanSansSC[wght].otf"
fontmake -g "src/NeoHanSans-Variable.glyphspackage" -o ufo --output-dir "fonts-temp/master-ufo" --filter DecomposeTransformedComponentsFilter
python scripts/stat.py
fontmake -m "fonts-temp/master-ufo/NeoHanSansSC.designspace" -o variable --output-path "fonts-temp/variable/NeoHanSansSC[wght].ttf"
# fontmake -m "fonts-temp/master-ufo/NeoHanSansSC.designspace" -o variable-cff2 --output-path "fonts-temp/variable/NeoHanSansSC[wght].otf"
mkdir fonts
mkdir fonts/variable
gftools fix-nonhinting "fonts-temp/variable/NeoHanSansSC[wght].ttf" "fonts/variable/NeoHanSansSC[wght].ttf"
python scripts/stat.py
touch build.stamp

zip: build.stamp
Expand Down
46 changes: 18 additions & 28 deletions scripts/stat.py
Original file line number Diff line number Diff line change
@@ -1,35 +1,25 @@
from fontTools.ttLib import TTFont
from fontTools.otlLib import builder
from fontTools.designspaceLib import DesignSpaceDocument, LocationLabelDescriptor, AxisLabelDescriptor

"""
Add a STAT table to the Designspace document as a postprocessing after
using fontmake to compile the Glyphspackage to the final binary font.
Add a STAT table to the Designspace document as a preprocessing before
using fontmake to compile the UFOs to the final binary font.
"""

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=490, name='Medium'),
dict(value=580, name='SemiBold'),
dict(value=670, name='Bold'),
dict(value=780, name='ExtraBold'),
dict(value=900, name='Black'),
],
)
path = "fonts-temp/master-ufo/NeoHanSansSC.designspace"
dsfile = DesignSpaceDocument.fromfile(path)

wghtAxisLabels = [
AxisLabelDescriptor(name="Thin", userValue=100, userMinimum=100, userMaximum=150),
AxisLabelDescriptor(name="ExtraLight", userValue=200, userMinimum=150, userMaximum=250),
AxisLabelDescriptor(name="Light", userValue=300, userMinimum=250, userMaximum=350),
AxisLabelDescriptor(name="Regular", userValue=400, userMinimum=350, userMaximum=450),
AxisLabelDescriptor(name="Medium", userValue=490, userMinimum=450, userMaximum=550),
AxisLabelDescriptor(name="SemiBold", userValue=580, userMinimum=550, userMaximum=650),
AxisLabelDescriptor(name="Bold", userValue=670, userMinimum=650, userMaximum=750),
AxisLabelDescriptor(name="ExtraBold", userValue=780, userMinimum=750, userMaximum=850),
AxisLabelDescriptor(name="Black", userValue=900, userMinimum=850, userMaximum=900),
]
dsfile.getAxisByTag("wght").axisLabels = wghtAxisLabels

ttpath = "fonts/variable/NeoHanSansSC[wght].ttf"
ttfont = TTFont(ttpath)
builder.buildStatTable(ttfont, axes)
ttfont.save(ttpath)

# otpath = "fonts/variable/NeoHanSansSC[wght].otf"
# otfont = TTFont(otpath)
# builder.buildStatTable(otfont, axes)
# otfont.save(otpath)
dsfile.write(path)
29 changes: 29 additions & 0 deletions src/NeoHanSans-Variable.glyphspackage/fontinfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,14 @@ value = -280;
{
name = hheaAscender;
value = 1040;
},
{
name = winDescent;
value = -280;
},
{
name = winAscent;
value = 1040;
}
);
iconName = Light;
Expand Down Expand Up @@ -153,6 +161,14 @@ value = -280;
{
name = hheaAscender;
value = 1040;
},
{
name = winDescent;
value = -280;
},
{
name = winAscent;
value = 1040;
}
);
iconName = Bold;
Expand Down Expand Up @@ -300,6 +316,19 @@ value = "新源黑体";
);
},
{
key = manufacturers;
values = (
{
language = dflt;
value = Aaron212;
}
);
},
{
key = manufacturerURL;
value = "https://aaron212.top/";
},
{
key = vendorID;
value = AARN;
}
Expand Down
24 changes: 8 additions & 16 deletions src/NeoHanSans-Variable.glyphspackage/glyphs/uni4E_2D_.glyph
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,17 @@ closed = 1;
nodes = (
(105,647,l),
(105,230,l),
(134,230,l),
(134,618,l),
(861,618,l),
(861,230,l),
(890,230,l),
(890,647,l)
);
},
{
closed = 1;
nodes = (
(122,259,l),
(122,230,l),
(881,230,l),
(881,259,l)
(134,618,l),
(861,618,l),
(861,259,l),
(134,259,l)
);
},
{
Expand All @@ -48,21 +44,17 @@ closed = 1;
nodes = (
(83,684,l),
(83,181,l),
(229,181,l),
(229,541,l),
(768,541,l),
(768,181,l),
(921,181,l),
(921,684,l)
);
},
{
closed = 1;
nodes = (
(158,324,l),
(158,181,l),
(852,181,l),
(852,324,l)
(229,541,l),
(768,541,l),
(768,324,l),
(229,324,l)
);
},
{
Expand Down
32 changes: 12 additions & 20 deletions src/NeoHanSans-Variable.glyphspackage/glyphs/uni4E_69.glyph
Original file line number Diff line number Diff line change
Expand Up @@ -53,23 +53,19 @@ nodes = (
{
closed = 1;
nodes = (
(113,-7,l),
(113,-37,l),
(479,-37,l),
(479,-7,l)
(99,372,l),
(99,-37,l),
(491,-37,l),
(491,372,l)
);
},
{
closed = 1;
nodes = (
(99,372,l),
(99,-37,l),
(129,-37,l),
(129,342,l),
(462,342,l),
(462,-37,l),
(491,-37,l),
(491,372,l)
(462,-7,l),
(129,-7,l)
);
}
);
Expand Down Expand Up @@ -127,23 +123,19 @@ nodes = (
{
closed = 1;
nodes = (
(111,77,l),
(111,-54,l),
(463,-54,l),
(463,77,l)
(62,412,l),
(62,-54,l),
(514,-54,l),
(514,412,l)
);
},
{
closed = 1;
nodes = (
(62,412,l),
(62,-54,l),
(190,-54,l),
(190,283,l),
(380,283,l),
(380,-54,l),
(514,-54,l),
(514,412,l)
(380,77,l),
(190,77,l)
);
}
);
Expand Down
60 changes: 26 additions & 34 deletions src/NeoHanSans-Variable.glyphspackage/glyphs/uni4E_71.glyph
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,19 @@ nodes = (
{
closed = 1;
nodes = (
(125,-19,l),
(125,-49,l),
(496,-49,l),
(496,-19,l)
(109,315,l),
(109,-49,l),
(512,-49,l),
(512,315,l)
);
},
{
closed = 1;
nodes = (
(138,285,l),
(482,285,l),
(482,-19,l),
(138,-19,l)
);
},
{
Expand Down Expand Up @@ -66,19 +75,6 @@ nodes = (
{
closed = 1;
nodes = (
(109,315,l),
(109,-49,l),
(138,-49,l),
(138,285,l),
(482,285,l),
(482,-49,l),
(512,-49,l),
(512,315,l)
);
},
{
closed = 1;
nodes = (
(295,756,l),
(295,297,l),
(325,297,l),
Expand All @@ -104,10 +100,19 @@ nodes = (
{
closed = 1;
nodes = (
(127,72,l),
(127,-55,l),
(474,-55,l),
(474,72,l)
(65,339,l),
(65,-55,l),
(539,-55,l),
(539,339,l)
);
},
{
closed = 1;
nodes = (
(200,212,l),
(397,212,l),
(397,72,l),
(200,72,l)
);
},
{
Expand Down Expand Up @@ -153,19 +158,6 @@ nodes = (
{
closed = 1;
nodes = (
(65,339,l),
(65,-55,l),
(200,-55,l),
(200,212,l),
(397,212,l),
(397,-55,l),
(539,-55,l),
(539,339,l)
);
},
{
closed = 1;
nodes = (
(228,758,l),
(228,249,l),
(370,249,l),
Expand Down
28 changes: 7 additions & 21 deletions src/NeoHanSans-Variable.glyphspackage/glyphs/uni4E_89.glyph
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ nodes = (
(178,567,l),
(178,537,l),
(783,537,l),
(783,172,l),
(813,172,l),
(783,200,l),
(137,200,l),
(137,171,l),
(813,171,l),
(813,567,l)
);
},
Expand All @@ -49,15 +51,6 @@ nodes = (
{
closed = 1;
nodes = (
(137,200,l),
(137,171,l),
(813,171,l),
(813,200,l)
);
},
{
closed = 1;
nodes = (
(384,834,l),
(333,746,o),
(235,631,o),
Expand Down Expand Up @@ -128,7 +121,9 @@ nodes = (
(187,600,l),
(187,474,l),
(704,474,l),
(704,111,l),
(704,242,l),
(149,242,l),
(149,111,l),
(846,111,l),
(846,600,l)
);
Expand All @@ -145,15 +140,6 @@ nodes = (
{
closed = 1;
nodes = (
(149,242,l),
(149,111,l),
(789,111,l),
(789,242,l)
);
},
{
closed = 1;
nodes = (
(302,854,l),
(252,761,o),
(162,659,o),
Expand Down
Loading

0 comments on commit 7f96e5d

Please sign in to comment.