summaryrefslogtreecommitdiff
path: root/spec/index_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/index_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/index_spec.rb')
-rw-r--r--spec/index_spec.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/index_spec.rb b/spec/index_spec.rb
index 983f820c..cff0eca3 100644
--- a/spec/index_spec.rb
+++ b/spec/index_spec.rb
@@ -455,4 +455,30 @@ describe 'Asciidoctor::PDF::Converter - Index' do
(expect category_w_text[:x]).to be > category_l_text[:x]
(expect category_l_text[:x]).to be > category_a_text[:x]
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',
+ 'bold' => 'mplus1mn-regular-ascii-conums.ttf',
+ }
+ },
+ base_font_family: 'Missing Null',
+ }
+
+ pdf = to_pdf <<~'EOS', pdf_theme: pdf_theme, analyze: true
+ foo ((bar)) #baz#
+
+ foo bar #baz#
+
+ [index]
+ == Index
+ 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