Using alternate FT_CharMap with Cairo.

Vincent <[email protected]> Sat, 4 May 2019 09:56:27 +0200
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--===============1641978468==
Content-Type: multipart/alternative;
 boundary="------------62ECC7F3024B96B04AC60BC8"
Content-Language: en-US

This is a multi-part message in MIME format.
--------------62ECC7F3024B96B04AC60BC8
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit

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

--------------62ECC7F3024B96B04AC60BC8
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 8bit

<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <font size="-1">Hi,<br>
      <br>
      I need some help because my knowledge about fonts and fonts
      encoding is very short.<br>
      <br>
      I try to switch from custom bitmap painting to direct Cairo text
      rendering in GraceGTK
      (<a class="moz-txt-link-freetext" href="https://sourceforge.net/projects/gracegtk/">https://sourceforge.net/projects/gracegtk/</a>), a fork of Grace
      (<a class="moz-txt-link-freetext" href="http://plasma-gate.weizmann.ac.il/Grace/">http://plasma-gate.weizmann.ac.il/Grace/</a>)<br>
      <br>
      This implies to switch from T1lib to FreeType2 and the goal is to
      use the same mapping as with T1lib.<br>
      <br>
      Note that fonts files in .pfb format are included into the package
      distributed with Grace and I wish to always use them.<br>
      <br>
      For most of the included fonts, it is working well but not for
      all.<br>
      <br>
      For the Symbol font, characters are not displayed as needed, e.g.
      Greek letter "alpha" is not painted when  ASCII "a" is used.<br>
      <br>
      I was thinking that the alternate charmap should do that, but it
      seems that this is not the case.<br>
      <br>
      The following scheme is used:<br>
      <br>
        FT_Face ft_face;<br>
        error = FT_New_Face (library ,"s050000l.pfb" ,0 ,&amp;ft_face);<br>
      ...<br>
        FT_Select_Charmap (ft_face ,FT_ENCODING_ADOBE_CUSTOM);<br>
      ...<br>
        cairo_font_face_t *cr_face;<br>
        cr_face  = cairo_ft_font_face_create_for_ft_face (*ft_face
      ,CAIRO_HINT_METRICS_DEFAULT);<br>
        cairo_set_font_face (cr ,cr_face);<br>
      ...<br>
         cairo_show_text (cr ,"the_string");<br>
         <br>
      Do you think that I miss something?<br>
      <br>
      Font file s050000l.pfb may be found at GraceGTK Web site<br>
      <br>
      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.<br>
      <br>
      Could you give me some hints to achieve this goal?<br>
      <br>
      <br>
      Cheers</font>
  </body>
</html>

--------------62ECC7F3024B96B04AC60BC8--

--===============1641978468==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline

LS0gCmNhaXJvIG1haWxpbmcgbGlzdApjYWlyb0BjYWlyb2dyYXBoaWNzLm9yZwpodHRwczovL2xp
c3RzLmNhaXJvZ3JhcGhpY3Mub3JnL21haWxtYW4vbGlzdGluZm8vY2Fpcm8=

--===============1641978468==--