mirror of
https://github.com/eigilnikolajsen/commit-mono.git
synced 2024-09-11 18:37:12 +03:00
add guide to create ttfautohinted fonts
This commit is contained in:
parent
e6f038472d
commit
e824d27f0d
2
404.html
2
404.html
@ -19,7 +19,7 @@
|
||||
<style>
|
||||
@font-face {
|
||||
font-family: "CommitMono";
|
||||
src: url("/src/fonts/CommitMonoV118-VF.woff2");
|
||||
src: url("/src/fonts/fontlab/CommitMonoV136-VF.woff2");
|
||||
font-style: normal;
|
||||
font-weight: 450;
|
||||
font-display: swap;
|
||||
|
12
index.html
12
index.html
@ -1199,10 +1199,14 @@
|
||||
<script>
|
||||
const versionOfCommitMono = "V136"
|
||||
let fontsLoaded = false
|
||||
const commitMono = new FontFace("CommitMono", `url(/src/fonts/CommitMono${versionOfCommitMono}-VF.woff2)`, {
|
||||
style: "normal",
|
||||
weight: "450",
|
||||
})
|
||||
const commitMono = new FontFace(
|
||||
"CommitMono",
|
||||
`url(/src/fonts/fontlab/CommitMono${versionOfCommitMono}-VF.woff2)`,
|
||||
{
|
||||
style: "normal",
|
||||
weight: "450",
|
||||
}
|
||||
)
|
||||
// Add to the document.fonts (FontFaceSet)
|
||||
document.fonts.add(commitMono)
|
||||
|
||||
|
BIN
src/fonts/CommitMono.zip
Normal file
BIN
src/fonts/CommitMono.zip
Normal file
Binary file not shown.
BIN
src/fonts/export/CommitMono-450-Italic.otf
Normal file
BIN
src/fonts/export/CommitMono-450-Italic.otf
Normal file
Binary file not shown.
BIN
src/fonts/export/CommitMono-450-Regular.otf
Normal file
BIN
src/fonts/export/CommitMono-450-Regular.otf
Normal file
Binary file not shown.
BIN
src/fonts/export/CommitMono-700-Italic.otf
Normal file
BIN
src/fonts/export/CommitMono-700-Italic.otf
Normal file
Binary file not shown.
BIN
src/fonts/export/CommitMono-700-Regular.otf
Normal file
BIN
src/fonts/export/CommitMono-700-Regular.otf
Normal file
Binary file not shown.
1
src/fonts/export/custom-settings.json
Normal file
1
src/fonts/export/custom-settings.json
Normal file
@ -0,0 +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}
|
25
src/fonts/export/installation.txt
Normal file
25
src/fonts/export/installation.txt
Normal file
@ -0,0 +1,25 @@
|
||||
A short guide for how to install and enable your shiny new version of Commit Mono.
|
||||
This is taken from section 08 Install from https://commitmono.com/
|
||||
|
||||
#1 (Download the fonts)
|
||||
#2 Unzip the fonts. You'll see 4 font files. These 4 fonts make up a 'Style Group':
|
||||
* CommitMono-Regular: Base version with settings and weight of your choice.
|
||||
* CommitMono-Italic: An italic version, same weight as regular.
|
||||
* CommitMono-Bold: A bold version, weight 700.
|
||||
* CommitMono-BoldItalic: A bold version, weight 700, that is also italic.
|
||||
#3 Install all 4 fonts on your system:
|
||||
* Windows: Right click the font in the folder and click "Install".
|
||||
* Mac: Open fonts with Font Book from the folder and click "Install".
|
||||
* Linux: Unpack fonts to ~/.local/share/fonts (or /usr/share/fonts to install
|
||||
fonts system-wide) then fc-cache -f -v
|
||||
#4 Restart your editor/IDE.
|
||||
#5 Activate Commit Mono in your editor.
|
||||
Settings/Preferences → Editor → Font: Pick ‘CommitMono’ from the list (notice:
|
||||
there is no space). If you’re using VS Code, simply add these two lines to the
|
||||
settings.json file:
|
||||
"editor.fontFamily": "CommitMono",
|
||||
"editor.fontLigatures": true,
|
||||
|
||||
For a comprehensive guide on how to enable features/ligatures in your specific
|
||||
editor/IDE, refer to Fira Code wiki:
|
||||
https://github.com/tonsky/FiraCode/wiki#enabling-ligatures
|
90
src/fonts/export/license.txt
Normal file
90
src/fonts/export/license.txt
Normal file
@ -0,0 +1,90 @@
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
http://scripts.sil.org/OFL
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
BIN
src/fonts/export/ttfautohint/CommitMono-450-Italic.ttf
Normal file
BIN
src/fonts/export/ttfautohint/CommitMono-450-Italic.ttf
Normal file
Binary file not shown.
BIN
src/fonts/export/ttfautohint/CommitMono-450-Regular.ttf
Normal file
BIN
src/fonts/export/ttfautohint/CommitMono-450-Regular.ttf
Normal file
Binary file not shown.
BIN
src/fonts/export/ttfautohint/CommitMono-700-Italic.ttf
Normal file
BIN
src/fonts/export/ttfautohint/CommitMono-700-Italic.ttf
Normal file
Binary file not shown.
BIN
src/fonts/export/ttfautohint/CommitMono-700-Regular.ttf
Normal file
BIN
src/fonts/export/ttfautohint/CommitMono-700-Regular.ttf
Normal file
Binary file not shown.
@ -43,7 +43,7 @@ async function updateCodeFont() {
|
||||
// console.log("updateCodeFont")
|
||||
opentype
|
||||
.load(
|
||||
`/src/fonts/CommitMono${versionOfCommitMono}-${websiteData.weight}${
|
||||
`/src/fonts/fontlab/CommitMono${versionOfCommitMono}-${websiteData.weight}${
|
||||
websiteData.italic ? "Italic" : "Regular"
|
||||
}.otf`
|
||||
)
|
||||
@ -54,7 +54,7 @@ async function updateCodeFont() {
|
||||
})
|
||||
.catch((err) => console.log(err))
|
||||
// opentype
|
||||
// .load("src/fonts/CommitMonoV136-500Regular.otf")
|
||||
// .load("src/fonts/fontlab/CommitMonoV136-500Regular.otf")
|
||||
// .then((font) => {
|
||||
// console.log(font)
|
||||
// console.log(font.toTables())
|
||||
|
@ -113,12 +113,12 @@ function catchError(button, error) {
|
||||
function makeCustomFont(settings) {
|
||||
// console.log("makeCustomFont")
|
||||
|
||||
const fontBaseURL = "/src/fonts/"
|
||||
const fontBaseURL = "/src/fonts/fontlab/"
|
||||
const fontName = "CommitMono" + versionOfCommitMono
|
||||
const fontWeight = settings.weight
|
||||
const fontItalic = settings.italic ? "Italic" : "Regular"
|
||||
const fontFilePath = `${fontBaseURL}${fontName}-${fontWeight}${fontItalic}.otf`
|
||||
// "/src/fonts/CommitMonoV132-450Italic.otf"
|
||||
// "/src/fonts/fontlab/CommitMonoV132-450Italic.otf"
|
||||
|
||||
return opentype
|
||||
.load(fontFilePath)
|
||||
@ -318,12 +318,12 @@ async function getZipFileBlob(kindOfDownload, fonts) {
|
||||
kindOfDownload === "design" &&
|
||||
zipWriter.add(
|
||||
"CommitMono VariableFont.ttf",
|
||||
new HttpReader(`/src/fonts/CommitMono${versionOfCommitMono}-VF.ttf`)
|
||||
new HttpReader(`/src/fonts/fontlab/CommitMono${versionOfCommitMono}-VF.ttf`)
|
||||
),
|
||||
kindOfDownload === "design" &&
|
||||
zipWriter.add(
|
||||
"CommitMono VariableFont.woff2",
|
||||
new HttpReader(`/src/fonts/CommitMono${versionOfCommitMono}-VF.woff2`)
|
||||
new HttpReader(`/src/fonts/fontlab/CommitMono${versionOfCommitMono}-VF.woff2`)
|
||||
),
|
||||
zipWriter.add("installation.txt", new HttpReader("/src/txt/installation.txt")),
|
||||
zipWriter.add("custom-settings.json", new TextReader(JSON.stringify(downloadSettingsCustom))),
|
||||
|
@ -472,8 +472,8 @@ function checkTutorialKeys(e) {
|
||||
tutorialFinished = true
|
||||
const tutorialContainer = document.querySelector("#tutorial_complete")
|
||||
tutorialContainer.innerHTML = `<p>Tutorial complete! Your present is the variable version of Commit Mono:</p>
|
||||
<p><a href="/src/fonts/CommitMonoV136-VF.ttf" tabindex="0">Download CommitMono-VF.ttf</a></p>
|
||||
<p><a href="/src/fonts/CommitMonoV136-VF.woff2" tabindex="0">Download CommitMono-VF.woff2</a></p>
|
||||
<p><a href="/src/fonts/fontlab/CommitMonoV136-VF.ttf" tabindex="0">Download CommitMono-VF.ttf</a></p>
|
||||
<p><a href="/src/fonts/fontlab/CommitMonoV136-VF.woff2" tabindex="0">Download CommitMono-VF.woff2</a></p>
|
||||
<br />`
|
||||
}
|
||||
}
|
||||
|
22
src/txt/ttfautohint.txt
Normal file
22
src/txt/ttfautohint.txt
Normal file
@ -0,0 +1,22 @@
|
||||
# step 1: empty src/fonts/export
|
||||
# step 2: drag contents of export on website to src/fonts/export
|
||||
# step 3: make sure fontforge and ttfautohint is installed
|
||||
# step 4: run this
|
||||
|
||||
rm src/fonts/CommitMono.zip
|
||||
mkdir src/fonts/export/ttfautohint
|
||||
fontforge -lang ff -c 'Open("src/fonts/export/CommitMono-450-Regular.otf"); Generate("src/fonts/export/CommitMono-450-Regular-unhinted.ttf")'
|
||||
fontforge -lang ff -c 'Open("src/fonts/export/CommitMono-450-Italic.otf"); Generate("src/fonts/export/CommitMono-450-Italic-unhinted.ttf")'
|
||||
fontforge -lang ff -c 'Open("src/fonts/export/CommitMono-700-Regular.otf"); Generate("src/fonts/export/CommitMono-700-Regular-unhinted.ttf")'
|
||||
fontforge -lang ff -c 'Open("src/fonts/export/CommitMono-700-Italic.otf"); Generate("src/fonts/export/CommitMono-700-Italic-unhinted.ttf")'
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
rm src/fonts/export/CommitMono-450-Regular-unhinted.ttf
|
||||
rm src/fonts/export/CommitMono-450-Italic-unhinted.ttf
|
||||
rm src/fonts/export/CommitMono-700-Regular-unhinted.ttf
|
||||
rm src/fonts/export/CommitMono-700-Italic-unhinted.ttf
|
||||
zip -r src/fonts/CommitMono.zip src/fonts/export
|
||||
|
||||
# step 5: upload src/fonts/CommitMono.zip to GitHub
|
Loading…
Reference in New Issue
Block a user