mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-29 22:29:15 +07:00
Support for languages using Diacritics as multi-codepoint joiners (#11806)
* Diacritics support - achieving 1-Char-Per-Glyph via a fake alphabet * Diacritics support - Redesign state engine and polishing * Diacritics support - Unit test * Diacritics support - Expand unit test to cover more cases * Diacritics support - Expand unit test to cover more cases * Clarify a function name * Change format of diacritic definitions * Refactor DiacriticSupport to per-language class with statics in Companion * Update DiacriticSupport to use CharCategory and enable support of surrogate pairs * Documentation
This commit is contained in:
@ -61,8 +61,12 @@ class DesktopFont : FontImplementation {
|
||||
return font.size
|
||||
}
|
||||
|
||||
override fun getCharPixmap(char: Char): Pixmap {
|
||||
var width = metric.charWidth(char)
|
||||
override fun getCharPixmap(char: Char) = getCharPixmapCommon(char.toString(), metric.charWidth(char))
|
||||
|
||||
override fun getCharPixmap(symbolString: String) = getCharPixmapCommon(symbolString, metric.stringWidth(symbolString))
|
||||
|
||||
private fun getCharPixmapCommon(symbolString: String, measuredWidth: Int): Pixmap {
|
||||
var width = measuredWidth
|
||||
var height = metric.height
|
||||
if (width == 0) {
|
||||
// This happens e.g. for the Tab character
|
||||
@ -75,7 +79,7 @@ class DesktopFont : FontImplementation {
|
||||
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON)
|
||||
g.font = font
|
||||
g.color = Color.WHITE
|
||||
g.drawString(char.toString(), 0, metric.leading + metric.ascent)
|
||||
g.drawString(symbolString, 0, metric.leading + metric.ascent)
|
||||
|
||||
val pixmap = Pixmap(bi.width, bi.height, Pixmap.Format.RGBA8888)
|
||||
val data = bi.getRGB(0, 0, bi.width, bi.height, null, 0, bi.width)
|
||||
|
Reference in New Issue
Block a user