Skip to content

Commit

Permalink
backport fix for #2343 provide a fallback value for base-font-size
Browse files Browse the repository at this point in the history
  • Loading branch information
mojavelinux committed Sep 17, 2022
1 parent f10aa81 commit e94fd69
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions lib/asciidoctor/pdf/theme_loader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def self.load_theme theme_name = nil, theme_dir = nil
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)
Expand Down
5 changes: 3 additions & 2 deletions spec/theme_loader_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@
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
Expand Down Expand Up @@ -889,9 +889,10 @@
(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
Expand Down

0 comments on commit e94fd69

Please sign in to comment.