summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2022-05-27 23:47:09 -0600
committerDan Allen <dan.j.allen@gmail.com>2022-05-28 00:07:28 -0600
commit610833132feac326c177784dac8f62604e411179 (patch)
treea294eab674704095c91cb3d7d288f2c87326bf15
parenta340ee35cf82c743bbb97fff51c91fcb61682a46 (diff)
verify Prawn reports font name and style when font style cannot be found
-rw-r--r--spec/font_spec.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/font_spec.rb b/spec/font_spec.rb
index 414b8af1..e5d11099 100644
--- a/spec/font_spec.rb
+++ b/spec/font_spec.rb
@@ -244,6 +244,34 @@ describe 'Asciidoctor::PDF::Converter - Font' do
}
expect { to_pdf 'content', pdf_theme: pdf_theme, 'pdf-fontsdir' => 'there' }.to raise_exception Errno::ENOENT, /#{Regexp.escape font_path} not found$/
end
+
+ it 'should throw error that reports font name and style when font is not registered' do
+ (expect do
+ to_pdf <<~'EOS', pdf_theme: { base_font_family: 'Lato' }
+ == Section Title
+
+ paragraph
+ EOS
+ end).to raise_exception Prawn::Errors::UnknownFont, 'Lato (normal) is not a known font.'
+ end
+
+ it 'should throw error that reports font name and style when style is not found for registered font' do
+ pdf_theme = {
+ font_catalog: {
+ 'Quicksand' => {
+ 'normal' => (fixture_file 'Quicksand-Regular.otf'),
+ },
+ },
+ base_font_family: 'Quicksand',
+ }
+ (expect do
+ to_pdf <<~'EOS', pdf_theme: pdf_theme
+ == Section Title
+
+ paragraph
+ EOS
+ end).to raise_exception Prawn::Errors::UnknownFont, 'Quicksand (bold) is not a known font.'
+ end
end
context 'Kerning' do