From d0362def8a04221166eb0eb069d7a37db188c132 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=AD=E3=81=93=E3=81=A0=20=E3=81=95=E3=81=B3=E3=81=93?= Date: Thu, 4 Sep 2025 00:08:46 +0900 Subject: [PATCH] feat(toroika-three-text): Add a lang option to preloadFont. --- packages/troika-three-text/src/TextBuilder.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/troika-three-text/src/TextBuilder.js b/packages/troika-three-text/src/TextBuilder.js index 0bcd5126..4cf424fb 100644 --- a/packages/troika-three-text/src/TextBuilder.js +++ b/packages/troika-three-text/src/TextBuilder.js @@ -391,11 +391,13 @@ function initContextLossHandling(atlas) { * possible glyphs, e.g. `["t", "h", "th"]` to get the "t" and "h" glyphs plus the "th" ligature. * @param {number} options.sdfGlyphSize - The size at which to prerender the SDF textures for the * specified `characters`. + * @param {string} options.lang - The language code of this text; can be used for explicitly selecting + * certain CJK fonts. * @param {function} callback - A function that will be called when the preloading is complete. */ -function preloadFont({font, characters, sdfGlyphSize}, callback) { +function preloadFont({font, characters, sdfGlyphSize, lang}, callback) { let text = Array.isArray(characters) ? characters.join('\n') : '' + characters - getTextRenderInfo({ font, sdfGlyphSize, text }, callback) + getTextRenderInfo({ font, sdfGlyphSize, text, lang }, callback) }