Module: FontFamily
- Defined in:
- lib/rsyntaxtree/utils.rb
Class Method Summary collapse
- .for_pango(style, cjk_priority: false) ⇒ Object
- .for_svg(style, cjk_priority: false) ⇒ Object
-
.list(style, cjk_priority: false) ⇒ Object
cjk_priority: put the JP font first (mirrors the e branch in SVGGraph#draw_element).
Class Method Details
.for_pango(style, cjk_priority: false) ⇒ Object
41 42 43 |
# File 'lib/rsyntaxtree/utils.rb', line 41 def for_pango(style, cjk_priority: false) list(style, cjk_priority: cjk_priority).join(", ") end |
.for_svg(style, cjk_priority: false) ⇒ Object
37 38 39 |
# File 'lib/rsyntaxtree/utils.rb', line 37 def for_svg(style, cjk_priority: false) list(style, cjk_priority: cjk_priority).map { |name| name.include?(" ") ? "'#{name}'" : name }.join(", ") end |
.list(style, cjk_priority: false) ⇒ Object
cjk_priority: put the JP font first (mirrors the e branch in SVGGraph#draw_element). No-op for the :cjk style, which has no variant.
31 32 33 34 35 |
# File 'lib/rsyntaxtree/utils.rb', line 31 def list(style, cjk_priority: false) families = FONT_FAMILIES.fetch(style.to_sym).dup families[0], families[1] = families[1], families[0] if cjk_priority && style.to_sym != :cjk families end |