Line height issue - Khmer font

88 views
Skip to first unread message

Leonard Ng'eno

unread,
Feb 7, 2019, 10:15:59 AM2/7/19
to Prawn
I am printing some text in Khmer language onto a pdf and the lower part of the text is cut out and replaced by a + sign. Is there a way to increase the line height based on the type of font used? 
The code I used is as below:

font_families.update(
  'KhmerOS' => {
        normal: "#{Rails.root}/app/pdfs/fonts/KhmerOS.ttf"
   }
)

font('KhmerOS') do
  text "កម្ពុជា"
end

The output is in attached png image. The lower part of the second character is cut out and replaced with a + sign. If I copy the output on the pdf and paste it onto TextEdit, the lower part shows up as expected.

Any guidance in the right direction is appreciated. Thank you.
output.png

Alexander Mankuta

unread,
Feb 7, 2019, 10:20:43 AM2/7/19
to Prawn
I believe this is an issue with how Prawn subsets fonts. The required glyph is getting removed from the subset. I think there's a similar issue with Arabic fonts and there's a gem somewhere that does some text munging substituting characters with the ones that should be handled by ligatures in the font. Maybe you could use similar approach for Khmer text.

--
Regards,
Alex
Message has been deleted

Leonard Ng'eno

unread,
Feb 7, 2019, 10:33:45 AM2/7/19
to Prawn
Clarification - The lower part of the compound character is pushed to the box on the right.

Alberto Jesús

unread,
Jul 8, 2020, 3:31:37 PM7/8/20
to Prawn
I'm getting the same issue, I tried with multiple TTF fonts but got the same problem. were you able to fix it?

Best regards
--
Alberto

Leonard Ng'eno

unread,
Jul 8, 2020, 3:56:36 PM7/8/20
to prawn...@googlegroups.com
Hi Alberto,

Unfortunately I was not able to fix the issue. I ended up having to generate Khmer pdfs on the client side using JavaScript.


--
You received this message because you are subscribed to the Google Groups "Prawn" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prawn-ruby+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prawn-ruby/94e5672c-7760-4d1d-b132-ace84fe006d9o%40googlegroups.com.


Reply all
Reply to author
Forward
0 new messages