Class: Fontisan::Type1::INFGenerator
- Inherits:
-
Object
- Object
- Fontisan::Type1::INFGenerator
- Defined in:
- lib/fontisan/type1/inf_generator.rb
Overview
INF (Font Information) Generator
[‘INFGenerator`](lib/fontisan/type1/inf_generator.rb) generates INF files for Windows Type 1 font installation.
INF files contain metadata for installing Type 1 fonts on Windows systems. They reference the PFB, PFM, and AFM files that make up a Windows Type 1 font.
Class Method Summary collapse
-
.generate(font, options = {}) ⇒ String
Generate INF file content from a font.
-
.generate_to_file(font, path, options = {}) ⇒ void
Generate INF file from a font and write to file.
Instance Method Summary collapse
-
#generate ⇒ String
Generate INF file content.
-
#initialize(font, options = {}) ⇒ INFGenerator
constructor
Initialize a new INFGenerator.
Constructor Details
#initialize(font, options = {}) ⇒ INFGenerator
Initialize a new INFGenerator
56 57 58 59 60 |
# File 'lib/fontisan/type1/inf_generator.rb', line 56 def initialize(font, = {}) @font = font @options = @metrics = MetricsCalculator.new(font) end |
Class Method Details
.generate(font, options = {}) ⇒ String
Generate INF file content from a font
37 38 39 |
# File 'lib/fontisan/type1/inf_generator.rb', line 37 def self.generate(font, = {}) new(font, ).generate end |
.generate_to_file(font, path, options = {}) ⇒ void
This method returns an undefined value.
Generate INF file from a font and write to file
47 48 49 50 |
# File 'lib/fontisan/type1/inf_generator.rb', line 47 def self.generate_to_file(font, path, = {}) inf_content = generate(font, ) File.write(path, inf_content, encoding: "ISO-8859-1") end |
Instance Method Details
#generate ⇒ String
Generate INF file content
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/fontisan/type1/inf_generator.rb', line 65 def generate lines = [] # Font description section lines << "[Font Description]" lines << build_font_description lines << "" # Files section lines << "[Files]" lines << build_file_list lines << "" # Other section lines << "[Other]" lines << build_other_section lines.join("\n") end |