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
122 123 124 125 |
# File 'lib/metanorma/util/fontist_helper.rb', line 122 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
106 107 108 109 110 111 |
# File 'lib/metanorma/util/fontist_helper.rb', line 106 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
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/metanorma/util/fontist_helper.rb', line 90 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
127 128 129 |
# File 'lib/metanorma/util/fontist_helper.rb', line 127 def self.install_fonts?() [:install_fonts].nil? || [:install_fonts] end |
.location_manifest(processor, source_attributes) ⇒ Object
113 114 115 116 117 118 119 120 |
# File 'lib/metanorma/util/fontist_helper.rb', line 113 def self.location_manifest(processor, source_attributes) instance = Fontist::Manifest.from_hash( append_source_fonts(processor.fonts_manifest.dup, source_attributes), locations: true ) instance.to_hash unless instance.nil? end |