Class: Metanorma::Util::FontistHelper
- Inherits:
-
Object
- Object
- Metanorma::Util::FontistHelper
- Defined in:
- lib/metanorma/util/fontist_helper.rb
Class Method Summary collapse
- .append_source_fonts(manifest, source_attributes) ⇒ Object
- .has_custom_fonts?(processor, options, source_attributes) ⇒ Boolean
- .install_fonts(processor, options) ⇒ Object
- .install_fonts?(options) ⇒ Boolean
- .location_manifest(processor, source_attributes) ⇒ Object
Class Method Details
.append_source_fonts(manifest, source_attributes) ⇒ Object
120 121 122 123 |
# File 'lib/metanorma/util/fontist_helper.rb', line 120 def self.append_source_fonts(manifest, source_attributes) source_attributes[:fonts]&.split(";")&.each { |f| manifest[f] = nil } manifest end |
.has_custom_fonts?(processor, options, source_attributes) ⇒ Boolean
107 108 109 110 111 112 |
# File 'lib/metanorma/util/fontist_helper.rb', line 107 def self.has_custom_fonts?(processor, , source_attributes) install_fonts?() \ && processor.respond_to?(:fonts_manifest) \ && !processor.fonts_manifest.nil? \ || source_attributes[:fonts] end |
.install_fonts(processor, options) ⇒ Object
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/metanorma/util/fontist_helper.rb', line 91 def self.install_fonts(processor, ) return unless validate_install_fonts(processor, ) @@updated_formulas_repo = false manifest = processor.fonts_manifest.dup append_source_fonts(manifest, ) agree_to_terms, can_without_fonts, no_progress = () install_fonts_safe( manifest, agree_to_terms, can_without_fonts, no_progress, ) end |
.install_fonts?(options) ⇒ Boolean
125 126 127 |
# File 'lib/metanorma/util/fontist_helper.rb', line 125 def self.install_fonts?() [:install_fonts].nil? || [:install_fonts] end |
.location_manifest(processor, source_attributes) ⇒ Object
114 115 116 117 118 |
# File 'lib/metanorma/util/fontist_helper.rb', line 114 def self.location_manifest(processor, source_attributes) Fontist::Manifest::Locations.from_hash( append_source_fonts(processor.fonts_manifest.dup, source_attributes), ) end |