Class: RubyCharts::Config
- Inherits:
-
Object
- Object
- RubyCharts::Config
- Defined in:
- lib/ruby_charts/config.rb
Constant Summary collapse
- DEFAULT_FONTS =
Default system fonts (adjust for your OS)
{ regular: '/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf', bold: '/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf' }.freeze
- MACOS_FONTS =
macOS alternatives
{ regular: '/Library/Fonts/Arial.ttf', bold: '/Library/Fonts/Arial Bold.ttf' }.freeze
- WINDOWS_FONTS =
Windows alternatives
{ regular: 'C:\\Windows\\Fonts\\arial.ttf', bold: 'C:\\Windows\\Fonts\\arialbd.ttf' }.freeze
Class Method Summary collapse
Class Method Details
.font(style = :regular) ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/ruby_charts/config.rb', line 23 def self.font(style = :regular) case RUBY_PLATFORM when /darwin/ MACOS_FONTS[style] when /mswin|mingw/ WINDOWS_FONTS[style] else DEFAULT_FONTS[style] end end |
.font_exists?(path) ⇒ Boolean
34 35 36 |
# File 'lib/ruby_charts/config.rb', line 34 def self.font_exists?(path) File.exist?(path) end |