File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
packages/engine/Source/Scene Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -138,8 +138,14 @@ function rebindAllGlyphs(labelCollection, label) {
138138 const glyphs = label . _glyphs ;
139139 const glyphsLength = glyphs . length ;
140140
141+ // Compute SDF size based on largest label font size.
142+ const sdfSize = labelCollection . _labels . reduce (
143+ ( maxSize , label ) => Math . max ( maxSize , Number ( label . _fontSize ) ) ,
144+ SDFSettings . FONT_SIZE ,
145+ ) ;
146+
141147 // Compute a font size scale relative to the sdf font generated size.
142- label . _relativeSize = label . _fontSize / SDFSettings . FONT_SIZE ;
148+ label . _relativeSize = label . _fontSize / sdfSize ;
143149
144150 // if we have more glyphs than needed, unbind the extras.
145151 if ( textLength < glyphsLength ) {
@@ -184,6 +190,7 @@ function rebindAllGlyphs(labelCollection, label) {
184190 character ,
185191 label . _fontFamily ,
186192 label . _fontStyle ,
193+ label . _fontSize ,
187194 label . _fontWeight ,
188195 + verticalOrigin ,
189196 ] ) ;
@@ -194,7 +201,7 @@ function rebindAllGlyphs(labelCollection, label) {
194201 glyphBillboardTexture = new BillboardTexture ( glyphBillboardCollection ) ;
195202 glyphTextureCache . set ( id , glyphBillboardTexture ) ;
196203
197- const glyphFont = `${ label . _fontStyle } ${ label . _fontWeight } ${ SDFSettings . FONT_SIZE } px ${ label . _fontFamily } ` ;
204+ const glyphFont = `${ label . _fontStyle } ${ label . _fontWeight } ${ sdfSize } px ${ label . _fontFamily } ` ;
198205
199206 const canvas = createGlyphCanvas (
200207 character ,
You can’t perform that action at this time.
0 commit comments