Skip to content

Commit

Permalink
February 2021 update (#402)
Browse files Browse the repository at this point in the history
This is a significant update to Cascadia Code including a large number
of bug fixes as well as updating the font to offer support for Fira
Code v5 ligature support. 

This update supersedes PR #373.

Closes #262 - ⏎ added
Closes #264 - additional codepoints for control characters added
Closes #281 - `!:` and `!.` added
Closes #290 - `/\` and `\/` added
Closes #301 - `??=` added
Closes #324 - ℞ added
Closes #327 - `<:>` and other variants implemented via the `calt`
  refactoring
Closes #359 - house added
Closes #371 - Added x-height instruction into ttfautohint to control the
  height of the lowercase.  
Closes #375 - Completely redesigned quote marks for better recognition
Closes #377 - updated hinting to achieve more consistent results
Closes #381 - increased height of thetamod
Closes #382 - reduced the width of the hooklefts
Closes #383 - updated heights on esh, glottalstop, glottalstopreversed
Closes #384 - tweaked hinting a little bit. Maybe it'll help :)
Closes #386 - added remaining soft-dotting
Closes #392 - changed designs of angled quotes (they are now round)
Closes #394 - changed former `~=` symbol to a simpler component-based
  version. Should be less confusing now for Lua / Matlab users. 
Closes #395 - makes the underline thicker based on font weight
Closes #400 - increased size of degree

Closes #219 
The full control pictures block has been added (u+2400 to u+2426). For
purposes of rendering, the two letter abbreviations have been used
instead of the standard three letter abbreviations:

Additionally, ss20 includes the oft-unused graphical representations of
these codepoints (for fun!):

Closes #276 (infinite arrows)
Full support for Fira Code's current ligature set (with a few
exceptions). Now featuring infinite arrows!!! 

This involved a full refactoring of the `calt` feature—for those
interested, it now uses forward-looking substitutions instead of
backward-looking substitutions and progressive substitution to reduce
code. This also required some redesigning of the greater / lesser
related ligatures. Please note, I have also removed all the obsolete
ligatures now covered by the arrows code.

Closes #329 
There was a mismatch in the font's postscript naming conventions that
was corrected. Should now render all weights in Word. **Note** there is
apparently an additional bug in Mac Word's implementation of variable
fonts which should be available in an update mid-Feb. 

* Not listed – Reworked the hints for the mod and superscript glyphs so
  that they're bottom-up rather than top-down. This allows for better
  bottom alignments. 

Aside from the above changes, this version also includes many other
small updates including spacing, outline quality improvements, and
fixing hinting.
  • Loading branch information
aaronbell authored Feb 9, 2021
1 parent 643858a commit 00f3fd4
Show file tree
Hide file tree
Showing 5,209 changed files with 47,577 additions and 74,399 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -337,3 +337,5 @@ newVTT.xml
converter.py
salishan/
fixTSI1.py
venv/
.vscode/settings.json
52 changes: 39 additions & 13 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import subprocess
from pathlib import Path
from typing import cast
import xml.etree.cElementTree as ET
import tempfile

import cffsubr.__main__
import fontmake.instantiator
Expand All @@ -18,9 +20,10 @@
import ufoLib2
import vttLib
import vttLib.transfer
from vttmisc import tsi1, tsic

VERSION_YEAR_MONTH = 2009
VERSION_DAY = 22
VERSION_YEAR_MONTH = 2102
VERSION_DAY = 3

OUTPUT_DIR = Path("build")
OUTPUT_OTF_DIR = OUTPUT_DIR / "otf"
Expand All @@ -30,7 +33,7 @@
OUTPUT_STATIC_TTF_DIR = OUTPUT_TTF_DIR / "static"
OUTPUT_STATIC_WOFF2_DIR = OUTPUT_WOFF2_DIR / "static"
INPUT_DIR = Path("sources")
VTT_DATA_FILE = INPUT_DIR / "vtt_data" / "CascadiaCode.ttx"
VTT_DATA_FILE = INPUT_DIR / "vtt_data" / "CascadiaCode_VTT.ttf"
FEATURES_DIR = INPUT_DIR / "features"
NERDFONTS_DIR = INPUT_DIR / "nerdfonts"

Expand Down Expand Up @@ -89,11 +92,6 @@ def set_overlap_flag(varfont: fontTools.ttLib.TTFont) -> fontTools.ttLib.TTFont:
# Set OVERLAP_SIMPLE bit for simple glyphs
glyph.flags[0] |= 0x40

def manualHacks(varfont: fontTools.ttLib.TTFont) -> fontTools.ttLib.TTFont:
varfont["head"].flags = 0x000b
varfont.importXML(INPUT_DIR / "cvar.ttx")


def prepare_fonts(
designspace: fontTools.designspaceLib.DesignSpaceDocument, name: str
) -> None:
Expand Down Expand Up @@ -134,7 +132,6 @@ def to_woff2(source_path: Path, target_path: Path) -> None:
target_path.parent.mkdir(exist_ok=True, parents=True)
font.save(target_path)


# Build fonts
# ****************************************************************

Expand Down Expand Up @@ -179,16 +176,43 @@ def compile_variable_and_save(
statmake.lib.apply_stylespace_to_variable_font(styleSpace, varFont, {})

print(f"[{familyName}] Merging VTT")
vttLib.transfer.merge_from_file(varFont, VTT_DATA_FILE)

font_vtt = fontTools.ttLib.TTFont(VTT_DATA_FILE)

for table in ["TSI0", "TSI1", "TSI2", "TSI3", "TSI5", "TSIC", "maxp"]:
varFont[table] = fontTools.ttLib.newTable(table)
varFont[table] = font_vtt[table]

# this will correct the OFFSET[R] commands in TSI1
if font_vtt.getGlyphOrder() != varFont.getGlyphOrder():
tsi1.fixOFFSET(varFont, font_vtt)
pass

if vtt_compile:
print(f"[{familyName}] Compiling VTT")

tree = ET.ElementTree()
TSICfile = tempfile.NamedTemporaryFile()
varFont.saveXML(TSICfile.name, tables=["TSIC"])
tree = ET.parse(TSICfile.name)
vttLib.compile_instructions(varFont, ship=True)
tsic.makeCVAR(varFont, tree)

else:
file_path = Path(str(file_path)[:-4]+"_VTT.ttf")

set_overlap_flag(varFont)

# last minute manual corrections to set things correctly
manualHacks(varFont)

# flag to enable proper rendering
# Adjusted the font full name so that it aligns with font spec, and also shows as expected!
# Adjusting postscript name to make room for the upcoming Italic
# Helping mac office generage the postscript name correctly for variable fonts
varFont["head"].flags = 0x000b
varFont["name"].setName(familyName, 4, 3, 1, 1033)
varFont["name"].setName(familyName.replace(" ","")+"-Roman", 6, 3, 1, 1033)
varFont["name"].setName("Roman", 17, 3, 1, 1033)
varFont["name"].setName(familyName.replace(" ","")+"Roman", 25, 3, 1, 1033)

print(f"[{familyName}] Saving")
file_path.parent.mkdir(exist_ok=True, parents=True)
Expand Down Expand Up @@ -250,6 +274,8 @@ def ttfautohint(path: str) -> None:
"ttfautohint",
"--stem-width",
"nsn",
"--increase-x-height",
"0",
"--reference",
os.fspath(OUTPUT_STATIC_TTF_DIR / "CascadiaCode-Regular.ttf"),
path,
Expand Down Expand Up @@ -302,7 +328,7 @@ def ttfautohint(path: str) -> None:
)
)
if args.mono:
processes.append(
processes.append(
pool.apply_async(
build_font_variable,
(
Expand Down
1 change: 1 addition & 0 deletions requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ statmake
vttLib
skia-pathops
fontTools[ufo,lxml,woff]
vttmisc
6 changes: 5 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ compreffor==0.5.0 # via ufo2ft
cu2qu==1.6.7 # via fontmake, ufo2ft
fontmake==2.2.1 # via -r requirements.in
fontmath==0.6.0 # via fontmake
fonttools[lxml,ufo,unicode,woff]==4.15.0 # via -r requirements.in, booleanoperations, cffsubr, compreffor, cu2qu, fontmake, fontmath, glyphslib, psautohint, statmake, ufo2ft, ufolib2, vttlib
fonttools[lxml,ufo,unicode,woff]==4.15.0 # via -r requirements.in, booleanoperations, cffsubr, compreffor, cu2qu, fontmake, fontmath, glyphslib, psautohint, statmake, ufo2ft, ufolib2, vttlib, vttmisc
fs==2.4.11 # via fonttools
glyphslib==5.2.0 # via fontmake
importlib-metadata==1.7.0 # via statmake
lxml==4.5.2 # via fonttools
psautohint==2.1.0 # via -r requirements.in
pyclipper==1.2.0 # via booleanoperations
Expand All @@ -25,10 +26,13 @@ pytz==2020.1 # via fs
six==1.15.0 # via fs
skia-pathops==0.4.1 # via -r requirements.in
statmake==0.3.0 # via -r requirements.in
typing-extensions==3.7.4.3 # via ufolib2
ufo2ft[cffsubr]==2.16.0 # via fontmake
ufolib2==0.8.0 # via fontmake, glyphslib, vttlib
unicodedata2==13.0.0.post2 # via fonttools
vttlib==0.9.1.post2 # via -r requirements.in
vttmisc==0.0.2 # via -r requirements.in
zipp==3.2.0 # via importlib-metadata
zopfli==0.1.7 # via fonttools

# The following packages are considered to be unsafe in a requirements file:
Expand Down
1,537 changes: 743 additions & 794 deletions sources/CascadiaCode-Bold.ufo/features.fea

Large diffs are not rendered by default.

42 changes: 36 additions & 6 deletions sources/CascadiaCode-Bold.ufo/fontinfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
<key>name</key>
<string> [locked]</string>
<key>x</key>
<integer>1100</integer>
<integer>1117</integer>
<key>y</key>
<integer>1080</integer>
<integer>333</integer>
</dict>
<dict>
<key>angle</key>
Expand All @@ -42,17 +42,17 @@
<key>x</key>
<integer>1052</integer>
<key>y</key>
<integer>1500</integer>
<integer>-543</integer>
</dict>
<dict>
<key>angle</key>
<integer>0</integer>
<key>name</key>
<string> [locked]</string>
<key>x</key>
<integer>1276</integer>
<integer>1492</integer>
<key>y</key>
<integer>1440</integer>
<integer>-819</integer>
</dict>
<dict>
<key>angle</key>
Expand Down Expand Up @@ -162,6 +162,36 @@
<key>y</key>
<integer>2226</integer>
</dict>
<dict>
<key>angle</key>
<integer>0</integer>
<key>name</key>
<string> [locked]</string>
<key>x</key>
<integer>1117</integer>
<key>y</key>
<integer>1085</integer>
</dict>
<dict>
<key>angle</key>
<integer>0</integer>
<key>name</key>
<string> [locked]</string>
<key>x</key>
<integer>1117</integer>
<key>y</key>
<integer>843</integer>
</dict>
<dict>
<key>angle</key>
<integer>0</integer>
<key>name</key>
<string> [locked]</string>
<key>x</key>
<integer>1117</integer>
<key>y</key>
<integer>575</integer>
</dict>
</array>
<key>italicAngle</key>
<integer>0</integer>
Expand Down Expand Up @@ -249,7 +279,7 @@ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
<key>postscriptUnderlinePosition</key>
<integer>-100</integer>
<key>postscriptUnderlineThickness</key>
<integer>50</integer>
<integer>150</integer>
<key>styleMapFamilyName</key>
<string>Cascadia Code</string>
<key>styleMapStyleName</key>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version='1.0' encoding='UTF-8'?>
<glyph name="Alpha-latin" format="2">
<outline>
<contour>
<point x="530" y="-27" type="curve" smooth="yes"/>
<point x="693" y="-27"/>
<point x="769" y="64"/>
<point x="786" y="189" type="curve"/>
<point x="873" y="189" type="line"/>
<point x="794" y="608" type="line"/>
<point x="794" y="259"/>
<point x="757" y="157"/>
<point x="562" y="157" type="curve" smooth="yes"/>
<point x="375" y="157"/>
<point x="278" y="339"/>
<point x="278" y="693" type="curve" smooth="yes"/>
<point x="278" y="1051"/>
<point x="379" y="1256"/>
<point x="562" y="1256" type="curve" smooth="yes"/>
<point x="716" y="1256"/>
<point x="794" y="1129"/>
<point x="794" y="874" type="curve"/>
<point x="856" y="1222" type="line"/>
<point x="775" y="1222" type="line"/>
<point x="769" y="1361"/>
<point x="706" y="1440"/>
<point x="530" y="1440" type="curve" smooth="yes"/>
<point x="237" y="1440"/>
<point x="68" y="1168"/>
<point x="68" y="693" type="curve" smooth="yes"/>
<point x="68" y="229"/>
<point x="222" y="-27"/>
</contour>
</outline>
</glyph>
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?xml version='1.0' encoding='UTF-8'?>
<glyph name="Gstroke" format="2">
<outline>
<contour>
<point x="702" y="-20" type="curve" smooth="yes"/>
<point x="890" y="-20"/>
<point x="1048" y="22"/>
<point x="1107" y="40" type="curve"/>
<point x="1012" y="282" type="line"/>
<point x="950" y="264"/>
<point x="852" y="232"/>
<point x="726" y="232" type="curve" smooth="yes"/>
<point x="461" y="232"/>
<point x="327" y="395"/>
<point x="327" y="722" type="curve" smooth="yes"/>
<point x="327" y="1019"/>
<point x="466" y="1189"/>
<point x="706" y="1189" type="curve" smooth="yes"/>
<point x="812" y="1189"/>
<point x="909" y="1142"/>
<point x="971" y="1063" type="curve"/>
<point x="1137" y="1254" type="line"/>
<point x="1053" y="1372"/>
<point x="901" y="1440"/>
<point x="694" y="1440" type="curve" smooth="yes"/>
<point x="285" y="1440"/>
<point x="49" y="1174"/>
<point x="49" y="712" type="curve" smooth="yes"/>
<point x="49" y="224"/>
<point x="267" y="-20"/>
</contour>
<contour>
<point x="845" y="40" type="line"/>
<point x="1107" y="40" type="line"/>
<point x="1107" y="735" type="line"/>
<point x="845" y="735" type="line"/>
</contour>
<contour>
<point x="610" y="492" type="line"/>
<point x="1101" y="492" type="line"/>
<point x="1101" y="735" type="line"/>
<point x="610" y="735" type="line"/>
</contour>
</outline>
</glyph>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version='1.0' encoding='UTF-8'?>
<glyph name="KaiSymbol" format="2">
<outline>
<contour>
<point x="276" y="452" type="line"/>
<point x="805" y="452"/>
<point x="1111" y="915"/>
<point x="1111" y="1420" type="curve"/>
<point x="843" y="1420" type="line"/>
<point x="843" y="1063"/>
<point x="673" y="717"/>
<point x="294" y="717" type="curve"/>
</contour>
<contour>
<point x="133" y="0" type="line"/>
<point x="397" y="0" type="line"/>
<point x="397" y="1420" type="line"/>
<point x="133" y="1420" type="line"/>
</contour>
<contour>
<point x="853" y="0" type="line"/>
<point x="1179" y="0" type="line"/>
<point x="814" y="731" type="line"/>
<point x="568" y="629" type="line"/>
</contour>
</outline>
</glyph>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version='1.0' encoding='UTF-8'?>
<glyph name="Nhookleft" format="2">
<outline>
<contour>
<point x="-68" y="-476" type="line"/>
<point x="12" y="-468" type="line" smooth="yes"/>
<point x="221" y="-447"/>
<point x="341" y="-316"/>
<point x="341" y="-96" type="curve" smooth="yes"/>
<point x="341" y="184" type="line"/>
<point x="148" y="184" type="line"/>
<point x="148" y="-88" type="line" smooth="yes"/>
<point x="148" y="-214"/>
<point x="95" y="-278"/>
<point x="-8" y="-294" type="curve" smooth="yes"/>
<point x="-78" y="-305" type="line"/>
</contour>
</outline>
</glyph>
Loading

0 comments on commit 00f3fd4

Please sign in to comment.