class HexaPDF::Type::FontType1
known as the “Standard 14 Fonts” and are all Type1 fonts. HexaPDF supports these fonts.
PDF provides 14 built-in fonts that all PDF readers must understand. These 14 fonts are
Represents a Type1 font.
def bounding_box
def bounding_box bbox = super if bbox bbox elsif StandardFonts.standard_font?(self[:BaseFont]) StandardFonts.font(self[:BaseFont]).bounding_box else nil end end
def encoding_from_font
Reads the encoding from an embedded font file and handles the special case of the Standard
def encoding_from_font if StandardFonts.standard_font?(self[:BaseFont]) StandardFonts.font(self[:BaseFont]).encoding elsif (obj = self[:FontDescriptor][:FontFile]) HexaPDF::Font::Type1::PFBParser.encoding(obj.stream) else raise HexaPDF::Error, "Can't read encoding because Type1 font is not embedded" end end
def font_wrapper
the standard fonts.
Overrides the default to provide a font wrapper in case none is set and the font is one of
def font_wrapper if (tmp = super) tmp elsif StandardFonts.standard_font?(self[:BaseFont]) self.font_wrapper = HexaPDF::Font::Type1Wrapper.new(document, StandardFonts.font(self[:BaseFont]), pdf_object: self) end end
def perform_validation
def perform_validation std_font = StandardFonts.standard_font?(self[:BaseFont]) super(ignore_missing_font_fields: std_font) if !std_font && self[:FontDescriptor].nil? yield("Required field FontDescriptor is not set", false) end end
def symbolic?
Returns +true+ if the font is a symbolic font, +false+ if it is not, and +nil+ if it is
def symbolic? symbolic = super if !symbolic.nil? symbolic elsif StandardFonts.standard_font?(self[:BaseFont]) name = StandardFonts.standard_name(self[:BaseFont]) name == :ZapfDingbats || name == :Symbol else nil end end
def width(code)
Returns the unscaled width of the given code point in glyph units, or 0 if the width for the
def width(code) if StandardFonts.standard_font?(self[:BaseFont]) StandardFonts.font(self[:BaseFont]).width(encoding.name(code)) || 0 else super end end