diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2021-01-18 23:55:18 -0700 |
|---|---|---|
| committer | Dan Allen <dan.j.allen@gmail.com> | 2021-01-19 01:09:41 -0700 |
| commit | 08b7a45488cab7f52d40124a90d8ed4834f4d23b (patch) | |
| tree | 882efb1cc69f915f7e5ded4f7634c3efd2c303b8 | |
| parent | 630694ac559499329254cf93a37d5847b8e1bc57 (diff) | |
verify theme can disable font kerning for headings
| -rw-r--r-- | spec/section_spec.rb | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/section_spec.rb b/spec/section_spec.rb index dcb295a1..7136d388 100644 --- a/spec/section_spec.rb +++ b/spec/section_spec.rb @@ -86,6 +86,24 @@ describe 'Asciidoctor::PDF::Converter - Section' do (expect h3_text[:font_name]).to eql 'Times-Bold' end + it 'should allow theme to set font kerning for headings' do + input = <<~'EOS' + == Wave__|__ + + content + EOS + + pdf_theme = { heading_text_transform: 'uppercase' } + pdf = to_pdf input, pdf_theme: pdf_theme, analyze: true + with_kerning_position = (pdf.find_unique_text '|')[:x] + + pdf_theme[:heading_font_kerning] = 'none' + pdf = to_pdf input, pdf_theme: pdf_theme, analyze: true + without_kerning_position = (pdf.find_unique_text '|')[:x] + + (expect with_kerning_position).to be < without_kerning_position + end + it 'should add text formatting styles to styles defined in theme' do pdf = to_pdf <<~'EOS', pdf_theme: { heading_font_style: 'bold' }, analyze: true == Get Started _Quickly_ @@ -97,6 +115,24 @@ describe 'Asciidoctor::PDF::Converter - Section' do (expect text[1][:font_name]).to eql 'NotoSerif-BoldItalic' end + it 'should allow theme to set font kerning per heading level' do + input = <<~'EOS' + == Wave__|__ + + === Wave__|__ + EOS + + pdf_theme = { heading_text_transform: 'uppercase' } + pdf = to_pdf input, pdf_theme: pdf_theme, analyze: true + with_kerning_position = (pdf.find_unique_text '|')[:x] + + pdf_theme[:heading_font_kerning] = 'none' + pdf = to_pdf input, pdf_theme: pdf_theme, analyze: true + without_kerning_position = (pdf.find_unique_text '|')[:x] + + (expect with_kerning_position).to be < without_kerning_position + end + it 'should add text formatting styles to styles defined in theme for specific level' do pdf = to_pdf <<~'EOS', pdf_theme: { heading_font_style: nil, heading_h2_font_style: 'bold' }, analyze: true == Get Started _Quickly_ |
