Module: FontFamily

Defined in:
lib/rsyntaxtree/utils.rb

Class Method Summary collapse

Class Method Details

.for_pango(style) ⇒ Object



87
88
89
# File 'lib/rsyntaxtree/utils.rb', line 87

def for_pango(style)
  list(style).join(", ")
end

.for_svg(style) ⇒ Object



83
84
85
# File 'lib/rsyntaxtree/utils.rb', line 83

def for_svg(style)
  list(style).map { |name| name.include?(" ") ? "'#{name}'" : name }.join(", ")
end

.list(style) ⇒ Object

One order, used by the measuring and by the drawing alike. There was a second, with the CJK face moved to the front, which measurement switched to as soon as any character outside ASCII appeared anywhere in the figure while the drawing kept to this one — so Latin text was measured in a face it was not set in. Fontconfig reaches the CJK faces through this order anyway, the scripts that need them measuring the same either way, so the second order bought nothing and is gone.



79
80
81
# File 'lib/rsyntaxtree/utils.rb', line 79

def list(style)
  FONT_FAMILIES.fetch(style.to_sym)
end