lets-plot-compose/src/desktopMain/kotlin/org/jetbrains/letsPlot/compose/canvas/SkiaFontManager.kt [11:54]: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - fun matchFamiliesStyle(fontFamily: List, fontStyle: FontStyle): Typeface { val fontConfig = fontFamily to fontStyle if (fontConfig in typefaceCache) { return typefaceCache.getValue(fontConfig) } var typeface = fontFamily.firstNotNullOfOrNull { FontMgr.default.matchFamilyStyle(it, fontStyle) } if (typeface == null || typeface.familyName == "") { typeface = fontFamily.firstNotNullOfOrNull { FontMgr.default.legacyMakeTypeface(it, fontStyle) } } if (typeface == null || typeface.familyName == "") { typeface = FontMgr.default.legacyMakeTypeface("sans-serif", fontStyle) } if (typeface == null || typeface.familyName == "") { println("Font not found: [${fontFamily.joinToString()}]") typeface = Typeface.makeEmpty() } typefaceCache[fontConfig] = typeface return typeface } fun font(typeface: Typeface, fontSize: Float): Font { return fontCache .getOrPut(typeface to fontSize) { Font(typeface, fontSize).apply { isSubpixel = true } } } fun dispose() { typefaceCache.values.forEach(Typeface::close) typefaceCache.clear() fontCache.values.forEach(Font::close) fontCache.clear() - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - platf-skia/src/commonMain/kotlin/org/jetbrains/letsPlot/skia/mapping/svg/FontManager.kt [14:57]: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - fun matchFamiliesStyle(fontFamily: List, fontStyle: FontStyle): Typeface { val fontConfig = fontFamily to fontStyle if (fontConfig in typefaceCache) { return typefaceCache.getValue(fontConfig) } var typeface = fontFamily.firstNotNullOfOrNull { FontMgr.default.matchFamilyStyle(it, fontStyle) } if (typeface == null || typeface.familyName == "") { typeface = fontFamily.firstNotNullOfOrNull { FontMgr.default.legacyMakeTypeface(it, fontStyle) } } if (typeface == null || typeface.familyName == "") { typeface = FontMgr.default.legacyMakeTypeface("sans-serif", fontStyle) } if (typeface == null || typeface.familyName == "") { println("Font not found: [${fontFamily.joinToString()}]") typeface = Typeface.makeEmpty() } typefaceCache[fontConfig] = typeface return typeface } fun font(typeface: Typeface, fontSize: Float): Font { return fontCache .getOrPut(typeface to fontSize) { Font(typeface, fontSize).apply { isSubpixel = true } } } fun dispose() { typefaceCache.values.forEach(Typeface::close) typefaceCache.clear() fontCache.values.forEach(Font::close) fontCache.clear() - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -