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
136 137 138 139 |
# File 'lib/metanorma/util/fontist_helper.rb', line 136 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
111 112 113 114 115 116 |
# File 'lib/metanorma/util/fontist_helper.rb', line 111 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 105 106 107 108 109 |
# 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 = if processor.respond_to?(:fonts_manifest) && !processor.fonts_manifest.nil? processor.fonts_manifest.dup else {} end 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
141 142 143 |
# File 'lib/metanorma/util/fontist_helper.rb', line 141 def self.install_fonts?() [:install_fonts].nil? || [:install_fonts] end |
.location_manifest(processor, source_attributes) ⇒ Object
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/metanorma/util/fontist_helper.rb', line 118 def self.location_manifest(processor, source_attributes) base = if processor.respond_to?(:fonts_manifest) && !processor.fonts_manifest.nil? processor.fonts_manifest.dup else {} end return nil if base.empty? && !source_attributes[:fonts] instance = Fontist::Manifest.from_hash( append_source_fonts(base, source_attributes), locations: true, ) instance.to_hash unless instance.nil? end |