freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Revised SVG stuff


From: Werner LEMBERG
Subject: Re: Revised SVG stuff
Date: Sun, 16 Jan 2022 07:40:17 +0000 (UTC)

> The reason why the autohinting code seems to get triggered for that
> font is because `ttface->num_locations` is 1

The actual value is 321, the number of normal (i.e., non-SVG) glyphs
in the TrueType font.

> for this font while it's 0 for all other fonts that I had in my test
> collection.

In other words, all fonts that you've tested so far were `.otf` fonts
(with third-order B├ęzier curves), and not `.ttf`, right?

> This check happens in FT_Load_Glyph in `ftobjs.c` on line number 999
> in my branch where autohint is set to true, there's a comment about
> `num_locations` over there.  I'm under the impression that that
> value will not be set to `0` in the case of OTF fonts with TTF
> glyphs.

Correct.

> I'm not sure how to add a check that can prevent hinting to be run
> for OT-SVG glyphs.  Whether or not a glyph index has a corresponding
> SVG glyph in the table is determined later on inside cff_slot_load
> or TT_Load_Glyph.  Any ideas on how to prevent autohinting from
> being run on an OT-SVG glyph?

Look at the clause

```
    if ( autohint )
    {
      FT_AutoHinter_Interface  hinting;


      /* try to load embedded bitmaps first if available            */
      /*                                                            */
      /* XXX: This is really a temporary hack that should disappear */
      /*      promptly with FreeType 2.1!                           */
      /*                                                            */
      if ( FT_HAS_FIXED_SIZES( face )              &&
           ( load_flags & FT_LOAD_NO_BITMAP ) == 0 )
      {
        error = driver->clazz->load_glyph( slot, face->size,
                                           glyph_index,
                                           load_flags | FT_LOAD_SBITS_ONLY );

        if ( !error && slot->format == FT_GLYPH_FORMAT_BITMAP )
          goto Load_Ok;
      }

      ...
```

It seems to me that you could try to add another special case for SVG.


    Werner

reply via email to

[Prev in Thread] Current Thread [Next in Thread]