Skip to content

Commit 4f43a8c

Browse files
simplify
1 parent eb21b8d commit 4f43a8c

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

src/js/download_wizard.js

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -175,30 +175,29 @@ function makeCustomFont(settings) {
175175
const newWidthDecrease = websiteData.letterSpacing * 10
176176
const newWidthMoveAmount = websiteData.letterSpacing * 5
177177
console.log(newWidth, newWidthDecrease, newWidthMoveAmount)
178-
Object.values(font.glyphs.glyphs).forEach((glyph, index) => {
178+
Object.values(font.glyphs.glyphs).forEach((glyph) => {
179179
glyph.path.commands.forEach((command) => {
180180
if (command.type === "M" || command.type === "L") {
181-
command.x = command.x + newWidthMoveAmount
181+
command.x += newWidthMoveAmount
182182
}
183183
if (command.type === "C") {
184-
command.x = command.x + newWidthMoveAmount
185-
command.x1 = command.x1 + newWidthMoveAmount
186-
command.x2 = command.x2 + newWidthMoveAmount
184+
command.x += newWidthMoveAmount
185+
command.x1 += newWidthMoveAmount
186+
command.x2 += newWidthMoveAmount
187187
}
188188
})
189-
glyph.leftSideBearing = glyph.leftSideBearing + newWidthMoveAmount
189+
glyph.leftSideBearing += newWidthMoveAmount
190190
glyph.advanceWidth = newWidth
191-
if (index % 100 == 10) console.log(glyph)
192191
})
193192
font.defaultWidthX = newWidth
194193
font.tables.cff.topDict._defaultWidthX = newWidth
195194
font.tables.cff.topDict._privateDict.defaultWidthX = newWidth
196-
font.tables.head.yMax = font.tables.head.yMax + newWidthMoveAmount
197-
font.tables.head.yMin = font.tables.head.yMin + newWidthMoveAmount
195+
font.tables.head.yMax += newWidthMoveAmount
196+
font.tables.head.yMin += newWidthMoveAmount
198197
font.tables.hhea.advanceWidthMax = newWidth
199-
font.tables.hhea.minLeftSideBearing = font.tables.hhea.minLeftSideBearing + newWidthMoveAmount
200-
font.tables.hhea.minRightSideBearing = font.tables.hhea.minRightSideBearing + newWidthMoveAmount
201-
font.tables.hhea.xMaxExtent = font.tables.hhea.xMaxExtent + newWidthDecrease
198+
font.tables.hhea.minLeftSideBearing += newWidthMoveAmount
199+
font.tables.hhea.minRightSideBearing += newWidthMoveAmount
200+
font.tables.hhea.xMaxExtent += newWidthDecrease
202201
font.tables.os2.xAvgCharWidth = newWidth
203202

204203
// change height

0 commit comments

Comments
 (0)