Repository: JetBrains/compose-multiplatform
File: components/resources/library/src/skikoMain/kotlin/org/jetbrains/compose/resources/FontResources.skiko.kt (Kotlin)

Code before:
actual fun Font(resource: FontResource, weight: FontWeight, style: FontStyle): Font {
    val resourceReader = LocalResourceReader.currentOrPreview
    val fontFile by rememberResourceState(resource, weight, style, { defaultEmptyFont }) { env ->
        val path = resource.getResourceItemByEnvironment(env).path
        val key = "$path:$weight:$style"
        fontCache.getOrLoad(key) {
            val fontBytes = resourceReader.read(path)
            Font(path, fontBytes, weight, style)
        }
    }
    return fontFile
}

@Composable
actual fun Font(
    resource: FontResource,
    weight: FontWeight,
    style: FontStyle,
    variationSettings: FontVariation.Settings,
): Font {
    val resourceReader = LocalResourceReader.currentOrPreview
    val fontFile by rememberResourceState(resource, weight, style, variationSettings, { defaultEmptyFont }) { env ->
        val path = resource.getResourceItemByEnvironment(env).path
        val settingsKey = variationSettings.settings
            .sortedBy { it::class.simpleName }
            .joinToString(",") { it::class.simpleName + "_" + it.hashCode() }
        val key = "$path:$weight:$style:$settingsKey"
        fontCache.getOrLoad(key) {
            val fontBytes = resourceReader.read(path)
            Font(key, fontBytes, weight, style, variationSettings)
        }
    }
    return fontFile
}

Review comment (suggestion):
-  `it.hashCode()` can cause collisions
- It seems that Setting.axisName is [unique](https://github.com/JetBrains/compose-multiplatform-core/blob/2cbd13c3c91e796df47bed6e21b7b225cf2c851e/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/font/FontVariation.kt#L234) and can be used as the key

Code after:
@Composable
actual fun Font(resource: FontResource, weight: FontWeight, style: FontStyle): Font {
    val resourceReader = LocalResourceReader.currentOrPreview
    val fontFile by rememberResourceState(resource, weight, style, { defaultEmptyFont }) { env ->
        val path = resource.getResourceItemByEnvironment(env).path
        val key = "$path:$weight:$style"
        fontCache.getOrLoad(key) {
            val fontBytes = resourceReader.read(path)
            Font(path, fontBytes, weight, style)
        }
    }
    return fontFile
}

@Composable
actual fun Font(
    resource: FontResource,
    weight: FontWeight,
    style: FontStyle,
    variationSettings: FontVariation.Settings,
): Font {
    val resourceReader = LocalResourceReader.currentOrPreview
    val fontFile by rememberResourceState(resource, weight, style, variationSettings, { defaultEmptyFont }) { env ->
        val path = resource.getResourceItemByEnvironment(env).path
        val key = "$path:$weight:$style:${variationSettings.getCacheKey()}"
        fontCache.getOrLoad(key) {
            val fontBytes = resourceReader.read(path)
            Font(key, fontBytes, weight, style, variationSettings)
        }
    }
    return fontFile
}

internal fun FontVariation.Settings.getCacheKey(): String {
    val defaultDensity = Density(1f)
    return settings
        .map { "${it::class.simpleName}(${it.axisName},${it.toVariationValue(defaultDensity)})" }
        .sorted()
        .joinToString(",")
}