fix(api): incorrect format keyword in generated fonts css

Refs: #1849
This commit is contained in:
Gauthier Roebroeck 2025-02-03 14:50:50 +08:00
parent f46e0406f9
commit 0f05a065ac

View file

@ -135,7 +135,13 @@ class FontsController(
val srcBlock =
fonts.joinToString(separator = ",", postfix = ";") { resource ->
val path = Path(resource.uri.toString())
"""url('${path.name}') format('${path.extension}')"""
val format =
when (val extension = path.extension.lowercase()) {
"ttf" -> "truetype"
"otf" -> "opentype"
else -> extension
}
"""url('${path.name}') format('$format')"""
}
// language=CSS
return """