[cairo] Using alternate FT_CharMap with Cairo.

Vincent frerot13 at gmail.com
Sat May 4 07:56:27 UTC 2019


Hi,

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_HINT_METRICS_DEFAULT);
   cairo_set_font_face (cr ,cr_face);
...
    cairo_show_text (cr ,"the_string");

Do you think that I miss something?

Font file s050000l.pfb may be found at GraceGTK Web site

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?


Cheers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cairographics.org/archives/cairo/attachments/20190504/3967c0d0/attachment.html>


More information about the cairo mailing list