From b356aae403859f643080cff8749e03251d18bef8 Mon Sep 17 00:00:00 2001 From: Dan Allen Date: Thu, 5 Oct 2023 00:59:58 -0600 Subject: [PATCH] resolves #2453 add fallback character for placeholder character when using AFM font (PR #2454) --- CHANGELOG.adoc | 1 + lib/asciidoctor/pdf/ext/prawn/font/afm.rb | 1 + spec/image_spec.rb | 15 +++++++++++++++ 3 files changed, 17 insertions(+) diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 2cb0d2c3b..e6cd060c8 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -52,6 +52,7 @@ Bug Fixes:: * prevent special character substitution from interfering with callouts in plain verbatim block (#2390) * remove deprecated, undocumented `svg-font-family` theme key (the correct key is `svg-fallback-font-family`) * decouple tests from path of PWD (#2444) +* add fallback character for placeholder character when using AFM font (#2453) == 2.3.9 (2023-06-28) - @mojavelinux diff --git a/lib/asciidoctor/pdf/ext/prawn/font/afm.rb b/lib/asciidoctor/pdf/ext/prawn/font/afm.rb index 13645d301..2daee510f 100644 --- a/lib/asciidoctor/pdf/ext/prawn/font/afm.rb +++ b/lib/asciidoctor/pdf/ext/prawn/font/afm.rb @@ -7,6 +7,7 @@ class Prawn::Font::AFM ?\u200b => '', ?\u202f => ?\u00a0, ?\u2009 => ' ', + ?\u2063 => ?\u00ad, ?\u25e6 => '-', ?\u25aa => ?\u00b7, } diff --git a/spec/image_spec.rb b/spec/image_spec.rb index cf837ccd0..d8938ce09 100644 --- a/spec/image_spec.rb +++ b/spec/image_spec.rb @@ -2245,6 +2245,21 @@ def traverse node (expect to_file).to visually_match 'image-inline-scale-down-height.pdf' end + it 'should not warn about missing glyph for image placeholder char when using AFM font' do + (expect do + pdf = to_pdf <<~'END', attribute_overrides: { 'pdf-theme' => 'base' }, analyze: :image + :pdf-page-size: A6 + :pdf-page-layout: landscape + + before + + image:square.png[pdfwidth=7cm] + END + (expect (images = pdf.images)).to have_size 1 + (expect images[0][:page_number]).to be 2 + end).to not_log_message using_log_level: :INFO + end + it 'should scale image down to fit available height inside delimited block', visual: true do to_file = to_pdf_file <<~'END', 'image-inline-in-block-scale-down-height.pdf' :pdf-page-size: A6