Exception: HexaPDF::MissingGlyphError

Inherits:
Error
  • Object
show all
Defined in:
lib/hexapdf/error.rb

Overview

Raised when a font wrapper implementation should encode a missing glyph.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(glyph) ⇒ MissingGlyphError

Creates a new MissingGlyphError for the given glyph.



92
93
94
# File 'lib/hexapdf/error.rb', line 92

def initialize(glyph)
  @glyph = glyph
end

Instance Attribute Details

#glyphObject (readonly)

Returns the glyph object that contains the information about the missing glyph.



89
90
91
# File 'lib/hexapdf/error.rb', line 89

def glyph
  @glyph
end

Instance Method Details

#messageObject

:nodoc:



96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/hexapdf/error.rb', line 96

def message # :nodoc:
  str = "No glyph for #{glyph.str.inspect} in font '#{glyph.font_wrapper.wrapped_font.full_name}' " \
        "found. \n\n"
  str << if glyph.font_wrapper.font_type == :Type1
           "The used Type1 font only contains a very limited number of glyphs. TrueType " \
           "fonts usually provide a much wider array of glyphs. Use the configuration option " \
           "'font.map' to register appropriate font files. Also have a look at the " \
           "'font.default' and 'font.fallback' options. "
         else
           "Maybe register another #{glyph.font_wrapper.font_type} font that contains the " \
           "needed glyph and use it as fallback via the configuration option 'font.fallback'."
         end
end