Sha256: ccb687b1f50bb127a50904fd823b2b962a83b6abaae737e455e51c39f59cd91c

Contents?: true

Size: 750 Bytes

Versions: 5

Compression:

Stored size: 750 Bytes

Contents

class Shoes
  module Swt
    module Font
      class << self
        def add_font(path)
          if File.exist? path
            ::Shoes::Font.add_font_to_fonts(path) if load_font(path)
          end
        end

        def initial_fonts
          load_shoes_fonts # system fonts are loaded automatically by SWT
          ::Swt.display.get_font_list(nil, true).map(&:name)
        end

        private

        def load_font(path)
          ::Swt.display.load_font path
        end

        def load_shoes_fonts
          ::Shoes::Font.font_paths_from_dir(::Shoes::FONT_DIR).each do |font_path|
            add_font font_path
          end
        end
      end
    end
  end

  ::Shoes::Font.initial_fonts.each { |font| Shoes::FONTS << font }
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
shoes-swt-4.0.0.pre7 lib/shoes/swt/font.rb
shoes-swt-4.0.0.pre6 lib/shoes/swt/font.rb
shoes-swt-4.0.0.pre5 lib/shoes/swt/font.rb
shoes-swt-4.0.0.pre4 lib/shoes/swt/font.rb
shoes-swt-4.0.0.pre3 lib/shoes/swt/font.rb