Class: SvgConform::Requirements::NoExternalFontsRequirement
- Inherits:
-
BaseRequirement
- Object
- Lutaml::Model::Serializable
- BaseRequirement
- SvgConform::Requirements::NoExternalFontsRequirement
show all
- Defined in:
- lib/svg_conform/requirements/no_external_fonts_requirement.rb
Overview
Validates that no external font references are present All fonts must be embedded in the SVG
Instance Method Summary
collapse
#collect_sax_data, #element?, #get_attribute, #get_attributes, #has_attribute?, #needs_deferred_validation?, #remove_attribute, #set_attribute, #text?, #to_s, #validate_document, #validate_sax_complete
Instance Method Details
#check(node, context) ⇒ Object
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/svg_conform/requirements/no_external_fonts_requirement.rb', line 22
def check(node, context)
return unless element?(node)
case node.name
when "style"
check_style_element(node, context) if check_style_fonts
when "font-face"
check_font_face_element(node, context) if check_font_face
else
check_style_attribute(node, context) if check_style_fonts
end
end
|
#should_check_node?(node, context = nil) ⇒ Boolean
35
36
37
38
39
40
41
42
|
# File 'lib/svg_conform/requirements/no_external_fonts_requirement.rb', line 35
def should_check_node?(node, context = nil)
return false unless element?(node)
return false if context&.node_structurally_invalid?(node)
node.name == "style" ||
node.name == "font-face" ||
has_style_attribute?(node)
end
|
#validate_sax_element(element, context) ⇒ Object
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/svg_conform/requirements/no_external_fonts_requirement.rb', line 44
def validate_sax_element(element, context)
case element.name
when "style"
check_style_element_sax(element, context) if check_style_fonts
when "font-face"
check_font_face_element_sax(element, context) if check_font_face
else
check_style_attribute_sax(element, context) if check_style_fonts
end
end
|