diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2022-09-17 13:45:10 -0600 |
|---|---|---|
| committer | Dan Allen <dan.j.allen@gmail.com> | 2022-09-17 13:48:33 -0600 |
| commit | e94fd69fceee9469c6e75cb905bb73f58b3def77 (patch) | |
| tree | 10ecd04d798d6d2a4c95db5d77ad3cce96427aed | |
| parent | f10aa815444f747e58bd0dbe3ffd22a2ef8f2a0d (diff) | |
backport fix for #2343 provide a fallback value for base-font-size
| -rw-r--r-- | CHANGELOG.adoc | 4 | ||||
| -rw-r--r-- | lib/asciidoctor/pdf/theme_loader.rb | 1 | ||||
| -rw-r--r-- | spec/theme_loader_spec.rb | 5 |
3 files changed, 8 insertions, 2 deletions
diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index b7f7bb0f..95faa240 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -7,6 +7,10 @@ For a detailed view of what has changed, refer to the {url-repo}/commits/main[co == Unreleased +Improvements:: + +* provide a fallback value for `base-font-size` when loading theme (#2343) + Bug Fixes:: * fix crash when smallcaps text transform is applied to a phrase (#2339) diff --git a/lib/asciidoctor/pdf/theme_loader.rb b/lib/asciidoctor/pdf/theme_loader.rb index 0d581ec5..465a65f1 100644 --- a/lib/asciidoctor/pdf/theme_loader.rb +++ b/lib/asciidoctor/pdf/theme_loader.rb @@ -83,6 +83,7 @@ module Asciidoctor theme_data.base_text_align ||= 'left' theme_data.base_line_height ||= 1 theme_data.base_font_color ||= '000000' + theme_data.base_font_size ||= 12 theme_data.code_font_family ||= (theme_data.codespan_font_family || 'Courier') theme_data.conum_font_family ||= (theme_data.codespan_font_family || 'Courier') if (heading_font_family = theme_data.heading_font_family) diff --git a/spec/theme_loader_spec.rb b/spec/theme_loader_spec.rb index a4588fd9..2916bd93 100644 --- a/spec/theme_loader_spec.rb +++ b/spec/theme_loader_spec.rb @@ -781,7 +781,7 @@ describe Asciidoctor::PDF::ThemeLoader do theme = subject.load_theme (File.basename theme_path), (File.dirname theme_path) (expect theme.base_font_family).to eql 'Times-Roman' (expect theme.heading_font_family).to eql 'Times-Roman' - (expect theme.base_font_size).to be_nil + (expect theme.base_font_size).to be 12 end end end @@ -889,9 +889,10 @@ describe Asciidoctor::PDF::ThemeLoader do (expect theme.base_text_align).to eql 'left' (expect theme.base_line_height).to be 1 (expect theme.base_font_color).to eql '000000' + (expect theme.base_font_size).to be 12 (expect theme.code_font_family).to eql 'Courier' (expect theme.conum_font_family).to eql 'Courier' - (expect theme.to_h.keys).to have_size 6 + (expect theme.to_h.keys).to have_size 7 end it 'should link code and conum font family to codespan font family by default' do |
