Custom desktop font?
See original GitHub issueMy friend complained to me that the font was not clear.
So we can add a custom font setting in desktop. Even if this setting is not displayed.
One of my idea:
Index: desktop/src/com/unciv/app/desktop/NativeFontDesktop.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/desktop/src/com/unciv/app/desktop/NativeFontDesktop.kt b/desktop/src/com/unciv/app/desktop/NativeFontDesktop.kt
--- a/desktop/src/com/unciv/app/desktop/NativeFontDesktop.kt (revision fef993d5dca34f871f7a45a585cae7a73be77d6b)
+++ b/desktop/src/com/unciv/app/desktop/NativeFontDesktop.kt (date 1647660638627)
@@ -1,6 +1,10 @@
package com.unciv.app.desktop
+import com.badlogic.gdx.files.FileHandle
import com.badlogic.gdx.graphics.Pixmap
+import com.unciv.JsonParser
+import com.unciv.logic.GameSaver
+import com.unciv.models.metadata.GameSettings
import com.unciv.ui.utils.NativeFontImplementation
import java.awt.*
import java.awt.image.BufferedImage
@@ -8,7 +12,11 @@
class NativeFontDesktop(private val size: Int) : NativeFontImplementation {
private val font by lazy {
- Font("", Font.PLAIN, size)
+ val settings = JsonParser().getFromJson(
+ GameSettings::class.java,
+ FileHandle(GameSaver.settingsFileName)
+ )
+ Font(settings.desktopFontFamily, Font.PLAIN, size)
}
private val metric by lazy {
val bi = BufferedImage(1, 1, BufferedImage.TYPE_4BYTE_ABGR)
Index: core/src/com/unciv/models/metadata/GameSettings.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/core/src/com/unciv/models/metadata/GameSettings.kt b/core/src/com/unciv/models/metadata/GameSettings.kt
--- a/core/src/com/unciv/models/metadata/GameSettings.kt (revision fef993d5dca34f871f7a45a585cae7a73be77d6b)
+++ b/core/src/com/unciv/models/metadata/GameSettings.kt (date 1647660638622)
@@ -19,6 +19,7 @@
var checkForDueUnits: Boolean = true
var singleTapMove: Boolean = false
var language: String = "English"
+ var desktopFontFamily: String = ""
@Transient
var locale: Locale? = null
var resolution: String = "900x600" // Auto-detecting resolution was a BAD IDEA since it needs to be based on DPI AND resolution.
Preview font change by 黑体
with Simplified-Chinese
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:25 (11 by maintainers)
Top Results From Across the Web
How to Change the Desktop Font - Computer Hope
Choose a font · Open the Windows Control Panel. · If your Control Panel uses the Category view mode, click the Appearance and...
Read more >How to Change the Default System Font on Windows 10
Open the Settings app. In Settings, click “Personalization,” then select “Fonts” in the left sidebar. · Open Notepad · Save the new default...
Read more >Add a font - Microsoft Support
If you want to see what a font looks like, open the Fonts folder, right-click the font file, and then click Preview. Another...
Read more >Font Support - Fontspring
Fontspring Basics. Account Support · Checkout and Billing. Licenses. Desktop Licenses · Web Font Licenses. Font Support. Install Guide · Using your Fonts....
Read more >How to Install Custom Fonts on Your Computer [Quick Tip]
How to Install Fonts on a PC · 1) Shut down any program you want to use the font in. · close_ppt ·...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If users want choose less readable fonts, this should probably be their power too.
This support all desktop device and Android. At first, I just wanted to support the desktop. @SomeTroglodyte provides code for Android device support.