1. Thibaut Colar
  2. camembert

Commits

Thibaut Colar  committed a5ee452

Modif to pick a default nice font according to the OS since DejaVu is not avail on win/ osx by default and that causing weird behavior in editor
bumped to 1.0.7

  • Participants
  • Parent commits 74aa99b
  • Branches default

Comments (0)

Files changed (2)

File src/brie/build.fan

View file
                `fan/command/`,
                `fan/widget/`]
     resDirs = [`res/`]
-    version = Version("1.0.6")
+    version = Version("1.0.7")
     meta    =  ["license.name"   : "Academic License",
                 "vcs.uri"   : "https://bitbucket.org/tcolar/camembert"]
     docSrc  = true

File src/brie/fan/util/Theme.fan

View file
 const class Theme
 {
   @Setting{help = ["Default font : for anyhting but the editor"]}
-  const Font font           := Font("9pt DejaVu Sans Mono", false) ?: Desktop.sysFont
+  const Font font           := bestFont(9)
 
   @Setting{help = ["Default font color : for anyhting but the editor"]}
   const Color fontColor     := Color.black
   const Color selectedItem := Color(0x99_ff_99)
 
   @Setting{help = ["Font used in editor pane'"]}
-  const Font edFont     := Font("11pt DejaVu Sans Mono", false) ?: Desktop.sysFont
+  const Font edFont     := bestFont(11)
 
   @Setting{help = ["Editor pane background color'"]}
   const Color edBg      := Color.white
   new make(|This|? f := null)
   {
     if (f != null) f(this)
-    }
+  }
 
+  ** Best programming fonts(IMO) available standard for the current os
+  Font bestFont(Int size)
+  {
+    Font? font
+    if(Env.cur.os == "win32")
+      font = Font("${size}pt Consolas", false)
+    else if(Env.cur.os == "macosx")
+      return Font("${size}pt Menlo", false)
+    else if(Env.cur.os == "linux")
+      return Font("${size}pt DejaVu Sans Mono", false)
+    // fallback to whatever java/SWT uses as the default
+    return font ?: Desktop.sysFont.toSize(size)
+  }
 }