[cairo] Using alternate FT_CharMap with Cairo.

Vincent frerot13 at gmail.com
Tue Apr 30 08:33:56 UTC 2019


I need some help because my knowledge about fonts and fonts encoding is 
very short.

I try to switch from custom bitmap painting to direct Cairo text 
rendering in GraceGTK (https://sourceforge.net/projects/gracegtk/), a 
fork of Grace (http://plasma-gate.weizmann.ac.il/Grace/)

This implies to switch from T1lib to FreeType2 and the goal is to use 
the same mapping as with T1lib.

Note that fonts files in .pfb format are included into the package 
distributed with Grace and I wish to always use them.

For most of the included fonts, it is working well but not for all.

For the Symbol font, characters are not displayed as needed, e.g. greek 
letter "alpha" is not painted when  ASCII "a" is used.

I was thinking that the alternate charmap should do that, but it seems 
that this is not the case.

The following scheme is used:

   FT_Face ft_face;
   error = FT_New_Face (library ,"s050000l.pfb" ,0 ,&ft_face);
   FT_Select_Charmap (ft_face ,FT_ENCODING_ADOBE_CUSTOM);
   cairo_font_face_t *cr_face;
   cr_face  = cairo_ft_font_face_create_for_ft_face (*ft_face 
   cairo_set_font_face (cr ,cr_face);
    cairo_show_text (cr ,"the_string");

Do you think that I miss something?

Note that I can't use Pango because Grace and GraceGTK have their own 
escape sequences to display greek letters, underscripts, overscripts,... 
and I wish to maintain upward compatibility with old scripts.

Could you give me some hints to achieve this goal?

I join a small test program with the font files to show what happens.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cairographics.org/archives/cairo/attachments/20190430/4f554956/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_font_symbol.tar.bz2
Type: application/x-bzip
Size: 77360 bytes
Desc: not available
URL: <https://lists.cairographics.org/archives/cairo/attachments/20190430/4f554956/attachment-0001.bin>

More information about the cairo mailing list