Since updating to prawn 2.5.0, we face issues with font embedding and changes to text provided on a template.
Reproduction example:
- This reproduction example assumes that the file
Arial Unicode MS.TTF is present in the local working directory. While the font is shipped with Microsoft Office by default and can be licensed by Microsoft, it is also available on GitHub (for example here).
- This reproduction example further assumes that a file called
template.pdf is present in the local working directory downloaded from this issue: template.pdf. The template text was created in Word and then exported to PDF. It contains two lines of text in two different fonts; namely "Source Sans Pro" and "Calibri". Both fonts are shipped with the template as embedded subset:
With both files being available, a simple irb can be started and the following script can be executed:
require 'prawn'
require 'prawn/templates'
@pdf = Prawn::Document.new(
template: 'template.pdf',
page_size: 'A4',
page_layout: :landscape,
left_margin: 0,
right_margin: 0,
top_margin: 0,
bottom_margin: 0
)
# Subsetting is disabled, so that https://github.com/prawnpdf/prawn/issues/1361 doesn't apply.
@pdf.font_families.update("ArialUnicodeMS" => {normal: {file: "Arial Unicode MS.TTF", subset: false}})
@pdf.font "ArialUnicodeMS", style: :normal
@pdf.text_rendering_mode :fill_stroke do
@pdf.draw_text "Demo Text @ Draw Text", size: 22.0, style: :normal, text_anchor: "middle", at: [500, 500], offset: [0, 0]
end
@pdf.render_file('prawn.pdf')
puts "Done"
Issue noticed:
We assume that this issue is not directly related to #1361, since subsetting is explicitly disabled for the font. However, since we are not fully aware of the inner workings of Prawn, both issues could be well related. In this case, we excuse for the duplicate reporting. Any help to fix the issue mentioned is very appreciated!
--
prawn: 2.5.0
Ruby: 3.3.5
Adobe Acrobat Pro: 2024.003.20121
Microsoft Word: Version 2408 Build 16.0.17928.20156
Since updating to prawn 2.5.0, we face issues with font embedding and changes to text provided on a template.
Reproduction example:
Arial Unicode MS.TTFis present in the local working directory. While the font is shipped with Microsoft Office by default and can be licensed by Microsoft, it is also available on GitHub (for example here).template.pdfis present in the local working directory downloaded from this issue: template.pdf. The template text was created in Word and then exported to PDF. It contains two lines of text in two different fonts; namely "Source Sans Pro" and "Calibri". Both fonts are shipped with the template as embedded subset:With both files being available, a simple
irbcan be started and the following script can be executed:Issue noticed:
We assume that this issue is not directly related to #1361, since subsetting is explicitly disabled for the font. However, since we are not fully aware of the inner workings of Prawn, both issues could be well related. In this case, we excuse for the duplicate reporting. Any help to fix the issue mentioned is very appreciated!
--
prawn:
2.5.0Ruby:
3.3.5Adobe Acrobat Pro:
2024.003.20121Microsoft Word:
Version 2408 Build 16.0.17928.20156