puzzle / prawn-markup

Parse simple HTML markup to include in Prawn PDFs
MIT License
65 stars 16 forks source link

Inconsolata (italic) is not a known font. #18

Closed kevkev300 closed 3 years ago

kevkev300 commented 3 years ago

Hey guys,

in a PDF generation, I include HTML from users who want to use <i> or <em>. When I come to the point of the generation, I get the following error:

Prawn::Errors::UnknownFont
Inconsolata (italic) is not a known font.

I tried it using this method:

def write_html_result(result)
      markup result.result
end

while result.result for one try resolved to "<em>em-ig</em>" and for the other to "<i>italic</i>".

For other tags (e.g. <h1>, <img>) it works well till now.

Is there something I forget to configure here or really a bug? (It's my first time using your gem)

Thanks for your help!

codez commented 3 years ago

I guess this is an issue with your configuration. Make sure to register all variants of the fonts you use with Prawn.

Italics and Bold are handled by Prawn's inline_format Option, so if a plain text("<i>italic</i>", inline_format: true) works, prawn-markup should work as well.

kevkev300 commented 3 years ago

I guess this is an issue with your configuration. Make sure to register all variants of the fonts you use with Prawn.

Italics and Bold are handled by Prawn's inline_format Option, so if a plain text("<i>italic</i>", inline_format: true) works, prawn-markup should work as well.

@codez , thank you so much for the reply! And at the same time, sorry for my late one... You were totally right! I didn't know that I had to add an italic: key to the font_families.update. Now I did, and it works (just that Inconsolata does not exist in italic, I had to find another font....)

So, I'm closing this ticket, thanks!