Sha256: 7f3f018810176057040d2447560d1276dc5fa11a7303560460b1325a239571a9
Contents?: true
Size: 1.28 KB
Versions: 2
Compression:
Stored size: 1.28 KB
Contents
module Prawn::SVG::Attributes::Font def parse_font_attributes_and_call if size = attributes['font-size'] state.font_size = size.to_f end if weight = attributes['font-weight'] font_updated = true state.font_weight = Prawn::SVG::Font.weight_for_css_font_weight(weight) end if style = attributes['font-style'] font_updated = true state.font_style = style == 'italic' ? :italic : nil end if (family = attributes['font-family']) && family.strip != "" font_updated = true state.font_family = family end if (anchor = attributes['text-anchor']) state.text_anchor = anchor end if state.font_family && font_updated usable_font_families = [state.font_family, document.fallback_font_name] font_used = usable_font_families.compact.detect do |name| if font = document.font_registry.load(name, state.font_weight, state.font_style) state.font_subfamily = font.subfamily add_call_and_enter 'font', font.name, :style => state.font_subfamily true end end if font_used.nil? warnings << "Font family '#{state.font_family}' style '#{state.font_style || 'normal'}' is not a known font, and the fallback font could not be found." end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
prawn-svg-0.23.1 | lib/prawn/svg/attributes/font.rb |
prawn-svg-0.23.0 | lib/prawn/svg/attributes/font.rb |