class Phew::FontRepository

Cache for font information retrieved from a Pango context

Public Class Methods

new(context) click to toggle source

@param [Pango::Context] context Pango context to retrieve fonts from.

# File lib/phew/font_repository.rb, line 9
def initialize(context)
  @store = {}
  @context = context
end

Public Instance Methods

get_font(text_description) click to toggle source

Retrieve a font based on the given text description. The text description should be in the format accepted by Font#new.

@param [String] text_description Description of the font to retrieve.

# File lib/phew/font_repository.rb, line 18
def get_font(text_description)
  @store[text_description] ||= Font.new @context, text_description
end