/usr/lib/ruby/vendor_ruby/pdf/reader/width_calculator/type_zero.rb is in ruby-pdf-reader 1.3.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # coding: utf-8
class PDF::Reader
module WidthCalculator
# Type0 (or Composite) fonts are a "root font" that rely on a "descendant font"
# to do the heavy lifting. The "descendant font" is a CID-Keyed font.
# see Section 9.7.1, PDF 32000-1:2008, pp 267
# so if we are calculating a Type0 font width, we just pass off to
# the descendant font
class TypeZero
def initialize(font)
@font = font
@descendant_font = @font.descendantfonts.first
end
def glyph_width(code_point)
return 0 if code_point.nil? || code_point < 0
@descendant_font.glyph_width(code_point).to_f
end
end
end
end
|