diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e2b82d0..a0fe812 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -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 @@ -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' }} @@ -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!'` @@ -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 @@ -161,7 +172,7 @@ jobs: object: context.sha, type: "commit" }) - + github.git.createRef({ owner: context.repo.owner, repo: context.repo.repo, @@ -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 }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8f6a31f --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +CascadiaCode*zip +src/ +otf/ +ttf/ +woff2/ +font-patcher* diff --git a/LICENSE b/LICENSE index cad6bbf..f5d3813 100644 --- a/LICENSE +++ b/LICENSE @@ -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 diff --git a/README.md b/README.md index 54a1bc1..7ea4750 100644 --- a/README.md +++ b/README.md @@ -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). @@ -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. diff --git a/delugia_book.png b/delugia_book.png new file mode 100644 index 0000000..7d75179 Binary files /dev/null and b/delugia_book.png differ diff --git a/delugia_powerline.png b/delugia_powerline.png new file mode 100644 index 0000000..36fdebd Binary files /dev/null and b/delugia_powerline.png differ diff --git a/do_generate b/do_generate new file mode 100755 index 0000000..ab9989a --- /dev/null +++ b/do_generate @@ -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}" diff --git a/prepare-font b/prepare-font deleted file mode 100644 index 2c8a669..0000000 --- a/prepare-font +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env python -# coding=utf8 - -import fontforge -from argparse import ArgumentParser - -# Setup and parse the comand-line arguments -parser = ArgumentParser() -parser.add_argument("--input", help="input file name") -parser.add_argument("--output", help="output file name") -args = parser.parse_args() - -# Just open and save the font, to fix some internal structure -fontforge.open(args.input).generate(args.output) diff --git a/rename-font b/rename-font index 2018a7b..f4b8247 100644 --- a/rename-font +++ b/rename-font @@ -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 @@ -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))