Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Light and Italic font faces #59

Merged
merged 14 commits into from
Jun 30, 2021
127 changes: 69 additions & 58 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
outputs:
tag_name: ${{ env.CASCADIATAG }}
tag_exists: ${{ steps.check_tag.outputs.exists }}

steps:
- name: Fetch latest release of Cascadia Code
uses: octokit/request-action@v2.x
Expand All @@ -40,7 +40,7 @@ jobs:
tag: ${{ env.CASCADIATAG }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build-and-release:
needs: check-for-new-cascadia
if: ${{ github.event_name != 'schedule' || needs.check-for-new-cascadia.outputs.tag_exists != 'true' }}
Expand All @@ -50,6 +50,8 @@ jobs:

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Download latest version of Cascadia
run: |
CASCADIAVERS=`curl -L 'https://github.com/microsoft/cascadia-code/releases/latest' | grep CascadiaCode | sed 's!\(.*/microsoft/cascadia-code/releases/download/\([^"]*\).*\|.*span.*\)!\2!'`
Expand All @@ -74,75 +76,84 @@ jobs:
run: pip install configparser
- name: Extract additional powerline glyphs
run: fontforge -lang=ff -script extract-extra-glyphs
- name: Prepare Cascadia Code font file
run: |
mkdir prepared
fontforge prepare-font --input ttf/CascadiaCodePL.ttf --output prepared/CascadiaCodePL.ttf
fontforge prepare-font --input ttf/CascadiaMonoPL.ttf --output prepared/CascadiaMonoPL.ttf
- name: Build Powerline
run: |
fontforge -script font-patcher --careful --powerline --custom SomeExtraSymbols.otf \
--no-progressbars --mono prepared/CascadiaCodePL.ttf | tee process.log
git describe --always --tags | xargs fontforge rename-font --input C*.ttf \
--output "Delugia Nerd Font.ttf" \
--name "Delugia Nerd Font" \
--version
rm C*.ttf
fontforge -script font-patcher --careful --powerline --custom SomeExtraSymbols.otf \
--no-progressbars --mono prepared/CascadiaMonoPL.ttf | tee process_mono.log
git describe --always --tags | xargs fontforge rename-font --input C*.ttf \
--output "Delugia Mono Nerd Font.ttf" \
--name "Delugia Mono Nerd Font" \
--version
rm C*.ttf
./do_generate 01 --powerline --mono CascadiaCodePL-Regular.ttf DelugiaPL.ttf "Delugia PL" "Regular"
./do_generate 02 --powerline --mono CascadiaCodePL-Bold.ttf DelugiaPL-Bold.ttf "Delugia PL" "Bold"
./do_generate 03 --powerline --mono CascadiaCodePLItalic-Italic.ttf DelugiaPL-Italic.ttf "Delugia PL" "Italic"
./do_generate 04 --powerline --mono CascadiaCodePLItalic-BoldItalic.ttf DelugiaPL-BoldItalic.ttf "Delugia PL" "Bold Italic"
./do_generate 05 --powerline --mono CascadiaCodePL-Light.ttf DelugiaPLLight.ttf "Delugia PL Light" ""
./do_generate 06 --powerline --mono CascadiaCodePLItalic-LightItalic.ttf DelugiaPLLight-Italic.ttf "Delugia PL Light" "Italic"
mkdir delugia-powerline
mv Delugia*ttf delugia-powerline
zip delugia-powerline.zip delugia-powerline/*
- name: Build MonoPowerline
run: |
./do_generate 11 --powerline --mono CascadiaMonoPL-Regular.ttf DelugiaMonoPL.ttf "Delugia PL Mono" "Regular"
./do_generate 12 --powerline --mono CascadiaMonoPL-Bold.ttf DelugiaMonoPL-Bold.ttf "Delugia PL Mono" "Bold"
./do_generate 13 --powerline --mono CascadiaMonoPLItalic-Italic.ttf DelugiaMonoPL-Italic.ttf "Delugia PL Mono" "Italic"
./do_generate 14 --powerline --mono CascadiaMonoPLItalic-BoldItalic.ttf DelugiaMonoPL-BoldItalic.ttf "Delugia PL Mono" "Bold Italic"
./do_generate 15 --powerline --mono CascadiaMonoPL-Light.ttf DelugiaMonoPLLight.ttf "Delugia PL Mono Light" ""
./do_generate 16 --powerline --mono CascadiaCodePLItalic-LightItalic.ttf DelugiaMonoPLLight-Italic.ttf "Delugia PL Mono Light" "Italic"
mkdir delugia-mono-powerline
mv Delugia*ttf delugia-mono-powerline
zip delugia-mono-powerline.zip delugia-mono-powerline/*
- name: Build Complete
run: |
fontforge -script font-patcher --careful -c --custom SomeExtraSymbols.otf \
--no-progressbars --mono prepared/CascadiaCodePL.ttf | tee process_full.log
git describe --always --tags | xargs fontforge rename-font --input C*.ttf \
--output "Delugia Nerd Font Complete.ttf" \
--name "Delugia Nerd Font" \
--version
rm C*.ttf
fontforge -script font-patcher --careful -c --custom SomeExtraSymbols.otf \
--no-progressbars --mono prepared/CascadiaMonoPL.ttf | tee process_mono_full.log
git describe --always --tags | xargs fontforge rename-font --input C*.ttf \
--output "Delugia Mono Nerd Font Complete.ttf" \
--name "Delugia Mono Nerd Font" \
--version
rm C*.ttf
./do_generate 21 -c --mono CascadiaCodePL-Regular.ttf DelugiaComplete.ttf "Delugia" "Regular"
./do_generate 22 -c --mono CascadiaCodePL-Bold.ttf DelugiaComplete-Bold.ttf "Delugia" "Bold"
./do_generate 23 -c --mono CascadiaCodePLItalic-Italic.ttf DelugiaComplete-Italic.ttf "Delugia" "Italic"
./do_generate 24 -c --mono CascadiaCodePLItalic-BoldItalic.ttf DelugiaComplete-BoldItalic.ttf "Delugia" "Bold Italic"
./do_generate 25 -c --mono CascadiaCodePL-Light.ttf DelugiaCompleteLight.ttf "Delugia Light" ""
./do_generate 26 -c --mono CascadiaCodePLItalic-LightItalic.ttf DelugiaCompleteLight-Italic.ttf "Delugia Light" "Italic"
mkdir delugia-complete
mv Delugia*ttf delugia-complete
zip delugia-complete.zip delugia-complete/*
- name: Build Mono Complete
run: |
./do_generate 31 -c --mono CascadiaMonoPL-Regular.ttf DelugiaMonoComplete.ttf "Delugia Mono" "Regular"
./do_generate 32 -c --mono CascadiaMonoPL-Bold.ttf DelugiaMonoComplete-Bold.ttf "Delugia Mono" "Bold"
./do_generate 33 -c --mono CascadiaMonoPLItalic-Italic.ttf DelugiaMonoComplete-Italic.ttf "Delugia Mono" "Italic"
./do_generate 34 -c --mono CascadiaMonoPLItalic-BoldItalic.ttf DelugiaMonoComplete-BoldItalic.ttf "Delugia Mono" "Bold Italic"
./do_generate 35 -c --mono CascadiaMonoPL-Light.ttf DelugiaMonoCompleteLight.ttf "Delugia Mono Light" ""
./do_generate 36 -c --mono CascadiaCodePLItalic-LightItalic.ttf DelugiaMonoCompleteLight-Italic.ttf "Delugia Mono Light" "Italic"
mkdir delugia-mono-complete
mv Delugia*ttf delugia-mono-complete
zip delugia-complete.zip delugia-mono-complete/*
- name: Build Book Complete
run: |
fontforge -script font-patcher --careful -c --custom SomeExtraSymbols.otf \
--no-progressbars prepared/CascadiaCodePL.ttf | tee process_book.log
git describe --always --tags | xargs fontforge rename-font --input C*.ttf \
--output "Delugia Nerd Font Book.ttf" \
--name "Delugia Nerd Font Book" \
--version
rm C*.ttf
./do_generate 41 -c -c CascadiaCodePL-Regular.ttf DelugiaBook.ttf "Delugia Book" "Regular"
./do_generate 42 -c -c CascadiaCodePL-Bold.ttf DelugiaBook-Bold.ttf "Delugia Book" "Bold"
./do_generate 43 -c -c CascadiaCodePLItalic-Italic.ttf DelugiaBook-Italic.ttf "Delugia Book" "Italic"
./do_generate 44 -c -c CascadiaCodePLItalic-BoldItalic.ttf DelugiaBook-BoldItalic.ttf "Delugia Book" "Bold Italic"
./do_generate 45 -c -c CascadiaCodePL-Light.ttf DelugiaBookLight.ttf "Delugia Book Light" ""
./do_generate 46 -c -c CascadiaCodePLItalic-LightItalic.ttf DelugiaBookLight-Italic.ttf "Delugia Book Light" "Italic"
mkdir delugia-book
mv Delugia*ttf delugia-book
zip delugia-book.zip delugia-book/*
- name: Check for preexisting glyphs
run: |
grep 'Found existing' process*.log
- uses: actions/upload-artifact@master
with:
name: Delugia Nerd Font Powerline
path: "Delugia Nerd Font.ttf"
name: Delugia Powerline
path: "delugia-powerline"
- uses: actions/upload-artifact@master
with:
name: Delugia Nerd Font Complete
path: "Delugia Nerd Font Complete.ttf"
name: Delugia Mono Powerline
path: "delugia-mono-powerline"
- uses: actions/upload-artifact@master
with:
name: Delugia Nerd Font Book
path: "Delugia Nerd Font Book.ttf"
name: Delugia Complete
path: "delugia-complete"
- uses: actions/upload-artifact@master
with:
name: Delugia Mono Nerd Font Powerline
path: "Delugia Mono Nerd Font.ttf"
name: Delugia Mono Complete
path: "delugia-mono-complete"
- uses: actions/upload-artifact@master
with:
name: Delugia Mono Nerd Font Complete
path: "Delugia Mono Nerd Font Complete.ttf"
name: Delugia Book
path: "delugia-book"

# Release part
- name: Create tag
Expand All @@ -161,7 +172,7 @@ jobs:
object: context.sha,
type: "commit"
})

github.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
Expand All @@ -178,10 +189,10 @@ jobs:
with:
tag_name: ${{ startsWith(github.ref, 'refs/tags/') && steps.get_tag_name.outputs.version || needs.check-for-new-cascadia.outputs.tag_name }}
files: |
Delugia Nerd Font.ttf
Delugia Nerd Font Complete.ttf
Delugia Nerd Font Book.ttf
Delugia Mono Nerd Font.ttf
Delugia Mono Nerd Font Complete.ttf
delugia-powerline.zip
delugia-mono-powerline.zip
delugia-complete.zip
delugia-mono-complete.zip
delugia-book.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
CascadiaCode*zip
src/
otf/
ttf/
woff2/
font-patcher*
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 Adam Cooper
Copyright (c) 2020-2021 Adam Cooper

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
38 changes: 28 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Cascadia Code + Nerd Fonts
![delugia image](/delugia_book.png)
# Cascadia Code + Nerd Fonts
Can we add Nerd Fonts to the [Cascadia Code](https://github.com/microsoft/cascadia-code) font using a GitHub Action?

Inspired by [Scott Hanselman](https://www.hanselman.com/blog/PatchingTheNewCascadiaCodeToIncludePowerlineGlyphsAndOtherNerdFontsForTheWindowsTerminal.aspx) and [Alistair Young](https://github.com/microsoft/cascadia-code/issues/10?WT.mc_id=-blog-scottha#issuecomment-532969414).
Expand Down Expand Up @@ -36,33 +37,50 @@ _Complete_ includes these symbols additionally:
* [Octicons](https://github.com/github/octicons)

### Which font faces are available
Cascadia now bundles a version without ligatures, called Cascadia Mono, in addition to Cascadia Code which has ligatures.

These three faces are generated from Cascadia Code:
* **Delugia Nerd Font Powerline** _Basic glyphs, monospaced font_
* **Delugia Nerd Font Complete** _All Nerd Fonts glyphs, monospaced font_
* **Delugia Nerd Font Book** _All Nerd Fonts glyphs, proportional font (not recommended for coding/console)_
These three font versions are generated from Cascadia Code:
* **Delugia Powerline** _Basic powerline glyphs, monospaced font_
* **Delugia Complete** _All Nerd Fonts glyphs, monospaced font_
* **Delugia Book** _All Nerd Fonts glyphs, proportional font (not recommended for coding/console)_

And the following two faces are generated from Cascadia Mono and don't have ligatures:
* **Delugia Mono Nerd Font Powerline** _Basic glyphs, monospaced font_
* **Delugia Mono Nerd Font Complete** _All Nerd Fonts glyphs, monospaced font_
* **Delugia Mono Powerline** _Basic powerline glyphs, monospaced font_
* **Delugia Mono Complete** _All Nerd Fonts glyphs, monospaced font_

All of these are available in light, regular, and bold weights. Complemented by matching italic fonts.

### 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

### How to use
You can download the patched font from the [Releases page](https://github.com/adam7/delugia-code/releases) of this repo and install them as you would any other font. Once installed the font can be referenced as `Delugia Nerd Font`. So if, for example, you want to use it in Windows Terminal you should add this line to your profiles.json
You can download the patched fonts from the [Releases page](https://github.com/adam7/delugia-code/releases) of this
repo and install them as you would any other font. Once installed the font can be referenced as `Delugia *`.
So if, for example, you want to use it in Windows Terminal you should add this line to your profiles.json

`"fontFace" : "Delugia Nerd Font",`
`"fontFace" : "Delugia Complete",`

### Installation with [scoop.sh](https://scoop.sh)
_Scoop installation needs to be repaired after a naming change, I guess._

You can use [scoop.sh](https://scoop.sh) to install and update the font. At first install [scoop](https://github.com/lukesampson/scoop) and add extra bucket for [nerd-fonts](https://github.com/matthewjberger/scoop-nerd-fonts):
1) `iwr -useb get.scoop.sh | iex`
2) `scoop bucket add nerd-fonts`
3) `scoop install sudo`
4) `sudo scoop install Delugia-Nerd-Font` or `sudo scoop install Delugia-Nerd-Font-Complete`

### Example for Delugia on the command line

![Delugia Powerline](/delugia_powerline.png)

### Help!
I know basically nothing about patching fonts so all contributions are 🦸‍ welcome.

### Note
The naming changed a bit when we added the light and bold fonts.
To reduce the font name length the 'Nerd Font' has been dropped out of the (file) names.
The actual naming scheme changed to accommodate the new fonts and for your convenience we pack
fonts that one particular user might want to use together in a zip archive.
Binary file added delugia_book.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added delugia_powerline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions do_generate
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env sh
#
# Create and rename one font style according to the specs
#
# Example invocation:
# do_generate 01 --powerline --mono CascadiaCodePL-Regular.ttf DelugiaPowerline.ttf Delugia Regular
#
# No parameters are checked, but they are:
# 1: Number of logfile
# 2: Conversion spec #1
# 3: Conversion spec #2
# 4: Input font file name
# 5: Output font file name
# 6: Font family name
# 7: Font style name addendum

set -e

if [ "$#" -ne 7 ]; then
exit 1
fi

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

OURVERSION=`git describe --always --tags`
fontforge rename-font --input C*.ttf --output "${5}" --name "${6}" --style "${7}" --version "${OURVERSION}"
14 changes: 0 additions & 14 deletions prepare-font

This file was deleted.

20 changes: 13 additions & 7 deletions rename-font
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,25 @@ parser = ArgumentParser()
parser.add_argument("--input", help="input file name")
parser.add_argument("--output", help="output file name")
parser.add_argument("--name", help="font name")
parser.add_argument("--version", help="(optional) text to add to the existing version")
parser.add_argument("--style", help="font sub-style")
parser.add_argument("--version", help="text to add to the existing version")
args = parser.parse_args()

if args.style:
args.style = " " + args.style
fullname = "{}{}".format(args.name, args.style)

# Open the file
delugia=fontforge.open(args.input)

# Rename the file
delugia.fontname="{}-Regular".format(args.name).replace(" ", "")
delugia.familyname=args.name
delugia.fullname=args.name
delugia.fontname = fullname.replace(" ", "")
delugia.familyname = args.name
delugia.fullname = fullname
delugia.appendSFNTName("English (US)", "Family", args.name)
delugia.appendSFNTName("English (US)", "Preferred Family", args.name)
delugia.appendSFNTName("English (US)", "Compatible Full", args.name)
delugia.appendSFNTName("English (US)", "UniqueID", "{} Regular".format(args.name))
delugia.appendSFNTName("English (US)", "Compatible Full", fullname)
delugia.appendSFNTName("English (US)", "UniqueID", "{};{}{}".format(args.version, args.name, args.style))
delugia.appendSFNTName("English (US)", "Trademark", "")

# Mix our version information in
Expand All @@ -31,4 +37,4 @@ delugia.version = args.version

# Save
delugia.generate(args.output)
print("Generated '{}' from {} version {}".format(args.output, args.name, args.version))
print("Generated '{}' from {}{} version {}".format(args.output, args.name, args.style, args.version))