mirror of
https://github.com/TermoraDev/termora.git
synced 2026-01-16 02:12:58 +08:00
feat: support system fonts (#260)
This commit is contained in:
@@ -46,6 +46,7 @@ import org.jdesktop.swingx.JXEditorPane
|
|||||||
import org.slf4j.LoggerFactory
|
import org.slf4j.LoggerFactory
|
||||||
import java.awt.BorderLayout
|
import java.awt.BorderLayout
|
||||||
import java.awt.Component
|
import java.awt.Component
|
||||||
|
import java.awt.Dimension
|
||||||
import java.awt.Toolkit
|
import java.awt.Toolkit
|
||||||
import java.awt.datatransfer.StringSelection
|
import java.awt.datatransfer.StringSelection
|
||||||
import java.awt.event.ItemEvent
|
import java.awt.event.ItemEvent
|
||||||
@@ -425,6 +426,11 @@ class SettingsOptionsPane : OptionsPane() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fontComboBox.renderer = object : DefaultListCellRenderer() {
|
fontComboBox.renderer = object : DefaultListCellRenderer() {
|
||||||
|
init {
|
||||||
|
preferredSize = Dimension(preferredSize.width, fontComboBox.preferredSize.height - 2)
|
||||||
|
maximumSize = Dimension(preferredSize.width, preferredSize.height)
|
||||||
|
}
|
||||||
|
|
||||||
override fun getListCellRendererComponent(
|
override fun getListCellRendererComponent(
|
||||||
list: JList<*>?,
|
list: JList<*>?,
|
||||||
value: Any?,
|
value: Any?,
|
||||||
@@ -458,28 +464,11 @@ class SettingsOptionsPane : OptionsPane() {
|
|||||||
|
|
||||||
shellComboBox.selectedItem = terminalSetting.localShell
|
shellComboBox.selectedItem = terminalSetting.localShell
|
||||||
|
|
||||||
val fonts = linkedSetOf(
|
val fonts = linkedSetOf<String>("JetBrains Mono", "Source Code Pro", "Monospaced")
|
||||||
"JetBrains Mono",
|
FontUtils.getAllFonts().forEach {
|
||||||
"Source Code Pro",
|
if (!fonts.contains(it.family)) {
|
||||||
"Monospaced",
|
fonts.addLast(it.family)
|
||||||
"Andale Mono",
|
|
||||||
"Ayuthaya",
|
|
||||||
"Courier New",
|
|
||||||
"Droid Sans Mono",
|
|
||||||
"Fira Code",
|
|
||||||
"PCMyungjo",
|
|
||||||
"Menlo",
|
|
||||||
"Monaco",
|
|
||||||
"Osaka",
|
|
||||||
"PT Mono",
|
|
||||||
"SimSong",
|
|
||||||
)
|
|
||||||
|
|
||||||
for (font in FontUtils.getAllFonts()) {
|
|
||||||
if (fonts.contains(font.family)) {
|
|
||||||
continue
|
|
||||||
}
|
}
|
||||||
fonts.remove(font.family)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (font in fonts) {
|
for (font in fonts) {
|
||||||
|
|||||||
Reference in New Issue
Block a user