-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
8 changed files
with
78 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
print_system_fonts | ||
================== | ||
|
||
Returns an array of font names that Squib knows about. These are what Squib considers "system" fonts. For debugging purposes. | ||
|
||
This is a module function, so it can be called anywhere with ``Squib.print_system_fonts`` | ||
|
||
|
||
Options | ||
------- | ||
|
||
None. | ||
|
||
|
||
Examples | ||
-------- | ||
|
||
.. literalinclude:: ../../samples/system_font_debug/_list_fonts.rb | ||
:language: ruby | ||
:linenos: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
system_fonts | ||
============ | ||
|
||
Returns an array of font names that Squib knows about. These are what Squib considers "system" fonts. For debugging purposes. | ||
|
||
This is a module function, so it can be called anywhere with ``Squib.system_fonts`` | ||
|
||
Options | ||
------- | ||
|
||
None. | ||
|
||
|
||
Examples | ||
-------- | ||
|
||
.. literalinclude:: ../../samples/system_font_debug/_list_fonts.rb | ||
:language: ruby | ||
:linenos: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# require 'squib' | ||
require_relative '../../lib/squib' | ||
|
||
# Per issue #334, sometimes Pango doesn't find the font file you want | ||
# Pango requires fonts to be installed on the system, but sometimes the | ||
# font name is not obvious. e.g. "Foo Regular" might be actually named "Foo" | ||
# Use these methods to debug this problem | ||
|
||
# Usually you would just run this method to see what fonts are installed | ||
# This is commented out to make our test cases | ||
# Squib.print_system_fonts | ||
|
||
Squib.system_fonts.include? 'Open Sans' # checks if we have Open Sans installed | ||
# Note: does nothing since it's just a check |