Skip to content

Commit a99b3d9

Browse files
Merge pull request #19 from eigilnikolajsen/fix-issues-001
Fix issues 001
2 parents 380f1eb + 33bf3fa commit a99b3d9

File tree

83 files changed

+195
-133
lines changed

Some content is hidden

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

83 files changed

+195
-133
lines changed

index.html

+27-8
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,12 @@
135135
</div>
136136
<p>Light/dark</p>
137137
</div>
138+
<div class="key_group" id="change_weight">
139+
<div class="keys">
140+
<p data-key-code="KeyC" data-key="c" class="key">C</p>
141+
</div>
142+
<p>High contrast</p>
143+
</div>
138144
<div class="key_group" id="show_hide_keys">
139145
<div class="keys">
140146
<p data-key-code="KeyH" data-key="h" class="key">H</p>
@@ -546,7 +552,8 @@ <h2>Choose download alternate characters</h2>
546552
<br />
547553
<p>
548554
Download all 34 cuts with your custom settings + source variable fonts (.tff &
549-
.woff2) for design.
555+
.woff2) for design. Variable fonts don’t contain custom settings. Use OpenType
556+
features to expose, see exact features in docs.
550557
</p>
551558
<br />
552559
<br />
@@ -800,12 +807,24 @@ <h2>Activate Commit Mono in your editor.</h2>
800807
Is there a .woff2 version of the font available?
801808
</summary>
802809
<p>
803-
No, but you can use an online conversion tool like
804-
<a
805-
href="https://www.fontsquirrel.com/tools/webfont-generator"
806-
target="_blank"
807-
>this one from Font Squirrel</a
808-
>.
810+
There is a variable .woff2 version included if you "Download custom for
811+
design" in
812+
<button
813+
class="download_button"
814+
tabindex="0"
815+
onclick="keyDown({code:'Digit7'})"
816+
>
817+
07 Customize</button
818+
>. However, that variable font does not contain custom settings. You
819+
have to manually enable features and alternates that are OFF by default.
820+
To see the OpenType feature codes for each feature and alternate, go to
821+
<button
822+
class="download_button"
823+
tabindex="0"
824+
onclick="keyDown({code:'Digit9'})"
825+
>
826+
09 Docs
827+
</button>
809828
</p>
810829
</details>
811830
<details>
@@ -1042,7 +1061,7 @@ <h2>Programs used</h2>
10421061
<div tabindex="0" id="block_tab_end"></div>
10431062
</div>
10441063
<script>
1045-
const versionOfCommitMono = "V130"
1064+
const versionOfCommitMono = "V132"
10461065
let fontsLoaded = false
10471066
const commitMono = new FontFace("CommitMono", `url(/src/fonts/CommitMono${versionOfCommitMono}-VF.woff2)`, {
10481067
style: "normal",

src/css/section_7.css

+7
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,13 @@ button:focus a {
8484
content: "✕";
8585
animation: none;
8686
}
87+
.download_button.safari::after {
88+
content: "Safari download not working. Try Chrome or Firefox.";
89+
font-variation-settings: "ital" 1;
90+
right: auto;
91+
left: calc(100% + 1ch);
92+
animation: none;
93+
}
8794

8895
@keyframes loading {
8996
0% {
-136 KB
Binary file not shown.
-131 KB
Binary file not shown.
-137 KB
Binary file not shown.
-132 KB
Binary file not shown.
-137 KB
Binary file not shown.
-131 KB
Binary file not shown.
-137 KB
Binary file not shown.
-132 KB
Binary file not shown.
-137 KB
Binary file not shown.
-132 KB
Binary file not shown.
-138 KB
Binary file not shown.
-132 KB
Binary file not shown.
-137 KB
Binary file not shown.
-132 KB
Binary file not shown.
-138 KB
Binary file not shown.
-133 KB
Binary file not shown.
-138 KB
Binary file not shown.
-133 KB
Binary file not shown.
-138 KB
Binary file not shown.
-132 KB
Binary file not shown.
-137 KB
Binary file not shown.
-132 KB
Binary file not shown.
-138 KB
Binary file not shown.
-133 KB
Binary file not shown.
-138 KB
Binary file not shown.
-133 KB
Binary file not shown.
-138 KB
Binary file not shown.
-133 KB
Binary file not shown.
-138 KB
Binary file not shown.
-133 KB
Binary file not shown.
-138 KB
Binary file not shown.
-134 KB
Binary file not shown.
-137 KB
Binary file not shown.
-133 KB
Binary file not shown.

src/fonts/CommitMonoV130-VF.ttf

-215 KB
Binary file not shown.

src/fonts/CommitMonoV130-VF.woff2

-75 KB
Binary file not shown.
136 KB
Binary file not shown.
131 KB
Binary file not shown.
139 KB
Binary file not shown.
133 KB
Binary file not shown.
138 KB
Binary file not shown.
132 KB
Binary file not shown.
138 KB
Binary file not shown.
132 KB
Binary file not shown.
139 KB
Binary file not shown.
132 KB
Binary file not shown.
139 KB
Binary file not shown.
133 KB
Binary file not shown.
139 KB
Binary file not shown.
133 KB
Binary file not shown.
139 KB
Binary file not shown.
134 KB
Binary file not shown.
139 KB
Binary file not shown.
134 KB
Binary file not shown.
138 KB
Binary file not shown.
133 KB
Binary file not shown.
138 KB
Binary file not shown.
133 KB
Binary file not shown.
138 KB
Binary file not shown.
133 KB
Binary file not shown.
139 KB
Binary file not shown.
133 KB
Binary file not shown.
139 KB
Binary file not shown.
134 KB
Binary file not shown.
139 KB
Binary file not shown.
134 KB
Binary file not shown.
138 KB
Binary file not shown.
135 KB
Binary file not shown.
137 KB
Binary file not shown.
134 KB
Binary file not shown.

src/fonts/CommitMonoV132-VF.ttf

216 KB
Binary file not shown.

src/fonts/CommitMonoV132-VF.woff2

75.2 KB
Binary file not shown.
9.85 KB
Binary file not shown.

src/js/code_section.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ async function updateCodeFont() {
5555
.catch((err) => console.log(err))
5656

5757
opentype
58-
.load("src/fonts/CommitMonoV130-450Regular.otf")
58+
.load("src/fonts/CommitMonoV132-450Regular.otf")
5959
.then((font) => {
60-
// console.log(font)
60+
console.log(font)
6161
// font.download()
6262
})
6363
.catch((err) => console.log(err))

src/js/docs_section.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ function buildDocs() {
1717
customizeContent.features.forEach((feature) => {
1818
const sizes = [
1919
[3, 4],
20-
[2, 2.5],
21-
[1, 1.5],
22-
[0.75, 1],
20+
[1.5, 2],
2321
[0.5, 1],
2422
]
2523
const container = document.createElement("div")
@@ -42,7 +40,7 @@ function buildDocs() {
4240
h2.tabIndex = 0
4341
h2.dataset.edit = "true"
4442
const p = document.createElement("p")
45-
p.textContent = `Default: ${feature.on ? "ON" : "OFF"}`
43+
p.textContent = `Default: ${feature.on ? "ON" : "OFF"}. Feature in variable font: "${feature.feature}".`
4644
container.append(h2, p)
4745
sizes.forEach((size) => {
4846
const exampleText = document.createElement("p")

src/js/download_wizard.js

+70-51
Original file line numberDiff line numberDiff line change
@@ -5,63 +5,80 @@ const fontFileBlobs = { regular: null, italic: null, bold: null, bolditalic: nul
55
let downloadStarted = false
66
async function downloadFont(kindOfDownload, button) {
77
// console.log("downloadFont")
8-
if (!downloadStarted) {
9-
downloadStarted = true
10-
button.classList.remove("loaded", "error")
11-
button.classList.add("loading")
128

13-
let allSettings = {}
14-
if (kindOfDownload === "dev") {
15-
allSettings.regular = { ...downloadSettingsCustom, style: "Regular" }
16-
allSettings.italic = {
17-
...downloadSettingsCustom,
18-
style: "Italic",
19-
italic: true,
20-
}
21-
allSettings.bold = { ...downloadSettingsCustom, style: "Bold", weight: 700 }
22-
allSettings.bolditalic = {
23-
...downloadSettingsCustom,
24-
style: "Bold Italic",
25-
italic: true,
26-
weight: 700,
27-
}
28-
}
29-
if (kindOfDownload === "default") {
30-
allSettings.regular = { ...downloadSettingsDefault, style: "Regular" }
31-
allSettings.italic = {
32-
...downloadSettingsDefault,
33-
style: "Italic",
34-
italic: true,
35-
}
36-
allSettings.bold = { ...downloadSettingsDefault, style: "Bold", weight: 700 }
37-
allSettings.bolditalic = {
38-
...downloadSettingsDefault,
39-
style: "Bold Italic",
40-
italic: true,
41-
weight: 700,
42-
}
43-
}
44-
if (kindOfDownload === "design") {
45-
for (let weight = 300; weight <= 700; weight += 25) {
46-
allSettings[weight + "Regular"] = {
9+
// detect safari
10+
const userAgentString = navigator.userAgent || "."
11+
let usingChrome = userAgentString.indexOf("Chrome") > -1 || false
12+
let usingSafari = userAgentString.indexOf("Safari") > -1 || false
13+
if (usingChrome && usingSafari) usingSafari = false
14+
15+
// block download if from Safari since zip is corrupted
16+
if (usingSafari) {
17+
button.classList.remove("loaded", "error", "safari")
18+
button.classList.add("loading")
19+
setTimeout(() => {
20+
button.classList.remove("loading")
21+
button.classList.add("safari")
22+
}, 500)
23+
} else {
24+
if (!downloadStarted) {
25+
downloadStarted = true
26+
button.classList.remove("loaded", "error", "safari")
27+
button.classList.add("loading")
28+
29+
let allSettings = {}
30+
if (kindOfDownload === "dev") {
31+
allSettings.regular = { ...downloadSettingsCustom, style: "Regular" }
32+
allSettings.italic = {
4733
...downloadSettingsCustom,
48-
style: weight + "Regular",
49-
weight,
50-
italic: false,
34+
style: "Italic",
35+
italic: true,
5136
}
52-
allSettings[weight + "Italic"] = {
37+
allSettings.bold = { ...downloadSettingsCustom, style: "Bold", weight: 700 }
38+
allSettings.bolditalic = {
5339
...downloadSettingsCustom,
54-
style: weight + "Italic",
55-
weight,
40+
style: "Bold Italic",
5641
italic: true,
42+
weight: 700,
43+
}
44+
}
45+
if (kindOfDownload === "default") {
46+
allSettings.regular = { ...downloadSettingsDefault, style: "Regular" }
47+
allSettings.italic = {
48+
...downloadSettingsDefault,
49+
style: "Italic",
50+
italic: true,
51+
}
52+
allSettings.bold = { ...downloadSettingsDefault, style: "Bold", weight: 700 }
53+
allSettings.bolditalic = {
54+
...downloadSettingsDefault,
55+
style: "Bold Italic",
56+
italic: true,
57+
weight: 700,
58+
}
59+
}
60+
if (kindOfDownload === "design") {
61+
for (let weight = 300; weight <= 700; weight += 25) {
62+
allSettings[weight + "Regular"] = {
63+
...downloadSettingsCustom,
64+
style: weight + "Regular",
65+
weight,
66+
italic: false,
67+
}
68+
allSettings[weight + "Italic"] = {
69+
...downloadSettingsCustom,
70+
style: weight + "Italic",
71+
weight,
72+
italic: true,
73+
}
5774
}
5875
}
59-
}
6076

61-
Promise.all(Object.values(allSettings).map((settings) => makeCustomFont(settings)))
62-
.then((resolve) => getZipFileBlob(kindOfDownload, resolve))
63-
.then((resolve) => initializeDownload(button, resolve))
64-
.catch((error) => catchError(button, error))
77+
Promise.all(Object.values(allSettings).map((settings) => makeCustomFont(settings)))
78+
.then((resolve) => getZipFileBlob(kindOfDownload, resolve))
79+
.then((resolve) => initializeDownload(button, resolve))
80+
.catch((error) => catchError(button, error))
81+
}
6582
}
6683
}
6784

@@ -87,7 +104,7 @@ function makeCustomFont(settings) {
87104
const fontWeight = settings.weight
88105
const fontItalic = settings.italic ? "Italic" : "Regular"
89106
const fontFilePath = `${fontBaseURL}${fontName}-${fontWeight}${fontItalic}.otf`
90-
// "/src/fonts/CommitMonoV130-450Italic.otf"
107+
// "/src/fonts/CommitMonoV132-450Italic.otf"
91108

92109
return opentype
93110
.load(fontFilePath)
@@ -203,7 +220,9 @@ function makeCustomFont(settings) {
203220
font.names.postScriptName.en = `CommitMono-${settings.style.split(" ").join("")}`
204221
delete font.names.preferredFamily
205222
delete font.names.preferredSubfamily
206-
font.names.uniqueID.en = `Version 1.001;;CommitMono-${settings.style.split(" ").join("")};2023;FL801`
223+
font.names.uniqueID.en = `${font.names.version.en};;CommitMono-${settings.style
224+
.split(" ")
225+
.join("")};2023;FL801`
207226

208227
font.tables.cff.topDict.familyName = font.names.fontFamily.en
209228
font.tables.cff.topDict.fullName = font.names.fullName.en

0 commit comments

Comments
 (0)