Sha256: 992f4e81ebbee908c36272a1915b9816bdc9f4addf58a824849fbee085cb123c
Contents?: true
Size: 965 Bytes
Versions: 1
Compression:
Stored size: 965 Bytes
Contents
# frozen_string_literal: true class Shoes FONT_DIR = DIR + "/fonts/" module Font FONT_TYPES = "{ttf,ttc,otf,fnt,fon,bdf,pcf,snf,mmm,pfb,pfm}" @loaded_fonts = {} class << self attr_reader :loaded_fonts 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 def add_font(path) Shoes.backend::Font.add_font(path) end def add_font_to_fonts(path) name = font_name(path) Shoes::FONTS << name name end private def font_name(path) remove_file_ext(parse_filename_from_path(path)) end def parse_filename_from_path(file_path) Pathname.new(file_path).basename.to_s end def remove_file_ext(file_name) file_name.chomp(File.extname(file_name)) end end end FONTS = [] end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
shoes-core-4.0.0.rc1 | lib/shoes/font.rb |