jessedoyle / prawn-icon

Easy icons for Prawn.
Other
31 stars 15 forks source link

table_icon doesn't work with content key #39

Closed lethunder closed 5 years ago

lethunder commented 5 years ago

hello guys, i'm not able to use table_icon in my table. i can't use the classic call because my table has col and row span

table([ ["A", {:content => table_icon('fas-birthday-cake'), :colspan => 2}, "B"], [{:content => "1x2", :rowspan => 2}, "C", "D", "E"], [{:content => "2x2", :colspan => 2, :rowspan => 2}, "F"], ["G", "H"] ])

This does not work. It returns WARN: Prawn::Errors::UnrecognizedTableContent: Prawn::Errors::UnrecognizedTableContent

jessedoyle commented 5 years ago

Hi @lethunder! Thanks for using Prawn::Icon!

If I recall correctly, I believe the table_icon method accepts an options hash.

Do you mind giving this a try?

table([
  ["A", table_icon('fas-birthday-cake', colspan: 2), "B"],
  [{:content => "1x2", :rowspan => 2}, "C", "D", "E"],
  [{:content => "2x2", :colspan => 2, :rowspan => 2}, "F"],
  ["G", "H"]
])

This produces the following output with Prawn 2.1.0 for me:

Screen Shot 2019-09-06 at 8 10 45 AM

A Prawn::Errors::IncompatibleStringEncoding was thrown for me when trying the code above in Prawn 2.2.2.

It looks like there's either a bug in prawn/table (https://github.com/prawnpdf/prawn/issues/1054) or in prawn (https://github.com/prawnpdf/prawn/issues/996) with regards to external fonts - I haven't had the chance to dig into this more.

Please let me know if this solves your issue!

lethunder commented 5 years ago

Hey. Thanks for your quick response! It works.

Le ven. 6 sept. 2019 à 16:11, Jesse Doyle notifications@github.com a écrit :

Hi @lethunder https://github.com/lethunder! Thanks for using Prawn::Icon !

If I recall correctly, I believe the table_icon method accepts an options hash.

Do you mind giving this a try?

table([ ["A", table_icon('fas-birthday-cake', colspan: 2), "B"], [{:content => "1x2", :rowspan => 2}, "C", "D", "E"], [{:content => "2x2", :colspan => 2, :rowspan => 2}, "F"], ["G", "H"] ])

This is producing the following output with Prawn 2.1.0 for me:

[image: Screen Shot 2019-09-06 at 8 10 45 AM] https://user-images.githubusercontent.com/6474230/64434513-ec922180-d07d-11e9-95c4-69aa804ba948.png

Please let me know if this solves your issue!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jessedoyle/prawn-icon/issues/39?email_source=notifications&email_token=ABPOAVA6YORC34N2ULEOB3TQIJQKBA5CNFSM4IUI6XU2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6C62RA#issuecomment-528870724, or mute the thread https://github.com/notifications/unsubscribe-auth/ABPOAVE46CUHRO5QL6AV4LDQIJQKBANCNFSM4IUI6XUQ .

jessedoyle commented 5 years ago

Thanks @lethunder. I'll close this issue then!