Skip to content

Commit e94fd69

Browse files
committed
backport fix for #2343 provide a fallback value for base-font-size
1 parent f10aa81 commit e94fd69

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

CHANGELOG.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ For a detailed view of what has changed, refer to the {url-repo}/commits/main[co
77

88
== Unreleased
99

10+
Improvements::
11+
12+
* provide a fallback value for `base-font-size` when loading theme (#2343)
13+
1014
Bug Fixes::
1115

1216
* fix crash when smallcaps text transform is applied to a phrase (#2339)

lib/asciidoctor/pdf/theme_loader.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ def self.load_theme theme_name = nil, theme_dir = nil
8383
theme_data.base_text_align ||= 'left'
8484
theme_data.base_line_height ||= 1
8585
theme_data.base_font_color ||= '000000'
86+
theme_data.base_font_size ||= 12
8687
theme_data.code_font_family ||= (theme_data.codespan_font_family || 'Courier')
8788
theme_data.conum_font_family ||= (theme_data.codespan_font_family || 'Courier')
8889
if (heading_font_family = theme_data.heading_font_family)

spec/theme_loader_spec.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@
781781
theme = subject.load_theme (File.basename theme_path), (File.dirname theme_path)
782782
(expect theme.base_font_family).to eql 'Times-Roman'
783783
(expect theme.heading_font_family).to eql 'Times-Roman'
784-
(expect theme.base_font_size).to be_nil
784+
(expect theme.base_font_size).to be 12
785785
end
786786
end
787787
end
@@ -889,9 +889,10 @@
889889
(expect theme.base_text_align).to eql 'left'
890890
(expect theme.base_line_height).to be 1
891891
(expect theme.base_font_color).to eql '000000'
892+
(expect theme.base_font_size).to be 12
892893
(expect theme.code_font_family).to eql 'Courier'
893894
(expect theme.conum_font_family).to eql 'Courier'
894-
(expect theme.to_h.keys).to have_size 6
895+
(expect theme.to_h.keys).to have_size 7
895896
end
896897

897898
it 'should link code and conum font family to codespan font family by default' do

0 commit comments

Comments
 (0)