Skip to content

Commit

Permalink
Update prawn-icon to version 4.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
pepijnve committed Dec 14, 2024
1 parent df85b99 commit 3240e82
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 23 deletions.
2 changes: 1 addition & 1 deletion asciidoctor-pdf.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Gem::Specification.new do |s|
s.add_runtime_dependency 'prawn-table', '~> 0.2.0'
s.add_runtime_dependency 'prawn-templates', '~> 0.1.0'
s.add_runtime_dependency 'prawn-svg', '~> 0.34.0'
s.add_runtime_dependency 'prawn-icon', '~> 3.0.0'
s.add_runtime_dependency 'prawn-icon', '~> 4.1.0'
s.add_runtime_dependency 'concurrent-ruby', '~> 1.1'
s.add_runtime_dependency 'treetop', '~> 1.6.0'

Expand Down
3 changes: 2 additions & 1 deletion lib/asciidoctor/pdf/converter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,8 @@ def convert_admonition node
valign: label_valign,
align: label_text_align,
color: (icon_data[:stroke_color] || font_color),
size: icon_size
size: icon_size,
size_mode: :icon_height
elsif icons
if (::Asciidoctor::Image.format icon_path) == 'svg'
begin
Expand Down
16 changes: 8 additions & 8 deletions spec/admonition_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@
(expect text).to have_size 2
label_text = text[0]
(expect label_text[:string]).to eql ?\uf0eb
(expect label_text[:font_name]).to eql 'FontAwesome5Free-Regular'
(expect label_text[:font_name]).to eql 'FontAwesome6Free-Regular'
# NOTE: font size is reduced to fit within available space
(expect label_text[:font_size]).to be < 24
content_text = text[1]
Expand All @@ -448,7 +448,7 @@
EOS

label_text = pdf.find_unique_text ?\uf06a
(expect label_text[:font_size]).to eql 50
(expect label_text[:font_size]).to be_within(0.0001).of(47.98464)
end

it 'should allow the theme to specify a minimum width for the font-based icon label' do
Expand Down Expand Up @@ -509,7 +509,7 @@
EOS

icon_text = pdf.text[0]
(expect icon_text[:font_name]).to eql 'FontAwesome5Free-Solid'
(expect icon_text[:font_name]).to eql 'FontAwesome6Free-Solid'
(expect icon_text[:string]).to eql ?\uf4da
end

Expand All @@ -522,7 +522,7 @@
EOS

icon_text = pdf.text[0]
(expect icon_text[:font_name]).to eql 'FontAwesome5Free-Solid'
(expect icon_text[:font_name]).to eql 'FontAwesome6Free-Solid'
(expect icon_text[:string]).to eql ?\uf4da
end).to log_message severity: :INFO, message: 'tip admonition in theme uses icon from deprecated fa icon set; use fas, far, or fab instead', using_log_level: :INFO
end
Expand All @@ -547,7 +547,7 @@
EOS

icon_text = pdf.text[0]
(expect icon_text[:font_name]).to eql 'FontAwesome5Free-Solid'
(expect icon_text[:font_name]).to eql 'FontAwesome6Free-Solid'
(expect icon_text[:string]).to eql ?\uf05a
end

Expand Down Expand Up @@ -576,7 +576,7 @@
(expect text).to have_size 2
label_text = text[0]
(expect label_text[:string]).to eql ?\uf3d1
(expect label_text[:font_name]).to eql 'FontAwesome5Free-Regular'
(expect label_text[:font_name]).to eql 'FontAwesome6Free-Regular'
content_text = text[1]
(expect content_text[:string]).to eql 'Look for the warp zone under the bridge.'
end
Expand Down Expand Up @@ -1050,8 +1050,8 @@

icon_text = pdf.find_unique_text ?\uf059
(expect icon_text).not_to be_nil
(expect icon_text[:font_name]).to eql 'FontAwesome5Free-Solid'
(expect icon_text[:font_size]).to be 24
(expect icon_text[:font_name]).to eql 'FontAwesome6Free-Solid'
(expect icon_text[:font_size]).to be_within(0.0001).of(23.03263)
(expect pdf.find_unique_text 'Are you following along?').not_to be_nil
(expect pdf.find_unique_text 'Just checking ;)').not_to be_nil
end
Expand Down
2 changes: 1 addition & 1 deletion spec/audio_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

icon_text = (pdf.find_text ?\uf04b)[0]
(expect icon_text).not_to be_nil
(expect icon_text[:font_name]).to eql 'FontAwesome5Free-Solid'
(expect icon_text[:font_name]).to eql 'FontAwesome6Free-Solid'
end

it 'should show caption for audio if title is specified' do
Expand Down
18 changes: 9 additions & 9 deletions spec/icon_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
EOS
wink_text = pdf.find_text ?\uf0ad
(expect wink_text).to have_size 1
(expect wink_text[0][:font_name]).to eql 'FontAwesome5Free-Solid'
(expect wink_text[0][:font_name]).to eql 'FontAwesome6Free-Solid'
end

it 'should support icon set as suffix on icon name' do
Expand All @@ -65,7 +65,7 @@
EOS
wink_text = pdf.find_text ?\uf0ad
(expect wink_text).to have_size 1
(expect wink_text[0][:font_name]).to eql 'FontAwesome5Free-Solid'
(expect wink_text[0][:font_name]).to eql 'FontAwesome6Free-Solid'
end

it 'should support icon set as prefix on icon name' do
Expand All @@ -76,7 +76,7 @@
EOS
wink_text = pdf.find_text ?\uf0ad
(expect wink_text).to have_size 1
(expect wink_text[0][:font_name]).to eql 'FontAwesome5Free-Solid'
(expect wink_text[0][:font_name]).to eql 'FontAwesome6Free-Solid'
end

it 'should support icon set as prefix on icon name even if icon set is configured globally' do
Expand All @@ -88,7 +88,7 @@
EOS
wink_text = pdf.find_text ?\uf0ad
(expect wink_text).to have_size 1
(expect wink_text[0][:font_name]).to eql 'FontAwesome5Free-Solid'
(expect wink_text[0][:font_name]).to eql 'FontAwesome6Free-Solid'
end

it 'should not support icon set as prefix on icon name if explicit icon set is specified' do
Expand Down Expand Up @@ -191,7 +191,7 @@
EOS
hdd_text = pdf.find_text ?\uf0a0
(expect hdd_text).to have_size 1
(expect hdd_text[0][:font_name]).to eql 'FontAwesome5Free-Regular'
(expect hdd_text[0][:font_name]).to eql 'FontAwesome6Free-Regular'
end).to log_message severity: :INFO, message: 'hdd-o icon found in deprecated fa icon set; using hdd from far icon set instead', using_log_level: :INFO
end

Expand All @@ -204,7 +204,7 @@
EOS
wink_text = pdf.find_text ?\uf4da
(expect wink_text).to have_size 1
(expect wink_text[0][:font_name]).to eql 'FontAwesome5Free-Regular'
(expect wink_text[0][:font_name]).to eql 'FontAwesome6Free-Regular'
end).to log_message severity: :INFO, message: 'smile-wink icon not found in deprecated fa icon set; using match found in far icon set instead', using_log_level: :INFO
end

Expand All @@ -225,7 +225,7 @@
pdf = to_pdf input, analyze: true
link_text = (pdf.find_text ?\uf019)[0]
(expect link_text).not_to be_nil
(expect link_text[:font_name]).to eql 'FontAwesome5Free-Solid'
(expect link_text[:font_name]).to eql 'FontAwesome6Free-Solid'
(expect link_text[:font_color]).to eql '428BCA'
link_text[:font_size] -= 1.5 # box appox is a little off
(expect link_annotation).to annotate link_text
Expand Down Expand Up @@ -259,7 +259,7 @@

heart_text = pdf.text[0]
(expect heart_text[:string]).to eql ?\uf004
(expect heart_text[:font_name]).to eql 'FontAwesome5Free-Regular'
(expect heart_text[:font_name]).to eql 'FontAwesome6Free-Regular'
(expect heart_text[:font_color]).to eql 'FF0000'
end

Expand All @@ -278,6 +278,6 @@
(expect keyseq_text[0][:font_name]).to eql 'mplus1mn-regular'
(expect keyseq_text[1][:string]).to eql %(\u202f+\u202f)
(expect keyseq_text[2][:string]).to eql ?\uf062
(expect keyseq_text[2][:font_name]).to eql 'FontAwesome5Free-Solid'
(expect keyseq_text[2][:font_name]).to eql 'FontAwesome6Free-Solid'
end
end
6 changes: 3 additions & 3 deletions spec/list_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@
(expect pdf.lines).to eql [%(\uf192 bullseye!)]
marker_text = pdf.find_unique_text ?\uf192
(expect marker_text).not_to be_nil
(expect marker_text[:font_name]).to eql 'FontAwesome5Free-Regular'
(expect marker_text[:font_name]).to eql 'FontAwesome6Free-Regular'
end
end

Expand Down Expand Up @@ -541,10 +541,10 @@
(expect pdf.lines).to eql [%(\uf096 todo), %(\uf046 done)]
unchecked_marker_text = pdf.find_unique_text ?\uf096
(expect unchecked_marker_text).not_to be_nil
(expect unchecked_marker_text[:font_name]).to eql 'FontAwesome5Free-Solid'
(expect unchecked_marker_text[:font_name]).to eql 'FontAwesome6Free-Solid'
checked_marker_text = pdf.find_unique_text ?\uf046
(expect checked_marker_text).not_to be_nil
(expect checked_marker_text[:font_name]).to eql 'FontAwesome5Free-Solid'
(expect checked_marker_text[:font_name]).to eql 'FontAwesome6Free-Solid'
end
end
end
Expand Down

0 comments on commit 3240e82

Please sign in to comment.