0

I Checked the libharu-RELEASE_2_3_0,there are hpdf_encoder_cns.c,hpdf_encoder_cnt.c,hpdf_encoder_jp.c,hpdf_encoder_utf.c which code support Russian text ?

3 Answers3

0

The UTF-8 hpdf_encoder_utf.c should support Cyrillic letters.

Martin Zeitler
  • 1
  • 19
  • 155
  • 216
  • thanks,I'll have a try. In fact ,I am using an old libharu and there is a sample called encoding_list.c.It use different encoding style to show characters.I want to show Russian sentences in PDF .so I have to set the codes file as KOI8-R ,even this,the result is not nice, It can show Russian text,but for blanks,it shows '?' – yangkunvanpersie Nov 30 '19 at 06:48
  • Do you used the latest libharu? – yangkunvanpersie Nov 30 '19 at 06:49
  • yes ,I use it and generate the pdf with Russian.
    HPDF_UseUTFEncodings(pdf);
     HPDF_SetCurrentEncoder(pdf,"UTF-8");
    
     detail_font_name = HPDF_LoadTTFontFromFile (pdf, "ttfont/arial.ttf", HPDF_TRUE);
    
        title_font = HPDF_GetFont (pdf, "Helvetica", NULL);
    
     detail_font = HPDF_GetFont (pdf, detail_font_name, "UTF-8");
    – yangkunvanpersie Dec 02 '19 at 05:50
  • yes,I use this code to generate pdf with Russian.but I have to embed arial.ttf into pdf . And the pdf size is sure large.Is there any solution to solve it ? – yangkunvanpersie Dec 02 '19 at 05:58
0
    HPDF_UseUTFEncodings(pdf);
HPDF_SetCurrentEncoder(pdf,"UTF-8");

detail_font_name = HPDF_LoadTTFontFromFile (pdf, "ttfont/arial.ttf", HPDF_TRUE);

title_font = HPDF_GetFont (pdf, "Helvetica", NULL);

detail_font = HPDF_GetFont (pdf, detail_font_name, "UTF-8");

yes,I use this code to generate pdf with Russian.but I have to embed arial.ttf into pdf . And the pdf size is sure large.Is there any solution to solve it ?

0

If you just do NOT want to embed used font into your generated PDF document, just use the following:

detail_font_name = HPDF_LoadTTFontFromFile (pdf, "ttfont/arial.ttf", HPDF_FALSE);

The result PDF will not have a font embedded, not even a subset. But this requires the PDF viewer to pick the right glyph.

l.yang
  • 11
  • 2