mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-23 06:08:46 +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:
@ -9,6 +9,15 @@
|
||||
# Don't translate these words to your language, only put 'true' or 'false'.
|
||||
StartWithCapitalLetter =
|
||||
|
||||
# Diacritics Support:
|
||||
# See https://yairm210.github.io/Unciv/Other/Translating/#diacritics-support for details!
|
||||
# Most languages will not need these, feel free to ignore, or use "" to avoid the "requires translation" mark. Do NOT translate the "key" to the left of the equals sign!
|
||||
diacritics_support =
|
||||
unicode_block_start_character =
|
||||
unicode_block_end_character =
|
||||
left_joining_diacritics =
|
||||
right_joining_diacritics =
|
||||
left_and_right_joiners =
|
||||
|
||||
# Fastlane
|
||||
# These will be automatically copied to the fastlane descriptions used by F-Droid. Their keys are not as usual the english original, please read those directly as linked.
|
||||
|
@ -90,9 +90,9 @@ class AndroidFont : FontImplementation {
|
||||
return paint.textSize.toInt()
|
||||
}
|
||||
|
||||
override fun getCharPixmap(char: Char): Pixmap {
|
||||
override fun getCharPixmap(symbolString: String): Pixmap {
|
||||
val metric = getMetrics() // Use our interpretation instead of paint.fontMetrics because it fixes some bad metrics
|
||||
var width = paint.measureText(char.toString()).toInt()
|
||||
var width = paint.measureText(symbolString).toInt()
|
||||
var height = ceil(metric.height).toInt()
|
||||
if (width == 0) {
|
||||
height = getFontSize()
|
||||
@ -101,7 +101,7 @@ class AndroidFont : FontImplementation {
|
||||
|
||||
val bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888)
|
||||
val canvas = Canvas(bitmap)
|
||||
canvas.drawText(char.toString(), 0f, metric.leading + metric.ascent + 1f, paint)
|
||||
canvas.drawText(symbolString, 0f, metric.leading + metric.ascent + 1f, paint)
|
||||
|
||||
val pixmap = Pixmap(width, height, Pixmap.Format.RGBA8888)
|
||||
val data = IntArray(width * height)
|
||||
|
Reference in New Issue
Block a user