Sha256: d3c4ce274e2c8a25dc2d595e18152f078656eef1f1d72e3a54dbdde918742b0d

Contents?: true

Size: 509 Bytes

Versions: 3

Compression:

Stored size: 509 Bytes

Contents

module DXOpal
  # Represents a font
  # Used by Window.draw_font, etc.
  class Font
    def self.default; @@default ||= Font.new(24); end
    def self.default=(f); @@default = f; end

    def initialize(size, fontname=nil, option={})
      @size = size
      @orig_fontname = fontname
      @fontname = fontname || "sans-serif"
    end

    def size; @size; end
    def fontname; @orig_fontname; end

    # Return a string like "48px serif"
    def _spec_str
      "#{@size}px #{@fontname}"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dxopal-1.3.0 opal/dxopal/font.rb
dxopal-1.2.0 opal/dxopal/font.rb
dxopal-1.1.0 opal/dxopal/font.rb