add fonts methods

Fixes #334
This commit is contained in:
Andy Meneely
2021-07-22 15:09:45 -04:00
parent 971bb82e72
commit d92aab4bf3
8 changed files with 78 additions and 3 deletions
+17
View File
@@ -0,0 +1,17 @@
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
+1 -1
View File
@@ -6,6 +6,6 @@ module Squib
# Most of the time this is in the alpha of the next release.
# e.g. v0.0.5a is on its way to becoming v0.0.5
#
VERSION = '0.17.0a'
VERSION = '0.16.1'
end