Skip to content

Commit e824d27

Browse files
add guide to create ttfautohinted fonts
1 parent e6f0384 commit e824d27

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+155
-13
lines changed

404.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<style>
2020
@font-face {
2121
font-family: "CommitMono";
22-
src: url("/src/fonts/CommitMonoV118-VF.woff2");
22+
src: url("/src/fonts/fontlab/CommitMonoV136-VF.woff2");
2323
font-style: normal;
2424
font-weight: 450;
2525
font-display: swap;

index.html

+8-4
Original file line numberDiff line numberDiff line change
@@ -1199,10 +1199,14 @@ <h2>Programs used</h2>
11991199
<script>
12001200
const versionOfCommitMono = "V136"
12011201
let fontsLoaded = false
1202-
const commitMono = new FontFace("CommitMono", `url(/src/fonts/CommitMono${versionOfCommitMono}-VF.woff2)`, {
1203-
style: "normal",
1204-
weight: "450",
1205-
})
1202+
const commitMono = new FontFace(
1203+
"CommitMono",
1204+
`url(/src/fonts/fontlab/CommitMono${versionOfCommitMono}-VF.woff2)`,
1205+
{
1206+
style: "normal",
1207+
weight: "450",
1208+
}
1209+
)
12061210
// Add to the document.fonts (FontFaceSet)
12071211
document.fonts.add(commitMono)
12081212

src/fonts/CommitMono.zip

698 KB
Binary file not shown.
259 KB
Binary file not shown.
260 KB
Binary file not shown.
261 KB
Binary file not shown.
261 KB
Binary file not shown.

src/fonts/export/custom-settings.json

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"weight":450,"italic":false,"alternates":{"cv01":false,"cv02":false,"cv03":false,"cv04":false,"cv05":false,"cv06":false,"cv07":false,"cv08":false,"cv09":false},"features":{"ss01":false,"ss02":false,"ss03":true,"ss04":true,"ss05":true},"letterSpacing":0,"lineHeight":1}

src/fonts/export/installation.txt

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
A short guide for how to install and enable your shiny new version of Commit Mono.
2+
This is taken from section 08 Install from https://commitmono.com/
3+
4+
#1 (Download the fonts)
5+
#2 Unzip the fonts. You'll see 4 font files. These 4 fonts make up a 'Style Group':
6+
* CommitMono-Regular: Base version with settings and weight of your choice.
7+
* CommitMono-Italic: An italic version, same weight as regular.
8+
* CommitMono-Bold: A bold version, weight 700.
9+
* CommitMono-BoldItalic: A bold version, weight 700, that is also italic.
10+
#3 Install all 4 fonts on your system:
11+
* Windows: Right click the font in the folder and click "Install".
12+
* Mac: Open fonts with Font Book from the folder and click "Install".
13+
* Linux: Unpack fonts to ~/.local/share/fonts (or /usr/share/fonts to install
14+
fonts system-wide) then fc-cache -f -v
15+
#4 Restart your editor/IDE.
16+
#5 Activate Commit Mono in your editor.
17+
Settings/Preferences → Editor → Font: Pick ‘CommitMono’ from the list (notice:
18+
there is no space). If you’re using VS Code, simply add these two lines to the
19+
settings.json file:
20+
"editor.fontFamily": "CommitMono",
21+
"editor.fontLigatures": true,
22+
23+
For a comprehensive guide on how to enable features/ligatures in your specific
24+
editor/IDE, refer to Fira Code wiki:
25+
https://github.com/tonsky/FiraCode/wiki#enabling-ligatures

src/fonts/export/license.txt

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
2+
This license is copied below, and is also available with a FAQ at:
3+
http://scripts.sil.org/OFL
4+
5+
-----------------------------------------------------------
6+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
7+
-----------------------------------------------------------
8+
9+
PREAMBLE
10+
The goals of the Open Font License (OFL) are to stimulate worldwide
11+
development of collaborative font projects, to support the font creation
12+
efforts of academic and linguistic communities, and to provide a free and
13+
open framework in which fonts may be shared and improved in partnership
14+
with others.
15+
16+
The OFL allows the licensed fonts to be used, studied, modified and
17+
redistributed freely as long as they are not sold by themselves. The
18+
fonts, including any derivative works, can be bundled, embedded,
19+
redistributed and/or sold with any software provided that any reserved
20+
names are not used by derivative works. The fonts and derivatives,
21+
however, cannot be released under any other type of license. The
22+
requirement for fonts to remain under this license does not apply
23+
to any document created using the fonts or their derivatives.
24+
25+
DEFINITIONS
26+
"Font Software" refers to the set of files released by the Copyright
27+
Holder(s) under this license and clearly marked as such. This may
28+
include source files, build scripts and documentation.
29+
30+
"Reserved Font Name" refers to any names specified as such after the
31+
copyright statement(s).
32+
33+
"Original Version" refers to the collection of Font Software components as
34+
distributed by the Copyright Holder(s).
35+
36+
"Modified Version" refers to any derivative made by adding to, deleting,
37+
or substituting -- in part or in whole -- any of the components of the
38+
Original Version, by changing formats or by porting the Font Software to a
39+
new environment.
40+
41+
"Author" refers to any designer, engineer, programmer, technical
42+
writer or other person who contributed to the Font Software.
43+
44+
PERMISSION & CONDITIONS
45+
Permission is hereby granted, free of charge, to any person obtaining
46+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
47+
redistribute, and sell modified and unmodified copies of the Font
48+
Software, subject to the following conditions:
49+
50+
1) Neither the Font Software nor any of its individual components,
51+
in Original or Modified Versions, may be sold by itself.
52+
53+
2) Original or Modified Versions of the Font Software may be bundled,
54+
redistributed and/or sold with any software, provided that each copy
55+
contains the above copyright notice and this license. These can be
56+
included either as stand-alone text files, human-readable headers or
57+
in the appropriate machine-readable metadata fields within text or
58+
binary files as long as those fields can be easily viewed by the user.
59+
60+
3) No Modified Version of the Font Software may use the Reserved Font
61+
Name(s) unless explicit written permission is granted by the corresponding
62+
Copyright Holder. This restriction only applies to the primary font name as
63+
presented to the users.
64+
65+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
66+
Software shall not be used to promote, endorse or advertise any
67+
Modified Version, except to acknowledge the contribution(s) of the
68+
Copyright Holder(s) and the Author(s) or with their explicit written
69+
permission.
70+
71+
5) The Font Software, modified or unmodified, in part or in whole,
72+
must be distributed entirely under this license, and must not be
73+
distributed under any other license. The requirement for fonts to
74+
remain under this license does not apply to any document created
75+
using the Font Software.
76+
77+
TERMINATION
78+
This license becomes null and void if any of the above conditions are
79+
not met.
80+
81+
DISCLAIMER
82+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
83+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
84+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
85+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
86+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
87+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
88+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
89+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
90+
OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

src/js/code_section.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ async function updateCodeFont() {
4343
// console.log("updateCodeFont")
4444
opentype
4545
.load(
46-
`/src/fonts/CommitMono${versionOfCommitMono}-${websiteData.weight}${
46+
`/src/fonts/fontlab/CommitMono${versionOfCommitMono}-${websiteData.weight}${
4747
websiteData.italic ? "Italic" : "Regular"
4848
}.otf`
4949
)
@@ -54,7 +54,7 @@ async function updateCodeFont() {
5454
})
5555
.catch((err) => console.log(err))
5656
// opentype
57-
// .load("src/fonts/CommitMonoV136-500Regular.otf")
57+
// .load("src/fonts/fontlab/CommitMonoV136-500Regular.otf")
5858
// .then((font) => {
5959
// console.log(font)
6060
// console.log(font.toTables())

src/js/download_wizard.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,12 @@ function catchError(button, error) {
113113
function makeCustomFont(settings) {
114114
// console.log("makeCustomFont")
115115

116-
const fontBaseURL = "/src/fonts/"
116+
const fontBaseURL = "/src/fonts/fontlab/"
117117
const fontName = "CommitMono" + versionOfCommitMono
118118
const fontWeight = settings.weight
119119
const fontItalic = settings.italic ? "Italic" : "Regular"
120120
const fontFilePath = `${fontBaseURL}${fontName}-${fontWeight}${fontItalic}.otf`
121-
// "/src/fonts/CommitMonoV132-450Italic.otf"
121+
// "/src/fonts/fontlab/CommitMonoV132-450Italic.otf"
122122

123123
return opentype
124124
.load(fontFilePath)
@@ -318,12 +318,12 @@ async function getZipFileBlob(kindOfDownload, fonts) {
318318
kindOfDownload === "design" &&
319319
zipWriter.add(
320320
"CommitMono VariableFont.ttf",
321-
new HttpReader(`/src/fonts/CommitMono${versionOfCommitMono}-VF.ttf`)
321+
new HttpReader(`/src/fonts/fontlab/CommitMono${versionOfCommitMono}-VF.ttf`)
322322
),
323323
kindOfDownload === "design" &&
324324
zipWriter.add(
325325
"CommitMono VariableFont.woff2",
326-
new HttpReader(`/src/fonts/CommitMono${versionOfCommitMono}-VF.woff2`)
326+
new HttpReader(`/src/fonts/fontlab/CommitMono${versionOfCommitMono}-VF.woff2`)
327327
),
328328
zipWriter.add("installation.txt", new HttpReader("/src/txt/installation.txt")),
329329
zipWriter.add("custom-settings.json", new TextReader(JSON.stringify(downloadSettingsCustom))),

src/js/nav.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -472,8 +472,8 @@ function checkTutorialKeys(e) {
472472
tutorialFinished = true
473473
const tutorialContainer = document.querySelector("#tutorial_complete")
474474
tutorialContainer.innerHTML = `<p>Tutorial complete! Your present is the variable version of Commit Mono:</p>
475-
<p><a href="/src/fonts/CommitMonoV136-VF.ttf" tabindex="0">Download CommitMono-VF.ttf</a></p>
476-
<p><a href="/src/fonts/CommitMonoV136-VF.woff2" tabindex="0">Download CommitMono-VF.woff2</a></p>
475+
<p><a href="/src/fonts/fontlab/CommitMonoV136-VF.ttf" tabindex="0">Download CommitMono-VF.ttf</a></p>
476+
<p><a href="/src/fonts/fontlab/CommitMonoV136-VF.woff2" tabindex="0">Download CommitMono-VF.woff2</a></p>
477477
<br />`
478478
}
479479
}

src/txt/ttfautohint.txt

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# step 1: empty src/fonts/export
2+
# step 2: drag contents of export on website to src/fonts/export
3+
# step 3: make sure fontforge and ttfautohint is installed
4+
# step 4: run this
5+
6+
rm src/fonts/CommitMono.zip
7+
mkdir src/fonts/export/ttfautohint
8+
fontforge -lang ff -c 'Open("src/fonts/export/CommitMono-450-Regular.otf"); Generate("src/fonts/export/CommitMono-450-Regular-unhinted.ttf")'
9+
fontforge -lang ff -c 'Open("src/fonts/export/CommitMono-450-Italic.otf"); Generate("src/fonts/export/CommitMono-450-Italic-unhinted.ttf")'
10+
fontforge -lang ff -c 'Open("src/fonts/export/CommitMono-700-Regular.otf"); Generate("src/fonts/export/CommitMono-700-Regular-unhinted.ttf")'
11+
fontforge -lang ff -c 'Open("src/fonts/export/CommitMono-700-Italic.otf"); Generate("src/fonts/export/CommitMono-700-Italic-unhinted.ttf")'
12+
ttfautohint -R src/fonts/export/CommitMono-450-Regular-unhinted.ttf -a sss src/fonts/export/CommitMono-450-Regular-unhinted.ttf src/fonts/export/ttfautohint/CommitMono-450-Regular.ttf
13+
ttfautohint -R src/fonts/export/CommitMono-450-Regular-unhinted.ttf -a sss src/fonts/export/CommitMono-450-Italic-unhinted.ttf src/fonts/export/ttfautohint/CommitMono-450-Italic.ttf
14+
ttfautohint -R src/fonts/export/CommitMono-450-Regular-unhinted.ttf -a sss src/fonts/export/CommitMono-700-Regular-unhinted.ttf src/fonts/export/ttfautohint/CommitMono-700-Regular.ttf
15+
ttfautohint -R src/fonts/export/CommitMono-450-Regular-unhinted.ttf -a sss src/fonts/export/CommitMono-700-Italic-unhinted.ttf src/fonts/export/ttfautohint/CommitMono-700-Italic.ttf
16+
rm src/fonts/export/CommitMono-450-Regular-unhinted.ttf
17+
rm src/fonts/export/CommitMono-450-Italic-unhinted.ttf
18+
rm src/fonts/export/CommitMono-700-Regular-unhinted.ttf
19+
rm src/fonts/export/CommitMono-700-Italic-unhinted.ttf
20+
zip -r src/fonts/CommitMono.zip src/fonts/export
21+
22+
# step 5: upload src/fonts/CommitMono.zip to GitHub

0 commit comments

Comments
 (0)