Skip to content

Commit

Permalink
Add support for custom user fonts
Browse files Browse the repository at this point in the history
We load fonts from the user's font directory if present.
  • Loading branch information
nilnor committed Apr 19, 2018
1 parent 815aee8 commit eafe100
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Changelog.md
Expand Up @@ -2,6 +2,9 @@

## Unreleased (in master)

- Added support for custom user fonts (place them in <CONFIG-DIR>/fonts, e.g.
~/.howl/fonts)

- Added `project-switch-buffer` command that displays open buffers within
the current project.

Expand Down
4 changes: 4 additions & 0 deletions lib/howl/application.moon
Expand Up @@ -328,6 +328,10 @@ class Application extends PropertyObject
@_load_core!
if @settings.dir
append bundle.dirs, @settings.dir\join 'bundles'
fonts_dir = @settings.dir\join('fonts')
if fonts_dir.exists
C.FcConfigAppFontAddDir(nil, fonts_dir.path)

bundle.load_all!

unless @args.no_profile
Expand Down
4 changes: 2 additions & 2 deletions lib/howl/init.lua
Expand Up @@ -170,8 +170,6 @@ local function main()
set_package_path('lib', 'lib/ext', 'lib/ext/moonscript')
require 'howl.moonscript_support'
table.insert(package.loaders, 2, bytecode_loader())
require 'howl.cdefs.fontconfig'
ffi.C.FcConfigAppFontAddDir(nil, table.concat({app_root, 'fonts'}, path_separator))
require 'ljglibs.cdefs.glib'

howl = auto_module('howl')
Expand All @@ -189,6 +187,8 @@ local function main()
print("Copyright 2012-2017 The Howl Developers\nLicense: MIT License")
os.exit(0)
else
require 'howl.cdefs.fontconfig'
ffi.C.FcConfigAppFontAddDir(nil, table.concat({app_root, 'fonts'}, path_separator))
-- set up the the GC to be more aggressive, we have a lot
-- of cdata that needs to be collected
collectgarbage('setstepmul', 400)
Expand Down

0 comments on commit eafe100

Please sign in to comment.