Commit e9f5135c0201ae3030e13ac5cdbbb182a33552c3
1 parent
da50df2f
Exists in
master
feat(custom font path): added the ability to add a custom font path
Showing
5 changed files
with
25 additions
and
2 deletions
Show diff stats
CHANGELOG.md
README.md
... | ... | @@ -78,6 +78,16 @@ LetterAvatar.setup do |config| |
78 | 78 | end |
79 | 79 | ``` |
80 | 80 | |
81 | +##### Custom font definition | |
82 | + | |
83 | +You can define your own `custom` palette: | |
84 | + | |
85 | +```ruby | |
86 | +LetterAvatar.setup do |config| | |
87 | + config.font = File.join(File.expand_path('../../', File.dirname(__FILE__)), 'app/assets/fonts', 'font_name.ext') | |
88 | +end | |
89 | +``` | |
90 | + | |
81 | 91 | ## Usage |
82 | 92 | |
83 | 93 | ```ruby | ... | ... |
lib/letter_avatar/avatar.rb
... | ... | @@ -67,7 +67,7 @@ module LetterAvatar |
67 | 67 | -size #{FULLSIZE}x#{FULLSIZE} |
68 | 68 | xc:#{to_rgb(identity.color)} |
69 | 69 | -pointsize #{LetterAvatar.pointsize} |
70 | - -font #{FONT_FILENAME} | |
70 | + -font #{LetterAvatar.font} | |
71 | 71 | -weight #{LetterAvatar.weight} |
72 | 72 | -fill '#{LetterAvatar.fill_color}' |
73 | 73 | -gravity Center | ... | ... |
lib/letter_avatar/configuration.rb
lib/letter_avatar/version.rb