Module: Pdfrb::FontLoader::Type1

Defined in:
lib/pdfrb/font_loader/type1.rb

Overview

Type1 font loader. For the 14 standard fonts, no embedding is needed. For custom Type1 fonts, parses the AFM and embeds the PFB via /FontFile.

Class Method Summary collapse

Class Method Details

.call(document, name_or_io, **_opts) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/pdfrb/font_loader/type1.rb', line 11

def call(document, name_or_io, **_opts)
  case name_or_io
  when ::String
    if Pdfrb::Document::Fonts::STANDARDS.include?(name_or_io)
      return document.add(
        { Type: :Font, Subtype: :Type1, BaseFont: name_or_io.to_sym },
        type: Pdfrb::Model::Type::FontType1
      )
    end
    nil
  end
end