mirror of
https://github.com/felixangell/phi.git
synced 2024-09-11 07:45:30 +03:00
you can now set a custom font dir
This commit is contained in:
parent
9fa60138b3
commit
e6234ba706
@ -116,6 +116,7 @@ type EditorConfig struct {
|
||||
Match_Braces bool
|
||||
Maintain_Indentation bool
|
||||
Highlight_Line bool
|
||||
Font_Path string
|
||||
Font_Face string
|
||||
Font_Size int
|
||||
Show_Line_Numbers bool
|
||||
|
@ -82,17 +82,23 @@ func configureAndValidate(conf *TomlConfig) {
|
||||
// fonts
|
||||
log.Println("Configuring fonts")
|
||||
{
|
||||
switch runtime.GOOS {
|
||||
case "windows":
|
||||
FONT_FOLDER = filepath.Join(os.Getenv("WINDIR"), "fonts")
|
||||
case "darwin":
|
||||
FONT_FOLDER = "/Library/Fonts/"
|
||||
case "linux":
|
||||
FONT_FOLDER = findFontFolder()
|
||||
// the font path has not been set
|
||||
// so we have to figure out what it is.
|
||||
if len(conf.Editor.Font_Path) == 0 {
|
||||
switch runtime.GOOS {
|
||||
case "windows":
|
||||
FONT_FOLDER = filepath.Join(os.Getenv("WINDIR"), "fonts")
|
||||
case "darwin":
|
||||
FONT_FOLDER = "/Library/Fonts/"
|
||||
case "linux":
|
||||
FONT_FOLDER = findFontFolder()
|
||||
}
|
||||
// and set it accordingly.
|
||||
conf.Editor.Font_Path = FONT_FOLDER
|
||||
}
|
||||
|
||||
// we only support ttf at the moment.
|
||||
fontPath := filepath.Join(FONT_FOLDER, conf.Editor.Font_Face) + ".ttf"
|
||||
fontPath := filepath.Join(conf.Editor.Font_Path, conf.Editor.Font_Face) + ".ttf"
|
||||
if _, err := os.Stat(fontPath); os.IsNotExist(err) {
|
||||
log.Fatal("No such font '" + fontPath + "'")
|
||||
// TODO cool error messages for the toml format?
|
||||
|
Loading…
Reference in New Issue
Block a user