Skip to content
This repository was archived by the owner on Mar 26, 2024. It is now read-only.

Commit

Permalink
Fixed font in terminal on MacOS
Browse files Browse the repository at this point in the history
  • Loading branch information
ISeleznev-HORIS authored and SerVB committed Jun 25, 2020
1 parent 53a8dad commit 2286197
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ object ProjectorFontProvider : FontProvider {
override val defaultPlatformFont: Array<String> get() = arrayOf(DEFAULT_FONT_NAME, DEFAULT_FONT_PATH)

override fun findFont2D(name: String, style: Int, fallback: Int): Font2D {
if ("mono" in name.toLowerCase()) {
if (isMonospacedFont(name)) {
return when (style) {
Font.BOLD or Font.ITALIC -> monoBoldItalic

Expand All @@ -87,6 +87,10 @@ object ProjectorFontProvider : FontProvider {
}
}

private fun isMonospacedFont(name: String): Boolean {
return "mono" in name.toLowerCase() || name.toLowerCase() == "menlo"
}

private fun loadFont(fontName: String, fontPath: String): PhysicalFont {
val tempFile = File.createTempFile(fontName, ".ttf").apply {
deleteOnExit()
Expand Down

0 comments on commit 2286197

Please sign in to comment.