From e7db4e8ee2c8c19d3cf073dc37330e07a916e93c Mon Sep 17 00:00:00 2001 From: Dan Allen Date: Sat, 9 Jul 2022 12:55:12 -0600 Subject: pass root font size to AsciiDoc table cell implementation to avoid making it public --- lib/asciidoctor/pdf/converter.rb | 4 +--- lib/asciidoctor/pdf/ext/prawn-table/cell/asciidoc.rb | 3 ++- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/asciidoctor/pdf/converter.rb b/lib/asciidoctor/pdf/converter.rb index 2c1f9952..774b08ac 100644 --- a/lib/asciidoctor/pdf/converter.rb +++ b/lib/asciidoctor/pdf/converter.rb @@ -27,8 +27,6 @@ module Asciidoctor attr_accessor :font_scale - attr_reader :root_font_size - attr_reader :index attr_reader :theme @@ -2109,7 +2107,7 @@ module Asciidoctor end # NOTE: line metrics get applied when AsciiDoc content is converted cell_line_metrics = nil - asciidoc_cell = ::Prawn::Table::Cell::AsciiDoc.new self, (cell_data.merge content: cell.inner_document, padding: body_cell_padding) + asciidoc_cell = ::Prawn::Table::Cell::AsciiDoc.new self, (cell_data.merge content: cell.inner_document, padding: body_cell_padding, root_font_size: @root_font_size) cell_data = { content: asciidoc_cell, source_location: cell.source_location } end if cell_line_metrics diff --git a/lib/asciidoctor/pdf/ext/prawn-table/cell/asciidoc.rb b/lib/asciidoctor/pdf/ext/prawn-table/cell/asciidoc.rb index 07406237..106bc29e 100644 --- a/lib/asciidoctor/pdf/ext/prawn-table/cell/asciidoc.rb +++ b/lib/asciidoctor/pdf/ext/prawn-table/cell/asciidoc.rb @@ -7,6 +7,7 @@ module Prawn include ::Asciidoctor::Logging attr_accessor :align + attr_accessor :root_font_size attr_accessor :valign def initialize pdf, opts = {} @@ -109,7 +110,7 @@ module Prawn prev_font_color, pdf.font_color = pdf.font_color, font_color if font_color font_family ||= font_info[:family] if font_size - prev_font_scale, pdf.font_scale = pdf.font_scale, (font_size.to_f / @pdf.root_font_size) + prev_font_scale, pdf.font_scale = pdf.font_scale, (font_size.to_f / @root_font_size) else font_size = font_info[:size] end -- cgit v1.2.3