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
38 39 40 |
# File 'lib/rsyntaxtree/utils.rb', line 38 def for_pango(style, cjk_priority: false) list(style, cjk_priority: cjk_priority).join(", ") end |
.for_svg(style, cjk_priority: false) ⇒ Object
34 35 36 |
# File 'lib/rsyntaxtree/utils.rb', line 34 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.
28 29 30 31 32 |
# File 'lib/rsyntaxtree/utils.rb', line 28 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 |