Skip to content

Commit

Permalink
Merge pull request #77 from adam7/feature/update-font-patcher
Browse files Browse the repository at this point in the history
Update Nerd Font font-patcher
  • Loading branch information
Finii authored Oct 5, 2022
2 parents a16ac8c + 3132a88 commit 8554bb7
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 554 deletions.
76 changes: 45 additions & 31 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:

jobs:
check-for-new-cascadia:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
outputs:
tag_name: ${{ env.CASCADIATAG }}
tag_exists: ${{ steps.check_tag.outputs.exists }}
Expand All @@ -24,9 +24,7 @@ jobs:
uses: octokit/[email protected]
id: get_latest_release
with:
route: GET /repos/{owner}/{repo}/releases/latest
owner: microsoft
repo: cascadia-code
route: GET /repos/microsoft/cascadia-code/releases/latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get the latest Cascadia tag
Expand All @@ -46,14 +44,13 @@ jobs:
build-and-release:
needs: check-for-new-cascadia
if: ${{ github.event_name != 'schedule' || needs.check-for-new-cascadia.outputs.tag_exists != 'true' }}
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
env:
NERDFONTVERS: v2.1.0
CASCADIATAG: ${{ needs.check-for-new-cascadia.outputs.tag_name }}
CASCADIATAG_ISNOTNEW: ${{ needs.check-for-new-cascadia.outputs.tag_exists }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Decide on version
Expand All @@ -68,29 +65,46 @@ jobs:
fi
echo "OURVERSION=${OURVERSION}" >> $GITHUB_ENV
- name: Download latest version of Cascadia
uses: robinraju/[email protected]
with:
repository: "microsoft/cascadia-code"
tag: ${{ needs.check-for-new-cascadia.outputs.tag_name }}
fileName: "*.zip"
- name: Open Cascadia release
run: |
CASCADIAVERS=`curl -L 'https://github.com/microsoft/cascadia-code/releases/latest' | grep CascadiaCode | sed 's!\(.*/microsoft/cascadia-code/releases/download/\([^"]*\).*\|.*span.*\)!\2!'`
echo Downloading ${CASCADIAVERS}
curl -L https://github.com/microsoft/cascadia-code/releases/download/${CASCADIAVERS} -O
unzip CascadiaCode*.zip
- name: Install FontForge
run: |
sudo add-apt-repository ppa:fontforge/fontforge -y -u;
sudo apt-get install fontforge -y;
- name: Download and patch Font Patcher
unzip CascadiaCode*.zip 'ttf/*'
# Ubuntu 20.04 has only fontforge release 2020, but there are some vital bugfixes in the 2022 release
# This can be replaced with the ordinary apt package when Ubuntu updates, probably with 22.10?
- name: Fetch FontForge
run: |
curl -L https://raw.githubusercontent.com/ryanoasis/nerd-fonts/${NERDFONTVERS}/font-patcher --output font-patcher
patch font-patcher 0001*.patch
- name: Download source fonts
sudo apt install software-properties-common python3-fontforge fuse -y -q
curl -L "https://github.com/fontforge/fontforge/releases/download/20220308/FontForge-2022-03-08-582bd41-x86_64.AppImage" \
--output fontforge
chmod u+x fontforge
echo Try appimage
./fontforge --version
export PATH=`pwd`:$PATH
echo "PATH=$PATH" >> $GITHUB_ENV
echo Try appimage with path
fontforge --version
- name: Get Font Patcher
uses: robinraju/[email protected]
with:
repository: "ryanoasis/nerd-fonts"
latest: true
fileName: "FontPatcher.zip"
- name: Open Font Patcher release
run: |
chmod +x download-source-fonts.sh
./download-source-fonts.sh
unzip FontPatcher.zip
- name: Install PIP
run: sudo apt install python-pip -y
run: sudo apt install python3-pip -y
- name: Install configparser
run: pip install configparser
run: pip3 install configparser
- name: Extract additional powerline glyphs
run: fontforge -lang=ff -script extract-extra-glyphs
run: fontforge -lang=ff -script "`pwd`/extract-extra-glyphs" "`pwd`" `pwd`/src/**/octicons.ttf
- name: Build Powerline
run: |
./do_generate 01 --powerline --mono CascadiaCodePL-Regular.ttf DelugiaPL.ttf "Delugia PL"
Expand Down Expand Up @@ -148,32 +162,32 @@ jobs:
zip delugia-book.zip delugia-book/*
- name: Check for preexisting glyphs
run: |
grep 'Found existing' process*.log
- uses: actions/upload-artifact@master
grep 'Found existing' process*.log | grep -vE ' Powerline(Extra)?Symbols>'
- uses: actions/upload-artifact@v3
with:
name: Delugia Powerline
path: "delugia-powerline"
- uses: actions/upload-artifact@master
- uses: actions/upload-artifact@v3
with:
name: Delugia Mono Powerline
path: "delugia-mono-powerline"
- uses: actions/upload-artifact@master
- uses: actions/upload-artifact@v3
with:
name: Delugia Complete
path: "delugia-complete"
- uses: actions/upload-artifact@master
- uses: actions/upload-artifact@v3
with:
name: Delugia Mono Complete
path: "delugia-mono-complete"
- uses: actions/upload-artifact@master
- uses: actions/upload-artifact@v3
with:
name: Delugia Book
path: "delugia-book"

# Release part
- name: Create tag
if: ${{ github.event_name != 'pull_request' && !startsWith(github.ref, 'refs/tags/') && needs.check-for-new-cascadia.outputs.tag_exists != 'true' }}
uses: actions/github-script@v3
uses: actions/github-script@v6
with:
github-token: ${{ github.token }}
script: |
Expand Down
44 changes: 0 additions & 44 deletions 0001-font-patcher-Use-correct-source-font-metrics.patch

This file was deleted.

5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,7 @@ All of these are available in light, regular, and bold weights. Complemented by

### How is Delugia special?
Compared with other patched versions of Cascadia you will find
* Added symbols ```` (0u2262), ```` (0u2263), ```` (0u276F), and ```` (0u26A1) used with some popular Powerline setups
* All added symbols centered on visual middle of the font (not a bit higher)
* Light and bold weight
* Italic faces
* Added symbol ```` (0u26A1) used with some popular Powerline setups (for not 'Complete')

### How to use
You can download the patched fonts from the [Releases page](https://github.com/adam7/delugia-code/releases) of this
Expand Down
6 changes: 4 additions & 2 deletions do_generate
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ if [ "$#" -ne 6 ]; then
exit 1
fi

PWD=$( pwd )

rm -f C*.ttf
fontforge -script font-patcher --careful "${3}" --custom SomeExtraSymbols.otf --no-progressbars "ttf/static/${4}" "${2}" | tee "process${1}.log"
fontforge -script "${PWD}/font-patcher" --careful "${3}" --custom SomeExtraSymbols.sfd --no-progressbars "${PWD}/ttf/static/${4}" "${2}" --outputdir "${PWD}" | tee "process${1}.log"

if [ -z "${OURVERSION}" ]; then
# Github CI sets this variable, but this can be useful for manual calls:
OURVERSION=`git describe --always --tags`
fi
fontforge rename-font --orig "ttf/static/${4}" --input C*.ttf --output "${5}" --version "${OURVERSION}" --name "${6}"
fontforge -script "${PWD}/rename-font" --orig "${PWD}/ttf/static/${4}" --input ${PWD}/C*.ttf --output "${PWD}/${5}" --version "${OURVERSION}" --name "${6}"
6 changes: 2 additions & 4 deletions extract-extra-glyphs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
Open("src/glyphs/Hack-Regular.ttf");
Open($2);
SelectAll();
SelectFewer(0u2262,0u2263);
SelectFewer(0u276F);
SelectFewer(0u26A1);
Clear();
Generate("src/glyphs/SomeExtraSymbols.otf");
Save($1 + "/src/glyphs/SomeExtraSymbols.sfd");
Loading

0 comments on commit 8554bb7

Please sign in to comment.