Class: SvgConform::Remediations::FontRemediation

Inherits:
BaseRemediation
  • Object
show all
Defined in:
lib/svg_conform/remediations/font_remediation.rb

Overview

Remediation action for font-related issues that matches svgcheck behavior

Instance Method Summary collapse

Methods inherited from BaseRemediation

#execute, #should_execute?, #to_s

Instance Method Details

#apply(document, _context) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/svg_conform/remediations/font_remediation.rb', line 13

def apply(document, _context)
  changes = []
  # Find all elements with font-family attributes
  document.traverse do |node|
    next unless node.respond_to?(:name) && node.name

    changes.concat(fix_font_family_attribute(node, default_family,
                                             mapping))
    changes.concat(fix_style_font_family(node, default_family, mapping))
  end

  changes
end