Skip to content

Commit

Permalink
Create Light and Italic font faces (#59)
Browse files Browse the repository at this point in the history
* Add gitignore file

[why]
It is easier to work with the scripts and git, if all normally created
intermediate files are ignored. It allows to do a 'git clean -f' for
example.

Signed-off-by: Fini Jastrow <[email protected]>

* rename-font: Correct help text

[why]
The version parameter is not optional, so it should not be noted as
optional.

I'm not sure if it ever was optional, maybe a leftover from a different,
previous approach.

Signed-off-by: Fini Jastrow <[email protected]>

* rename-font: Add option to specify style

[why]
The script is hardcoded to provide a 'Regular' font face. Now that we
want to generate other faces we need to be more flexible.

[how]
Add a parameter that is used in the appropriate places.

Sometimes the style has no additional name ("Italic" face). To allow
that we need to be careful with added blancs in the name strings.

Signed-off-by: Fini Jastrow <[email protected]>

* Add light and bold (and italic) faces

[why]
The demand for correctly working bold and italic fonts can not be
satisfied with our simple approach.

We need a whole lot more fonts!

[how]
Use the static Cascadia font versions and do the patching on all
relevant fonts.

Use a helper script to invoke the actual patching to hide all the
parameters that stay the same for all the fonts.

Group the created fonts by interest (small (powerline), complete, book)
and release as zip packages.

Signed-off-by: Fini Jastrow <[email protected]>

* remove prepare script

[why]
When we work with the static font files we do not need to prepare (fix
for working with them in fontforge) them anymore.

Signed-off-by: Fini Jastrow <[email protected]>

* Fix font versioning

[why]
The version in the font files reflects not the version name we want to
have. In fact it is just the git hash of the topmost commit and not the
git tag.

[how]
When switching to actions/checkout@v2 we only fetch the latest commit into
the git workflow (for performance reasons is this the default). But that
lacks all the tags, that we use to communicate the font version.

Now we resort to full depth cloning of the Delugia repository, which is
tiny anyway.

[note]
Action had been updated from @1 to @2 with commit
  22d4cae Combine workflows (#57)

Signed-off-by: Fini Jastrow <[email protected]>

* Change general font family naming scheme

[why]
We have 'normal' and 'bold' in one font family, but the 'italic' is in a
separate family. Some applications can group the weights/styles of one
font family in a way that allows to select 'bold' and/or 'italic' in the
application easily - without choosing a different font.

This seems to be broken if the italics is in a separate font family.

We have these families -> styles:

Deligia{}
  -> Regular, Bold
Delugia{}Light
  -> "" (Regular)
Delugia{}Italic
  -> Italic, Bold-Italic
Delugia{}ItalicLight
  -> Italic

[how]
Restructure the family names -> styles as such:

Deligia{}
  -> Regular, Bold, Italic, Bold-Italic
Delugia{}Light
  -> "" (Regular), Bold

[note]
With {} being our 5 styles:
  PL, MonoPL, Complete, MonoComplete, Book

Signed-off-by: Fini Jastrow <[email protected]>

* Fill the full name into fullname fields

[why]
The full name fields should contain the full name (obviously)
including the subfamily.

Signed-off-by: Fini Jastrow <[email protected]>

* Create more unique UniqueID

[why]
If one specific font is to be identified we need an ID that changes with
new revisions.

[how]
Add the version to the ID.

Signed-off-by: Fini Jastrow <[email protected]>

* Change to release in 5 archives

[why]
These Families are created:
- Delugia PL
- Delugia Mono PL
- Delugia Complete
- Delugia Mono Complete
- Delugia Book

At the moment we put both non-mono and mono families into one archive
like so:
1. Delugia PL and Delugia Mono PL
2. Delugia Complete and Delugia Mono Complete
3. Delugia Book

For some users it might make more sense to bundle the non-mono and mono
fonts. The majority probably needs just one family.

It might be unclear for users that these are 5 independent font sets.

[how]
Just stuff the files into more archives:
1. Delugia PL
2. Delugia Complete
3. Delugia Book

Ligarture-less variants:
4. Delugia Mono PL
5. Delugia Mono Complete

Signed-off-by: Fini Jastrow <[email protected]>

* Whitespace cleanup

Signed-off-by: Fini Jastrow <[email protected]>

* Correct license year

Signed-off-by: Fini Jastrow <[email protected]>

* readme: Remove old news

Signed-off-by: Fini Jastrow <[email protected]>

* readme: Add font sample images

Signed-off-by: Fini Jastrow <[email protected]>
  • Loading branch information
Finii authored Jun 30, 2021
1 parent 22d4cae commit c1339ee
Show file tree
Hide file tree
Showing 9 changed files with 144 additions and 90 deletions.
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/[email protected]
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))

0 comments on commit c1339ee

Please sign in to comment.