Re: [ft] Loading new Face and accessing glyph metrics (performance)

2018-07-21 Thread Werner LEMBERG


> When accessing glyph metrics after loading a new face using
> FT_New_Face vs.  FT_New_Memory_Face, I get much better performance
> from FT_New_Memory_Face which I am surprised by given at this point
> the face has been loaded.  I would expect loading it the first time
> from disk is slower but afterwards, accessing other glyph metrics
> should be the same between the two.

This is not surprising at all, AFAICS.  To make `FT_New_Face' fast,
FreeType only loads and parses the most necessary bits from the font
file.  Everything else is lazily evaluated; data are read from disk
only when needed.

> In addition, after the face has been loaded using
> FT_New_Memory_Face, I get significant performance differences when
> accessing glyph metrics between different font files.  For instance,
> getting the metrics for the letter "A" from Arial.ttf is 0.08ms
> vs. 0.018ms for Segoeui.ttf vs. 0.0035ms using Anton.ttf.

This might depend on the font's bytecode.  If TrueType instructions
have to be executed to get the metrics, you'll see a slow-down.

I recommended to use a cache for glyph outlines and metrics (and small
bitmaps).

> To load the glyphs, I am using FT_LOAD_COMPUTE_METRICS which I
> presume is the most efficient option if all I need is metrics for a
> given size / glyph.

You might play around with the `ftbench' tool (from the
`freetype2-demo' bundle).  If you notice strange results, please post
it here, together with the exact invocation.

> I am using FreeType version 2.8.1 right now.

The current version is 2.9.1.


Werner

___
Freetype mailing list
Freetype@nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype


[ft] Loading new Face and accessing glyph metrics (performance)

2018-07-21 Thread Stephan Bouchard
Hi!

 

When accessing glyph metrics after loading a new face using FT_New_Face vs.
FT_New_Memory_Face, I get much better performance from FT_New_Memory_Face
which I am surprised by given at this point the face has been loaded. I
would expect loading it the first time from disk is slower but afterwards,
accessing other glyph metrics should be the same between the two.

 

Why am I seeing a performance difference here?

 

In addition, after the face has been loaded using FT_New_Memory_Face, I get
significant performance differences when accessing glyph metrics between
different font files. For instance, getting the metrics for the letter "A"
from Arial.ttf is 0.08ms vs. 0.018ms for Segoeui.ttf vs. 0.0035ms using
Anton.ttf. 

 

Again why the differences here? All these fonts are using Unicode encoding,
Arial has about the same number of glyphs as Segoeui so I would not expect
much difference here.

 

To load the glyphs, I am using FT_LOAD_COMPUTE_METRICS which I presume is
the most efficient option if all I need is metrics for a given size / glyph.

 

I am using FreeType version 2.8.1 right now.

 

 

Regards,

 

 

Stephan 

___
Freetype mailing list
Freetype@nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype