Skip to content

Commit

Permalink
Merge pull request #39 from RedHatOfficial/custom-variable-fonts
Browse files Browse the repository at this point in the history
Adds a modified version of the variable font for RedHat.com
  • Loading branch information
zhawkins authored Apr 29, 2021
2 parents 3f50e79 + deeb4d2 commit 2f89d03
Show file tree
Hide file tree
Showing 23 changed files with 760 additions and 222 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
.DS_Store

# Ignore virtual environment Python files for compiling the font.
venv
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## 4.0.2 (2021-04-28)
Tag: [4.0.2](https://github.com/RedHatOfficial/RedHatFont/releases/tag/4.0.2)

- Fixed red-hat-font.css to bring weights back to what they were in v3.
- Updated demo page to only use variable fonts
- Added demo page of modified variable fonts

## 4.0.1 (2021-04-22)
Tag: [4.0.1](https://github.com/RedHatOfficial/RedHatFont/releases/tag/4.0.1)

- Refreshed metainfo files to account for the new "Red Hat Typeface" name and monospace font family

## 4.0.0 (2021-04-08)
Tag: [4.0.0](https://github.com/RedHatOfficial/RedHatFont/commits/4.0.0)

Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ As part of Red Hat’s commitment to open source software, the fonts are made av

Variable fonts are available for each of the Red Hat Typeface families. The fonts include the `wght` axis, which allows for interpolation between light and black weights.

A demo for variable fonts is available at [https://redhatofficial.github.io/RedHatFont/](https://redhatofficial.github.io/RedHatFont/).

## Building the Fonts

From terminal, run the build script at `sources/build-all.sh`. Fonts output to `fonts/`.
Expand Down Expand Up @@ -77,8 +79,7 @@ pip install -U -r requirements.txt
Give the build scripts permission to run/execute (you can copy & paste, then run both lines in the terminal at once):

```bash
chmod +x sources/**/*.sh
chmod +x mastering/make-github-release/**/*.sh
chmod +x build-scripts/*.sh
```

**Making woff2 files**
Expand Down Expand Up @@ -111,19 +112,19 @@ Once you have set up the environment (see above), you can build fonts & prep rel
To build variable and static fonts, plus make woff2s, use `build-all.sh`. This takes awhile (most of the time is taken up by building TTF & OTF static fonts).

```bash
sources/build-all.sh
./build-all.sh
```

If you just want to build variable fonts, use `build.sh`:

```bash
sources/build-scripts/build-vf.sh
./build-scripts/build-vf.sh
```

To build only the static fonts (these are secondary to the variable fonts, so you can’t set the version numbers in this script), use `build-statics.sh`:

```bash
sources/build-scripts/build-statics.sh
./build-scripts/build-statics.sh
```

## Installation
Expand Down
148 changes: 148 additions & 0 deletions build-scripts/build-modified-vf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
#!/bin/sh
set -e

# if [ -z "$1" ]
# then
# echo "No version number supplied. If you wish to update the version number in UFOs & built fonts, add one as a build argument:"
# echo "sources/build-vf.sh 1.000"
# else
# version=$1
# python mastering/scripts/edit-ufo-info/set-ufo-version.py sources/Mono $version --save
# fi

## ------------------------------------------------------------------
## Variable Fonts Build - Static build is at sources/build-statics.sh

echo "Generating VFs modified for RedHat.com"
mkdir -p fonts/mono/
mkdir -p fonts/proportional/

# Mono fonts are _not_ modified for RedHat.com.
fontmake -m source/Mono/VF/RedHatMonoVF.designspace -o variable --no-production-names --output-path fonts/mono/RedHatMonoVF.ttf
fontmake -m source/Mono/VF/RedHatMonoVFItalic.designspace -o variable --no-production-names --output-path fonts/mono/RedHatMonoVF-Italic.ttf
#split the mono out and put it in fonts/mono/

#split the proportional out and put them in fonts/proportional
fontmake -m source/Proportional/VF/Modified-RedHatTextVF.designspace -o variable --no-production-names --output-path fonts/proportional/RedHatTextVFModified.ttf
fontmake -m source/Proportional/VF/Modified-RedHatTextItalicVF.designspace -o variable --no-production-names --output-path fonts/proportional/RedHatTextVF-ItalicModified.ttf
fontmake -m source/Proportional/VF/Modified-RedHatDisplayVF.designspace -o variable --no-production-names --output-path fonts/proportional/RedHatDisplayVFModified.ttf
fontmake -m source/Proportional/VF/Modified-RedHatDisplayItalicVF.designspace -o variable --no-production-names --output-path fonts/proportional/RedHatDisplayVF-ItalicModified.ttf



mvfs=$(ls fonts/mono/*.ttf)
echo mvfs
echo "Post processing VFs"
for vf in $mvfs
do
gftools fix-dsig -f $vf;
#python mastering/scripts/fix_naming.py $vf;
#ttfautohint-vf --stem-width-mode nnn $vf "$vf.fix";
#mv "$vf.fix" $vf;
done

vfs=$(ls fonts/proportional/*.ttf)
echo vfs
echo "Post processing VFs"
for vf in $vfs
do
gftools fix-dsig -f $vf;
done

echo "Fixing mono non Hinting"
for vf in $mvfs
do
gftools fix-nonhinting $vf "$vf.fix";
if [ -f "$vf.fix" ]; then mv "$vf.fix" $vf; fi
done

echo "Fixing proportional non Hinting"
for vf in $vfs
do
gftools fix-nonhinting $vf "$vf.fix";
if [ -f "$vf.fix" ]; then mv "$vf.fix" $vf; fi
done

echo "Add STAT table"
# Using a copy of the gen_stat.py script from texturina, to try and sort this once and for all.
python mastering/gen_stat_mono.py
python mastering/gen_stat_text.py
python mastering/gen_stat_disp.py

echo "stat add complete"


rm -rf fonts/mono/*gasp*
rm -rf fonts/proportional/*gasp*

echo "Remove unwanted fvar instances"
for vf in $mvfs
do
python mastering/scripts/removeUnwantedVFInstances.py $vf
done

echo "Dropping MVAR"
for vf in $mvfs
do
# mv "$vf.fix" $vf;
ttx -f -x "MVAR" $vf; # Drop MVAR. Table has issue in DW
rtrip=$(basename -s .ttf $vf)
new_file=fonts/mono/$rtrip.ttx;
rm $vf;
ttx $new_file
rm $new_file
done

echo "Fix name table"
for vf in $mvfs
do
python mastering/scripts/fixNameTable.py $vf
done



echo "Remove unwanted fvar instances"
for vf in $vfs
do
python mastering/scripts/removeUnwantedVFInstances.py $vf
done

echo "Dropping MVAR"
for vf in $vfs
do
# mv "$vf.fix" $vf;
ttx -f -x "MVAR" $vf; # Drop MVAR. Table has issue in DW
rtrip=$(basename -s .ttf $vf)
new_file=fonts/proportional/$rtrip.ttx;
rm $vf;
ttx $new_file
rm $new_file
done

echo "Fix name table"
for vf in $vfs
do
python mastering/scripts/fixNameTable.py $vf
done


### Cleanup


rm -rf ./*/instances/
rm -f fonts/*.ttx
rm -f fonts/static/ttf/*.ttx
rm -f fonts/*gasp.ttf
rm -f fonts/static/ttf/*gasp.ttf

# ## -------------------------------------------------------------
# ## Improving version string detail

# echo "----------------------------------------------------------------------------------"
# echo "Adding the current commit hash to variable font version strings"
# font-v write --sha1 "fonts/RedHatMono[wght].ttf"
# font-v write --sha1 "fonts/RedHatMono-Italic[wght].ttf"

echo "Done Generating Modified Variable Fonts"

# # # You should check the fonts now with fontbakery, and generate a markdown file.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
"description": "Red Hat - the open source font for Red Hat",
"main": "red-hat-font.css",
"scripts": {
"minify": "npx csso-cli webfonts/red-hat-font.css --output webfonts/red-hat-font.min.css & npx csso-cli webfonts/red-hat-font-variable.css --output webfonts/red-hat-font-variable.min.css",
"minify": "npx csso-cli webfonts/red-hat-font.css --output webfonts/red-hat-font.min.css & npx csso-cli webfonts/font.css --output webfonts/font.min.css",
"local": "npx browser-sync start -s 'webfonts' -f 'webfonts'",
"copy-to-webfonts": "cp ./fonts/proportional/web/*Modified.woff2 ./webfonts/modified && cp ./fonts/mono/web/{*Italic.woff2,*VF.woff2} ./webfonts/RedHatMono",
"test": ""
},
"keywords": [
Expand Down
57 changes: 57 additions & 0 deletions source/Proportional/VF/Modified-RedHatDisplayItalicVF.designspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?xml version='1.0' encoding='UTF-8'?>
<designspace format="4.1">
<axes>
<axis tag="wght" name="Weight" minimum="300" maximum="900" default="300">
<labelname xml:lang="en">Weight</labelname>
<map input="300" output="300"/>
<map input="400" output="500"/>
<map input="700" output="757.700000"/>
<map input="900" output="900"/>
</axis>
</axes>
<sources>
<source filename="RedHatDisplayVF-Italic.ufo" familyname="Red Hat Display VF" stylename="Light Italic">
<lib copy="1"/>
<groups copy="1"/>
<features copy="1"/>
<info copy="1"/>
<location>
<dimension name="Weight" xvalue="300"/>
</location>
</source>
<source filename="RedHatDisplayVF-BlackItalic.ufo" familyname="Red Hat Display VF" stylename="Black Italic">
<location>
<dimension name="Weight" xvalue="900"/>
</location>
</source>
</sources>
<instances>
<instance familyname="Red Hat Display VF" stylename="Black Italic" filename="instances/RedHatDisplayVF-BlackItalic.ufo" postscriptfontname="RedHatDisplayVF-BlackItalic">
<location>
<dimension name="Weight" xvalue="900"/>
</location>
<kerning/>
<info/>
</instance>
<instance familyname="Red Hat Display VF" stylename="Light Italic" filename="instances/RedHatDisplayVF-Italic.ufo" postscriptfontname="RedHatDisplayVF-Italic">
<location>
<dimension name="Weight" xvalue="300"/>
</location>
<kerning/>
<info/>
</instance>
<instance familyname="Red Hat Display VF" stylename="Bold Italic" filename="instances/RedHatDisplayVF-BoldItalic.ufo" postscriptfontname="RedHatDisplayVF-BoldItalic">
<location>
<dimension name="Weight" xvalue="757.700000"/>
</location>
<kerning/>
<info/>
</instance>
</instances>
<lib>
<dict>
<key>com.letterror.mathModelPref</key>
<string>previewVarLib</string>
</dict>
</lib>
</designspace>
57 changes: 57 additions & 0 deletions source/Proportional/VF/Modified-RedHatDisplayVF.designspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?xml version='1.0' encoding='UTF-8'?>
<designspace format="4.1">
<axes>
<axis tag="wght" name="Weight" minimum="300" maximum="900" default="300">
<labelname xml:lang="en">Weight</labelname>
<map input="300" output="300"/>
<map input="400" output="500"/>
<map input="700" output="757.700000"/>
<map input="900" output="900"/>
</axis>
</axes>
<sources>
<source filename="RedHatDisplayVF-Regular.ufo" familyname="Red Hat Display VF" stylename="Light">
<lib copy="1"/>
<groups copy="1"/>
<features copy="1"/>
<info copy="1"/>
<location>
<dimension name="Weight" xvalue="300"/>
</location>
</source>
<source filename="RedHatDisplayVF-Black.ufo" familyname="Red Hat Display VF" stylename="Black">
<location>
<dimension name="Weight" xvalue="900"/>
</location>
</source>
</sources>
<instances>
<instance familyname="Red Hat Display VF" stylename="Black" filename="instances/RedHatDisplayVF-Black.ufo" postscriptfontname="RedHatDisplayVF-Black">
<location>
<dimension name="Weight" xvalue="900"/>
</location>
<kerning/>
<info/>
</instance>
<instance familyname="Red Hat Display VF" stylename="Light" filename="instances/RedHatDisplayVF-Regular.ufo" postscriptfontname="RedHatDisplayVF-Regular">
<location>
<dimension name="Weight" xvalue="300"/>
</location>
<kerning/>
<info/>
</instance>
<instance familyname="Red Hat Display VF" stylename="Bold" filename="instances/RedHatDisplayVF-Bold.ufo" postscriptfontname="RedHatDisplayVF-Bold">
<location>
<dimension name="Weight" xvalue="757.700000"/>
</location>
<kerning/>
<info/>
</instance>
</instances>
<lib>
<dict>
<key>com.letterror.mathModelPref</key>
<string>previewVarLib</string>
</dict>
</lib>
</designspace>
52 changes: 52 additions & 0 deletions source/Proportional/VF/Modified-RedHatTextItalicVF.designspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version='1.0' encoding='UTF-8'?>
<designspace format="4.1">
<axes>
<axis tag="wght" name="Weight" minimum="400" maximum="700" default="400">
<labelname xml:lang="en">Weight</labelname>
<map input="400" output="400"/>
<map input="500" output="535.800000"/>
<map input="700" output="700"/>
</axis>
</axes>
<sources>
<source filename="RedHatTextVF-Italic.ufo" familyname="Red Hat Text VF" stylename="Italic">
<location>
<dimension name="Weight" xvalue="400"/>
</location>
</source>
<source filename="RedHatTextVF-BoldItalic.ufo" familyname="Red Hat Text VF" stylename="Bold Italic">
<location>
<dimension name="Weight" xvalue="700"/>
</location>
</source>
</sources>
<instances>
<instance familyname="Red Hat Text VF" stylename="Medium Italic" filename="instances/RedHatTextVF-MediumItalic.ufo" postscriptfontname="RedHatTextVF-MediumItalic">
<location>
<dimension name="Weight" xvalue="535.800000"/>
</location>
<kerning/>
<info/>
</instance>
<instance familyname="Red Hat Text VF" stylename="Bold Italic" filename="instances/RedHatTextVF-BoldItalic.ufo" postscriptfontname="RedHatTextVF-BoldItalic">
<location>
<dimension name="Weight" xvalue="700"/>
</location>
<kerning/>
<info/>
</instance>
<instance familyname="Red Hat Text VF" stylename="Italic" filename="instances/RedHatTextVF-Italic.ufo" postscriptfontname="RedHatTextVF-Italic">
<location>
<dimension name="Weight" xvalue="400"/>
</location>
<kerning/>
<info/>
</instance>
</instances>
<lib>
<dict>
<key>com.letterror.mathModelPref</key>
<string>previewVarLib</string>
</dict>
</lib>
</designspace>
Loading

0 comments on commit 2f89d03

Please sign in to comment.