Sha256: 944b9b4be4251233c20503f4c2f738738e41e880657b11a4551505612061276e
Contents?: true
Size: 959 Bytes
Versions: 18
Compression:
Stored size: 959 Bytes
Contents
# frozen_string_literal: true # Handle font setting to draw texts class Gruff::Font BOLD_PATH = File.expand_path(File.join(__FILE__, '../../../assets/fonts/Roboto-Bold.ttf')).freeze private_constant :BOLD_PATH REGULAR_PATH = File.expand_path(File.join(__FILE__, '../../../assets/fonts/Roboto-Regular.ttf')).freeze private_constant :REGULAR_PATH # Get/set font path. attr_accessor :path # Get/set font size. attr_accessor :size # Get/set font setting whether render bold text. attr_accessor :bold # Get/set font color. attr_accessor :color def initialize(path: nil, size: 20.0, bold: false, color: 'white') @path = path @bold = bold @size = size @color = color end # Get font weight. # @return [Magick::WeightType] font weight def weight @bold ? Magick::BoldWeight : Magick::NormalWeight end # @private def file_path return @path if @path @bold ? BOLD_PATH : REGULAR_PATH end end
Version data entries
18 entries across 18 versions & 1 rubygems