fix problem with cv10

This commit is contained in:
Eigil Nikolajsen 2023-11-05 17:42:33 +01:00
parent 3f7f188f0c
commit ed27c8478d
62 changed files with 63 additions and 41 deletions

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
@ -19,7 +19,7 @@
<style>
@font-face {
font-family: "CommitMono";
src: url("/src/fonts/fontlab/CommitMonoV140-VF.woff2");
src: url("/src/fonts/fontlab/CommitMonoV141-VF.woff2");
font-style: normal;
font-weight: 400;
font-display: swap;

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
@ -1190,7 +1190,7 @@
<div tabindex="0" id="block_tab_end"></div>
</div>
<script>
const versionOfCommitMono = "V140"
const versionOfCommitMono = "V141"
let fontsLoaded = false
const commitMono = new FontFace(
"CommitMono",
@ -1198,7 +1198,7 @@
{
style: "normal",
weight: "400",
}
},
)
// Add to the document.fonts (FontFaceSet)
document.fonts.add(commitMono)

View File

@ -123,7 +123,9 @@ a:focus,
i {
font-style: normal;
font-variation-settings: "wght" 400, "ital" 1;
font-variation-settings:
"wght" 400,
"ital" 1;
}
h1 {

Binary file not shown.

View File

@ -45,7 +45,7 @@ async function updateCodeFont() {
.load(
`/src/fonts/fontlab/CommitMono${versionOfCommitMono}-${websiteData.weight}${
websiteData.italic ? "Italic" : "Regular"
}.otf`
}.otf`,
)
.then((font) => {
// // console.log(font)
@ -54,7 +54,7 @@ async function updateCodeFont() {
})
.catch((err) => console.log(err))
// opentype
// .load("src/fonts/fontlab/CommitMonoV140-500Regular.otf")
// .load("src/fonts/fontlab/CommitMonoV141-500Regular.otf")
// .then((font) => {
// console.log(font)
// console.log(font.toTables())
@ -81,7 +81,7 @@ function updateCode(event, form) {
displayName = character.name
const ps = document.querySelectorAll(".code_char")
ps.forEach((p) =>
p.dataset.char == character.name ? (p.style.display = "block") : (p.style.display = "none")
p.dataset.char == character.name ? (p.style.display = "block") : (p.style.display = "none"),
)
}
})

View File

@ -159,7 +159,7 @@ function nextQuestion(correct, answer, wrongAnswer, pointerType) {
question.classList.add("active_question")
const rightButton = question.querySelector(`.button_container .question_button:nth-child(${answer + 1})`)
const wrongButton = question.querySelector(
`.button_container .question_button:nth-child(${wrongAnswer + 1})`
`.button_container .question_button:nth-child(${wrongAnswer + 1})`,
)
correct ? rightButton.classList.add("button_choice") : wrongButton.classList.add("button_choice")
!correct ? rightButton.classList.add("button_choicent") : wrongButton.classList.add("button_choicent")

View File

@ -33,7 +33,7 @@ function buildDocs() {
? `<span class="span_on${
feature.on ? " active_feature" : ""
}" onclick="changeFeatureDocs('enable')">[${l}]</span>`
: l
: l,
)
.join("")
h2.innerHTML = featureDescriptionWithSpan

View File

@ -119,8 +119,8 @@ function makeCustomFont(settings) {
// "/src/fonts/fontlab/CommitMonoV132-400Italic.otf"
return fetch(fontFilePath)
.then(file=>file.arrayBuffer())
.then(font=>opentype.parse(font))
.then((file) => file.arrayBuffer())
.then((font) => opentype.parse(font))
.then((font) => {
// ######################
// #1 change alternates by switching their paths
@ -132,25 +132,45 @@ function makeCustomFont(settings) {
//
// filter for only the active ones
if (!active) return
// // console.log("alternate", alternate, "active", active)
// console.log("alternate", alternate, "active", active)
// look at all the fonts features
font.tables.gsub.features.forEach((feature) => {
//
// if the feature matches the alternate we're currently on
if (feature.tag == alternate) {
// // console.log("feature", feature)
// console.log("feature", feature)
// then loop through the list of lookup indexes of that feature
feature.feature.lookupListIndexes.forEach((lookupIndex) => {
// // console.log("lookupIndex", lookupIndex)
// console.log("lookupIndex", lookupIndex)
// loop through the subtable of each lookup at the lookup index
font.tables.gsub.lookups[lookupIndex].subtables.forEach((subtable) => {
// // console.log("subtable", subtable)
// console.log("subtable", subtable)
// find the base glyphs
let glyphs = []
// get glyphs from glyphs array
if (subtable.coverage.format == 1) {
glyphs = subtable.coverage.glyphs
}
// get glyphs from ranges
if (subtable.coverage.format == 2) {
// [{start: 0, end: 4}, {start: 8, end: 8}] => [0, 1, 2, 3, 4, 8]
glyphs = subtable.coverage.ranges
.map((range) =>
Array.from(Array(range.end - range.start + 1)).map(
(_, index) => range.start + index
)
)
.flat()
}
// loop through the glyphs of the subtable
subtable.coverage.glyphs.forEach((glyphIndexOriginal, index) => {
glyphs.forEach((glyphIndexOriginal, index) => {
//
// glyphIndexOriginal is the index of the original glyph
// glyphIndexSubstitute is the index of the glyph to substitute the original with
@ -264,7 +284,7 @@ function makeCustomFont(settings) {
// ######################
// #3 change the names
// give custom names to each member of the style group
const fontFamily = websiteData.fontName
const fullName = `${websiteData.fontName} ${settings.style}`
const postScriptName = `${websiteData.fontName}-${settings.style.split(" ").join("")}`
@ -274,7 +294,7 @@ function makeCustomFont(settings) {
font.names.macintosh.fullName.en = fullName
font.names.macintosh.postScriptName.en = postScriptName
font.names.macintosh.preferredSubfamily = font.names.windows.preferredSubfamily
font.names.windows.fontFamily.en = fontFamily
font.names.windows.fontSubfamily.en = settings.style
font.names.windows.fullName.en = fullName
@ -284,7 +304,7 @@ function makeCustomFont(settings) {
.join("")};2023;FL820`
delete font.names.windows.preferredFamily
font.tables.cff.topDict.familyName = fontFamily
font.tables.cff.topDict.familyName = fontFamily
font.tables.cff.topDict.fullName = fullName
font.tables.cff.topDict.weight = settings.weight == 700 ? "Bold" : "Regular"
@ -312,7 +332,7 @@ function makeCustomFont(settings) {
}
async function getZipFileBlob(kindOfDownload, fonts) {
console.log(fontFileBlobs, fonts)
// console.log(fontFileBlobs, fonts)
const { BlobWriter, BlobReader, HttpReader, ZipWriter, TextReader } = zip
const zipFileWriter = new BlobWriter()

View File

@ -235,7 +235,7 @@ function simulateTab(e) {
.forEach((el) => el.classList.remove("shake", "shake_left", "shake_right", "shake_up", "shake_down"))
const allTabbable = document.querySelectorAll(
"#nav_form input:checked, section.visible input:checked, section.visible [tabindex='0']"
"#nav_form input:checked, section.visible input:checked, section.visible [tabindex='0']",
)
let addShake = false
let indexOfActive = 0
@ -402,7 +402,7 @@ function onFocusIn(e) {
const paddingOffsetBottom = 200
if (bounds.top > window.innerHeight - paddingOffsetBottom) {
const numberOfMoves = Math.floor(
(bounds.top - (window.innerHeight - paddingOffsetBottom)) / websiteData.pushPage.distance
(bounds.top - (window.innerHeight - paddingOffsetBottom)) / websiteData.pushPage.distance,
)
for (let i = 0; i < numberOfMoves; i++) {
pushPage("KeyS")
@ -412,7 +412,7 @@ function onFocusIn(e) {
if (!document.activeElement.className.includes("nav")) {
if (bounds.top < paddingOffsetTop) {
const numberOfMoves = Math.ceil(
Math.abs(bounds.top - paddingOffsetTop - 32) / websiteData.pushPage.distance
Math.abs(bounds.top - paddingOffsetTop - 32) / websiteData.pushPage.distance,
)
// console.log("num of moves:", numberOfMoves, "bounds.top:", bounds.top)
for (let i = 0; i < numberOfMoves; i++) {
@ -476,8 +476,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/fontlab/CommitMonoV140-VF.ttf" tabindex="0">Download CommitMono-VF.ttf</a></p>
<p><a href="/src/fonts/fontlab/CommitMonoV140-VF.woff2" tabindex="0">Download CommitMono-VF.woff2</a></p>
<p><a href="/src/fonts/fontlab/CommitMonoV141-VF.ttf" tabindex="0">Download CommitMono-VF.ttf</a></p>
<p><a href="/src/fonts/fontlab/CommitMonoV141-VF.woff2" tabindex="0">Download CommitMono-VF.woff2</a></p>
<br />`
}
}

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />

View File

@ -15,7 +15,7 @@ function lcs(arr1, arr2) {
} else {
matrix[rowIndex][columnIndex] = Math.max(
matrix[rowIndex - 1][columnIndex],
matrix[rowIndex][columnIndex - 1]
matrix[rowIndex][columnIndex - 1],
)
}
}

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />

View File

@ -2911,6 +2911,6 @@ for (let i = 0; i < 50; i++) {
.split("")
// .map((l, i) => (i == 6 ? l.toUpperCase() : l))
.map((l, i) => (i == 0 ? " " + l : l))
.join("")
.join(""),
)
}

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en-us">
<head>
<meta charset="utf-8" />

View File

@ -3,9 +3,9 @@
# step 3: run this from the root directory
rm src/fonts/*.zip
mkdir src/fonts/CommitMono-1.140
mv src/fonts/website-export/CommitMono.zip src/fonts/CommitMono-1.140/CommitMono.zip
cd src/fonts/CommitMono-1.140
mkdir src/fonts/CommitMono-1.141
mv src/fonts/website-export/CommitMono.zip src/fonts/CommitMono-1.141/CommitMono.zip
cd src/fonts/CommitMono-1.141
unzip CommitMono.zip
rm CommitMono.zip
mkdir ttfautohint
@ -22,8 +22,8 @@ rm CommitMono-400-Italic-unhinted.ttf
rm CommitMono-700-Regular-unhinted.ttf
rm CommitMono-700-Italic-unhinted.ttf
cd ..
zip -vr CommitMono-1.140.zip CommitMono-1.140/ -x "*.DS_Store"
rm -R CommitMono-1.140
zip -vr CommitMono-1.141.zip CommitMono-1.141/ -x "*.DS_Store"
rm -R CommitMono-1.141
cd ..
cd ..

View File

@ -1,4 +1,4 @@
#1 Place file in Downloads
#1 Rename variable font to "CommitMonoV141-VF.ttf"
#2 Navigate to /Developer/woff2
#3
~/Developer/woff2/woff2_compress ~/Library/CloudStorage/Dropbox/Privat/Eigils\ ting/projects/typography/Font\ Projects/code-mono-font/commit-mono/export/CommitMonoV140/CommitMonoV140-VF.ttf
~/Developer/woff2/woff2_compress ~/Library/CloudStorage/Dropbox/Privat/Eigils\ ting/projects/typography/Font\ Projects/code-mono-font/commit-mono/export/CommitMonoV141/CommitMonoV141-VF.ttf