Sha256: 2846cace64073d2fff7c40ef28bada2524615e78c81018b0c43dd884dff7b747
Contents?: true
Size: 756 Bytes
Versions: 4
Compression:
Stored size: 756 Bytes
Contents
# coding: utf-8 # typed: strict # frozen_string_literal: true 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 end def glyph_width(code_point) return 0 if code_point.nil? || code_point < 0 if descendant_font = @font.descendantfonts.first descendant_font.glyph_width(code_point).to_f else 0 end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems