Module: Shoes::Font

Defined in:
shoes-core/lib/shoes/font.rb

Constant Summary collapse

FONT_TYPES =
"{ttf,ttc,otf,fnt,fon,bdf,pcf,snf,mmm,pfb,pfm}"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.loaded_fontsObject (readonly)

Returns the value of attribute loaded_fonts.



11
12
13
# File 'shoes-core/lib/shoes/font.rb', line 11

def loaded_fonts
  @loaded_fonts
end

Class Method Details

.add_font(path) ⇒ Object



21
22
23
# File 'shoes-core/lib/shoes/font.rb', line 21

def add_font(path)
  Shoes.backend::Font.add_font(path)
end

.add_font_to_fonts(path) ⇒ Object



25
26
27
28
29
# File 'shoes-core/lib/shoes/font.rb', line 25

def add_font_to_fonts(path)
  name = font_name(path)
  Shoes::FONTS << name
  name
end

.font_paths_from_dir(path) ⇒ Object



13
14
15
16
17
18
19
# File 'shoes-core/lib/shoes/font.rb', line 13

def font_paths_from_dir(path)
  font_paths = []
  Dir.glob(path + "**/*." + FONT_TYPES).each do |font_path|
    font_paths << font_path
  end
  font_paths
end