@@ -15,7 +15,7 @@ export function layoutText(font: Font, str: string, maxW: number): TextLayout {
15
15
while ( chars . length < str . length ) {
16
16
const i = chars . length
17
17
const char = str [ i ] !
18
- let layout
18
+ let layout : TextLayout
19
19
if ( char === '\n' ) layout = layoutNewline ( font , cursor )
20
20
else if ( / ^ \s * $ / . test ( char ) ) {
21
21
layout = layoutSpace ( font , cursor , maxW , tracking ( font , char , str [ i + 1 ] ) )
@@ -54,14 +54,15 @@ export function layoutWord(
54
54
const span = tracking ( font , char , word [ index + 1 ] )
55
55
if ( x > 0 && x + span > maxW ) ( { x, y} = nextLine ( font , y ) )
56
56
57
- // Width is not span since, with kerning, that may exceed the actual
58
- // width of the character's sprite. For example, if w has the maximal
57
+ // width is not span since, with kerning, that may exceed the actual
58
+ // width of the character's sprite. for example, if w has the maximal
59
59
// character width of five pixels and a one pixel kerning for a given pair
60
60
// of characters, it will have a span of six pixels which is greater than
61
61
// the maximal five pixel sprite that can be rendered.
62
62
chars . push ( { x, y, w : fontCharWidth ( font , char ) , h : font . cellHeight } )
63
63
x += span
64
64
65
+ // biome-ignore lint/style/noParameterAssign:
65
66
index ++
66
67
}
67
68
return { chars, cursor : { x, y} }
@@ -76,7 +77,7 @@ function layoutNewline(font: Font, cursor: Readonly<XY>): TextLayout {
76
77
}
77
78
78
79
/**
79
- * @arg span The distance in pixels from the start of the current character to
80
+ * @arg span the distance in pixels from the start of the current character to
80
81
* the start of the next including scale.
81
82
*/
82
83
function layoutSpace (
@@ -92,7 +93,7 @@ function layoutSpace(
92
93
return { chars : [ undefined ] , cursor : nextCursor }
93
94
}
94
95
95
- /** Returns the distance in pixels from the start of lhs to the start of rhs. */
96
+ /** @return the distance in pixels from the start of lhs to the start of rhs. */
96
97
function tracking ( font : Font , lhs : string , rhs : string | undefined ) : number {
97
98
return fontCharWidth ( font , lhs ) + fontKerning ( font , lhs , rhs )
98
99
}
0 commit comments