summaryrefslogtreecommitdiff
path: root/spec/dest_spec.rb
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2020-05-01 23:59:00 -0600
committerGitHub <noreply@github.com>2020-05-01 23:59:00 -0600
commit728d3678807bcd42f7a4b543267f05d5c7bcada7 (patch)
tree1dc0db1aee292f54b5c7fe805ea69e78938c9d50 /spec/dest_spec.rb
parent6168f9e3dc4caca82854f9446a1ca8930b3a5b6a (diff)
resolves #1672 prevent generator from allocating space for placeholder null char even if font is missing glyph (PR #1673)
Diffstat (limited to 'spec/dest_spec.rb')
-rw-r--r--spec/dest_spec.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/dest_spec.rb b/spec/dest_spec.rb
index 53b6e424..8e28d174 100644
--- a/spec/dest_spec.rb
+++ b/spec/dest_spec.rb
@@ -270,4 +270,26 @@ describe 'Asciidoctor::PDF::Converter - Dest' do
(expect anchor_dest_pagenum).to be 2
(expect (pdf.page 2).text).to eql 'supercalifragilisticexpialidocious'
end
+
+ it 'should not allocate space for anchor if font is missing glyph for null character' do
+ pdf_theme = {
+ extends: 'default',
+ font_catalog: {
+ 'Missing Null' => {
+ 'normal' => 'mplus1mn-regular-ascii-conums.ttf',
+ }
+ },
+ base_font_family: 'Missing Null',
+ }
+
+ pdf = to_pdf <<~'EOS', pdf_theme: pdf_theme, analyze: true
+ foo [#bar]#bar# #baz#
+
+ foo bar #baz#
+ EOS
+
+ baz_texts = pdf.find_text 'baz'
+ (expect baz_texts).to have_size 2
+ (expect baz_texts[0][:x]).to eql baz_texts[1][:x]
+ end
end