summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2022-09-17 15:01:45 -0600
committerDan Allen <dan.j.allen@gmail.com>2022-09-17 15:02:24 -0600
commit9f887bafa90194986af70e8ad481d940fbf8d6c3 (patch)
tree2a2259d8f96b1ea278ac16a8d0647461295ad9c2
parentb5fce94f8837e6f47e50888b3fbf8c17b6ccc0df (diff)
provide fallback value for base-font-size theme key before processing keys
-rw-r--r--CHANGELOG.adoc4
-rw-r--r--lib/asciidoctor/pdf/converter.rb2
-rw-r--r--lib/asciidoctor/pdf/theme_loader.rb3
3 files changed, 5 insertions, 4 deletions
diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc
index 6b89a60b..8d131d76 100644
--- a/CHANGELOG.adoc
+++ b/CHANGELOG.adoc
@@ -7,7 +7,9 @@ For a detailed view of what has changed, refer to the {url-repo}/commits/main[co
== Unreleased
-_No changes since previous release._
+Improvements::
+
+* provide fallback value for `base-font-size` theme key before processing keys (#2342)
== 2.3.1 (2022-09-17) - @mojavelinux
diff --git a/lib/asciidoctor/pdf/converter.rb b/lib/asciidoctor/pdf/converter.rb
index c3947d72..57a4176c 100644
--- a/lib/asciidoctor/pdf/converter.rb
+++ b/lib/asciidoctor/pdf/converter.rb
@@ -557,7 +557,7 @@ module Asciidoctor
def prepare_theme theme
theme.base_border_color = nil if theme.base_border_color == 'transparent'
theme.base_font_color ||= '000000'
- theme.base_font_size ||= 12
+ theme.base_font_family ||= 'Helvetica'
theme.base_font_style = theme.base_font_style&.to_sym || :normal
theme.page_numbering_start_at ||= 'body'
theme.running_content_start_at ||= 'body'
diff --git a/lib/asciidoctor/pdf/theme_loader.rb b/lib/asciidoctor/pdf/theme_loader.rb
index 465a65f1..f4a600a7 100644
--- a/lib/asciidoctor/pdf/theme_loader.rb
+++ b/lib/asciidoctor/pdf/theme_loader.rb
@@ -78,12 +78,11 @@ module Asciidoctor
if theme_path == BaseThemePath
load_base_theme
else
- theme_data = load_file theme_path, nil, theme_dir
+ theme_data = load_file theme_path, (::OpenStruct.new base_font_size: 12), theme_dir
unless (::File.dirname theme_path) == ThemesDir
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)