Skip to content

Modifying Cascadia Code

Dustin L. Howett (MSFT) edited this page Jan 8, 2020 · 2 revisions

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA.

Getting started

The font is currently available as a (Unified Font Object) UFO + designspace file. This is a universal format that can be opened / exported from all major typeface design tools (Glyphs, Robofont, Fontlab VI, Fontforge). An understanding of Microsoft VTT (Windows) and FontTools is also recommended for modification of the font's hinting. A Glyphs source is also provided in the 'releases' tab for your convenience.

Please note that the hinting code is point order and glyph order specific. As a result, be aware that glyph modifications may require necessitate corrections to the hinting to ensure proper rendering.

Building the font from source

While the UFO can be edited and OTF / TTF exported directly from any of the aforementioned typeface design tools, you may want to build the font with hinting included, or with Nerd fonts integrated. This process requires the use of Microsoft VTT (to compile the hints) and FontTools.

  1. Download the source code for Cascadia Code via the "download" button, or from the command line: 'git clone https://github.com/microsoft/cascadia-code.git'

  2. Install Python 3. If you're on a Windows machine, you may also need to install pip; https://bootstrap.pypa.io/get-pip.py

  3. While not necessary, we recommend creating a virtual environment

# create new virtual environment called e.g. 'fonttools-venv', or anything you like
python3 -m venv fonttools-venv

# source the `activate` shell script to enter the environment; to exit, just type `deactivate`
. fonttools-venv/bin/activate

# to activate the virtual environment in Windows `cmd.exe`, do
fonttools-venv\Scripts\activate.bat
  1. Install required font libraries. Navigate to the Cascadia Code folder downloaded in step 1.
pip3 install -r requirements.txt
pip3 install git+https://github.com/daltonmaag/vttLib.git
  1. Build the font from source:
python3 build.py

This will build the TTF font in the "build" folder.

  1. Open CascadiaCode.ttf in VTT. Run Tools > Compile > Everything for all glyphs. This may throw some errors at first, but if you re-run the compile, it should be OK! Run the "ship font" command to produce a compiled TTF font with the manual hints.

Assuming everything has worked without issue, a new version of the font, "Cascadia-ship.ttf" should have been created in the same folder that is ready to go!

Creating a Pull Request

At the moment, we do not have a testing framework for verifying proper character creation. When creating a pull request, please heavily document the steps you took along with images displaying your changes. Additionally, please provide images of the updated character(s) at different screen sizes to validate proper hinting.