Sha256: c47af1fb8745f51a3db4d793a6f3c8aa8313162dcd2b1e1244f04127a3531e1c
Contents?: true
Size: 734 Bytes
Versions: 2
Compression:
Stored size: 734 Bytes
Contents
# frozen_string_literal: true module Thinreports module Generator module PrawnExt module WidthOf # This patch fixes the character_spacing effect on text width calculation. # # The original #width_of: # # width_of('abcd') #=> 4 + 4 = 8 # # The #width_of in this patch: # # width_of('abcd') #=> 4 + 3 = 7 # def width_of(*) width = super - character_spacing width > 0 ? width : 0 end end end end end # Prawn v2.3 and later includes this patch by https://github.com/prawnpdf/prawn/pull/1117. if Prawn::VERSION < '2.3.0' Prawn::Document.prepend Thinreports::Generator::PrawnExt::WidthOf end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
thinreports-0.12.1 | lib/thinreports/generator/pdf/prawn_ext/width_of.rb |
thinreports-0.12.0 | lib/thinreports/generator/pdf/prawn_ext/width_of.rb |