Skip to content

Trying to embed svg into text fails #406

Description

@Gremious

Describe the bug

I am trying to add an icon into my text using the do |embed| block. Unfortunately this fails to build.

To Reproduce

require 'squib'
require 'game_icons'

Squib::Deck.new(width: '2.5in', height: '3.5in', dpi: 300, cards: 1) do
  text(str: 'Take 1 :tool: and gain 2 :tool:') do |embed|
    embed.svg key: ':tool:', file: 'tap.svg'
  end

  save format: :pdf, file: 'hello.pdf', width: '210mm', height: '297mm', gap: '1mm'
end

Expected behavior
Text with svg's in it

Output

/home/user/.gem/ruby/3.4.0/gems/squib-0.19.0/lib/squib/graphics/text.rb:70:in 'Squib::Card#compute_carve': uninitialized constant Squib::Card::RSVG (NameError)

          RSVG::Handle.new_from_data(svg_data).width
          ^^^^
Did you mean?  Rsvg
        from /home/user/.gem/ruby/3.4.0/gems/squib-0.19.0/lib/squib/graphics/text.rb:87:in 'block (2 levels) in Squib::Card#embed_images!'
        from /home/user/.gem/ruby/3.4.0/gems/squib-0.19.0/lib/squib/graphics/text.rb:86:in 'Array#each'
        from /home/user/.gem/ruby/3.4.0/gems/squib-0.19.0/lib/squib/graphics/text.rb:86:in 'block in Squib::Card#embed_images!'
        from /home/user/.gem/ruby/3.4.0/gems/squib-0.19.0/lib/squib/graphics/text.rb:84:in 'Hash#each'
        from /home/user/.gem/ruby/3.4.0/gems/squib-0.19.0/lib/squib/graphics/text.rb:84:in 'Squib::Card#embed_images!'
        from /home/user/.gem/ruby/3.4.0/gems/squib-0.19.0/lib/squib/graphics/text.rb:182:in 'block in Squib::Card#render_text'
        from /home/user/.gem/ruby/3.4.0/gems/squib-0.19.0/lib/squib/card.rb:51:in 'Squib::Card#use_cairo'
        from /home/user/.gem/ruby/3.4.0/gems/squib-0.19.0/lib/squib/graphics/text.rb:157:in 'Squib::Card#render_text'
        from /home/user/.gem/ruby/3.4.0/gems/squib-0.19.0/lib/squib/graphics/text.rb:149:in 'Squib::Card#text'
        from /home/user/.gem/ruby/3.4.0/gems/squib-0.19.0/lib/squib/dsl/text.rb:48:in 'block in Squib::DSL::Text#run'
        from /home/user/.gem/ruby/3.4.0/gems/squib-0.19.0/lib/squib/args/card_range.rb:16:in 'block in Squib::Args::CardRange#each'
        from /home/user/.gem/ruby/3.4.0/gems/squib-0.19.0/lib/squib/args/card_range.rb:16:in 'Range#each'
        from /home/user/.gem/ruby/3.4.0/gems/squib-0.19.0/lib/squib/args/card_range.rb:16:in 'Squib::Args::CardRange#each'
        from /home/user/.gem/ruby/3.4.0/gems/squib-0.19.0/lib/squib/dsl/text.rb:47:in 'Squib::DSL::Text#run'
        from /home/user/.gem/ruby/3.4.0/gems/squib-0.19.0/lib/squib/dsl/text.rb:14:in 'Squib::Deck#text'
        from deck.rb:122:in 'block in <main>'
        from /home/user/.gem/ruby/3.4.0/gems/squib-0.19.0/lib/squib/deck.rb:75:in 'BasicObject#instance_eval'
        from /home/user/.gem/ruby/3.4.0/gems/squib-0.19.0/lib/squib/deck.rb:75:in 'Squib::Deck#initialize'
        from deck.rb:32:in 'Class#new'
        from deck.rb:32:in '<main>'

For reference, here's the svg I'm trying to use (Note: it's white so hard to see in browser)

Image

Environment

  • OS: EndeavourOS

  • Ruby version 3.4.0

  • I have updated Squib to the latest version.

  • I have checked the Squib issues backlog for something similar

  • I have attempted to make a minimal script demonstrating my problem

  • I have reviewed the Squib Docs and there's still a problem

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions