Sha256: d7df239019efc432344bc6b19127fd0c430e1df3376552aff43501c399a712b1

Contents?: true

Size: 525 Bytes

Versions: 3

Compression:

Stored size: 525 Bytes

Contents

require 'pango'
module Squib

  # List all system fonts that Cairo/Pango can see
  # Wow this call was convoluted...
  # Returns array of strings with the names of fonts
  module_function def system_fonts
    cc = Cairo::Context.new(Cairo::ImageSurface.new(0,0)) # empty image
    cc.create_pango_layout.context.families.map {|f| f.name }
  end

  # Prints out the system fonts in sorted order
  module_function def print_system_fonts
    puts "== DEBUG: Squib knows about these fonts =="
    puts system_fonts.sort
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
squib-0.19.0 lib/squib/system_fonts.rb
squib-0.19.0b lib/squib/system_fonts.rb
squib-0.19.0a lib/squib/system_fonts.rb