@@ -175,30 +175,29 @@ function makeCustomFont(settings) {
175
175
const newWidthDecrease = websiteData . letterSpacing * 10
176
176
const newWidthMoveAmount = websiteData . letterSpacing * 5
177
177
console . log ( newWidth , newWidthDecrease , newWidthMoveAmount )
178
- Object . values ( font . glyphs . glyphs ) . forEach ( ( glyph , index ) => {
178
+ Object . values ( font . glyphs . glyphs ) . forEach ( ( glyph ) => {
179
179
glyph . path . commands . forEach ( ( command ) => {
180
180
if ( command . type === "M" || command . type === "L" ) {
181
- command . x = command . x + newWidthMoveAmount
181
+ command . x += newWidthMoveAmount
182
182
}
183
183
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
187
187
}
188
188
} )
189
- glyph . leftSideBearing = glyph . leftSideBearing + newWidthMoveAmount
189
+ glyph . leftSideBearing += newWidthMoveAmount
190
190
glyph . advanceWidth = newWidth
191
- if ( index % 100 == 10 ) console . log ( glyph )
192
191
} )
193
192
font . defaultWidthX = newWidth
194
193
font . tables . cff . topDict . _defaultWidthX = newWidth
195
194
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
198
197
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
202
201
font . tables . os2 . xAvgCharWidth = newWidth
203
202
204
203
// change height
0 commit comments