Skip to content

Commit

Permalink
fix(troika-three-text): Fix error when first character is whitespace #…
Browse files Browse the repository at this point in the history
  • Loading branch information
lojjic committed Nov 10, 2024
1 parent 8f83424 commit f71679e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/troika-three-text/src/FontResolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,13 @@ export function createFontResolver(fontParser, unicodeFontResolverClient) {
// - this character is whitespace
if (
(prevCharResult === RESOLVED && fontResolutions[charResolutions[i - 1]].supportsCodePoint(codePoint)) ||
/\s/.test(text[i])
(i > 0 && /\s/.test(text[i]))
) {
charResolutions[i] = charResolutions[i - 1]
if (prevCharResult === NEEDS_FALLBACK) {
fallbackRanges[fallbackRanges.length - 1][1] = i
}
} else {
} else {
for (let j = charResolutions[i], jLen = userFonts.length; j <= jLen; j++) {
if (j === jLen) {
// none of the user fonts matched; needs fallback
Expand Down

0 comments on commit f71679e

Please sign in to comment.