Re: Unicode characters not converted in pdf.
Posted by
mojavelinux on
Feb 08, 2019; 11:14am
URL: https://discuss.asciidoctor.org/Unicode-characters-not-converted-in-pdf-tp6703p6712.html
Thanks for the analysis, Marc.
This appears to be a bug in Prawn's font handling. I tried to use the Prawn API directly with the raw glyph using a font that has that character and it still produces a square box. Perhaps Prawn stops looking for glyphs after a certain threshold.
require 'prawn'
Prawn::Document.generate 'missing-glyph.pdf' do
def register_font data
font_families.update data.inject({}) {|accum, (key, val)| accum[key.to_s] = val; accum }
end
register_font NotoSerif: {
normal: '/usr/share/fonts/dejavu/DejaVuSerif.ttf'
}
font :NotoSerif do
text '𝜎'
end
end
Cheers,
-Dan
On Fri, Feb 8, 2019 at 3:57 AM 1marc1 [via Asciidoctor :: Discussion] <
[hidden email]> wrote:
Hi,
I just tried this as well with a font that has character #120590. The PDF output prints a square as if to indicate that the glyph isn't available. When I replace 120590 in the source with 64 (the number for the @ symbol) it works fine.
I created a table (and used asciidoctor-pdf to turn it into a pdf file) showing a whole range of glyphs:

All but a few of the glyphs in the table above are available in the font that I use.
When looking at a lower range (1748 - 1915), I found that the table is representative of the glyphs that are in the font:

Perhaps this helps someone in troubleshooting.
Marc.
--