Object
Represents a single font PDF object and provides some useful methods for extracting info. Mainly used for converting text to UTF-8.
# File lib/pdf/reader/font.rb, line 38 def initialize(ohash = nil, obj = nil) if ohash.nil? || obj.nil? $stderr.puts "DEPREACTION WARNING - PDF::Reader::Font.new should be called with 2 args" return end @ohash = ohash @tounicode = nil extract_base_info(obj) extract_descriptor(obj) extract_descendants(obj) @width_calc = build_width_calculator @encoding ||= PDF::Reader::Encoding.new(:StandardEncoding) end
# File lib/pdf/reader/font.rb, line 54 def basefont=(font) @encoding ||= default_encoding(font) @basefont = font end
looks up the specified codepoint and returns a value that is in (pdf) glyph space, which is 1000 glyph units = 1 text space unit
# File lib/pdf/reader/font.rb, line 73 def glyph_width(code_point) if code_point.is_a?(String) code_point = code_point.unpack(encoding.unpack).first end @cached_widths ||= {} @cached_widths[code_point] ||= @width_calc.glyph_width(code_point) end
Generated with the Darkfish Rdoc Generator 2.