Skip to content

Commit cd3ca02

Browse files
add feature code to download page
1 parent c4b117d commit cd3ca02

File tree

4 files changed

+27
-4
lines changed

4 files changed

+27
-4
lines changed

index.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -551,8 +551,9 @@ <h2>Choose download alternate characters</h2>
551551
<br />
552552
<p>
553553
Download all 34 cuts with your custom settings + source variable fonts (.tff &
554-
.woff2) for design. Variable fonts don’t contain custom settings. Use OpenType
555-
features to expose, see exact features in docs.
554+
.woff2) for design. Variable fonts don’t contain custom settings. Use these
555+
OpenType features for current custom settings:
556+
<span id="custom_feature_code" tabindex="0" data-edit="true"></span>
556557
</p>
557558
<br />
558559
<br />

src/js/code_section.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,18 @@ async function updateCodeFont() {
5353
updateCode(null, codeForm)
5454
})
5555
.catch((err) => console.log(err))
56+
57+
// opentype
58+
// .load("src/fonts/CommitMonoV133-500Regular.ttf")
59+
// .then((font) => {
60+
// console.log(font)
61+
// console.log(font.toTables())
62+
// // font.download()
63+
// })
64+
// .catch((err) => console.log(err))
65+
5666
// opentype
57-
// .load("src/fonts/CommitMonoV133-700Regular.otf")
67+
// .load("src/fonts/CommitMonoV133-500Regular.otf")
5868
// .then((font) => {
5969
// console.log(font)
6070
// console.log(font.toTables())

src/js/download_wizard.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,13 @@ function makeCustomFont(settings) {
228228
font.tables.cff.topDict.fullName = font.names.fullName.en
229229
font.tables.cff.topDict.weight = settings.weight == 700 ? "Bold" : "Regular"
230230

231+
// set correct mac style
231232
const macStyles = ["Regular", "Italic", "Bold", "Bold Italic"]
232233
font.tables.head.macStyle = macStyles.indexOf(settings.style)
233234

235+
// set correct numberOfHMetrics (3 is monospace)
236+
font.tables.hhea.numberOfHMetrics = 3
237+
234238
// make the font.tables.name equal to that of font.names
235239
font.tables.name = font.names
236240

src/js/example_section.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,17 @@ function updateExampleSettings(event, form, isDefault) {
214214
const label = document.querySelector(`#alt_${entry[0]}`)
215215
if (label) label.style.fontFeatureSettings = entry[1]
216216
}
217+
output = output.slice(0, -2)
217218
// console.log(downloadSettingsCustom)
218219
const codeExample = document.querySelector("#code_example")
219-
codeExample.style.fontFeatureSettings = output.slice(0, -2)
220+
codeExample.style.fontFeatureSettings = output
221+
222+
const customFeatureCode = document.querySelector("#custom_feature_code")
223+
const shortFeatureCode = output
224+
.split(", ")
225+
.filter((f) => f.includes("on"))
226+
.join(", ")
227+
customFeatureCode.textContent = `"${shortFeatureCode}"`
220228

221229
if (event) event.preventDefault()
222230
}

0 commit comments

Comments
 (0)