diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2021-03-21 03:27:16 -0600 |
|---|---|---|
| committer | Dan Allen <dan.j.allen@gmail.com> | 2021-03-21 03:27:16 -0600 |
| commit | 548b5f4f312cec4798a63c4e27ae01a4cd96dfaa (patch) | |
| tree | e38ec4ab7020efd98e2296a826e650eade2359af /lib | |
| parent | 2cd22bd19c94cd7a9e0df394be34d3a8bc98385d (diff) | |
replace redundant fragment_font method with save_font
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/asciidoctor/pdf/ext/prawn/extensions.rb | 32 | ||||
| -rw-r--r-- | lib/asciidoctor/pdf/formatted_text/inline_image_arranger.rb | 2 |
2 files changed, 1 insertions, 33 deletions
diff --git a/lib/asciidoctor/pdf/ext/prawn/extensions.rb b/lib/asciidoctor/pdf/ext/prawn/extensions.rb index 7f3fe9a1..3c470c46 100644 --- a/lib/asciidoctor/pdf/ext/prawn/extensions.rb +++ b/lib/asciidoctor/pdf/ext/prawn/extensions.rb @@ -290,38 +290,6 @@ module Asciidoctor FontStyleToSet[style].dup end - # Apply the font settings (family, size, styles and character spacing) from - # the fragment to the document, then yield to the block. - # - # Used to arrange an inline image - def fragment_font fragment - f_info = font_info - f_family = fragment[:font] || f_info[:family] - f_size = fragment[:size] || f_info[:size] - if (f_styles = fragment[:styles]) - f_style = resolve_font_style f_styles - else - f_style = :normal - end - - # character_spacing logic not currently used - #if (c_spacing = fragment[:character_spacing]) - # character_spacing c_spacing do - # font f_family, size: f_size, style: f_style do - # yield - # end - # end - #else - # font f_family, size: f_size, style: f_style do - # yield - # end - #end - - font f_family, size: f_size, style: f_style do - yield - end - end - # Override width of string to check for placeholder char, which uses character spacing to control width # def width_of_string string, options = {} diff --git a/lib/asciidoctor/pdf/formatted_text/inline_image_arranger.rb b/lib/asciidoctor/pdf/formatted_text/inline_image_arranger.rb index 477df6f1..f92dae4d 100644 --- a/lib/asciidoctor/pdf/formatted_text/inline_image_arranger.rb +++ b/lib/asciidoctor/pdf/formatted_text/inline_image_arranger.rb @@ -90,7 +90,7 @@ module Asciidoctor::PDF::FormattedText fragment[:image_info] = image_info end - doc.fragment_font fragment do + doc.save_font do # NOTE: if image height exceeds line height by more than 1.5x, increase the line height # FIXME: we could really use a nicer API from Prawn here; this is an ugly hack if (f_height = image_h) > (line_font = doc.font).height * 1.5 |
