freetype
[Top][All Lists]
Advanced

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

Re: [ft] Faster computation of text width?


From: John Found
Subject: Re: [ft] Faster computation of text width?
Date: Fri, 13 Mar 2015 22:05:44 +0200

On Fri, 13 Mar 2015 19:51:16 +0100 (CET)
Werner LEMBERG <address@hidden> wrote:

> 
> > Indeed, working more on this issue I realized, that using
> > FT_ADVANCE_FLAG_FAST_ONLY together with FT_LOAD_TARGET_LCD causes
> > FT_Get_Advance to fail always.  Removing FT_ADVANCE_FLAG_FAST_ONLY,
> > makes it work but very slow.
> > 
> > On the other hand, using FT_LOAD_NO_HINTING makes it to work really
> > fast, but the computed width is not the same as the width of the
> > rendered string with hinting enabled.
> > 
> > Which makes this function almost useless in the real world... :(
> 
> Well, caching is the solution.  Additionally, in case a font has a
> hdmx table, and you are in non-ClearType mode, you can use the
> pre-computed advance widths for a given PPEM value.
> 

Unfortunately, I need a general solution working acceptably fast for 
all fonts and rendering modes. This way, it is obviously, that using
FT_Get_Advance is not what is needed and the best solution is to use
the caching sub-system with already rendered images.


> Uh, oh, please provide a C snippet, and tell us which font you are
> using.  I apologize for not being able to work with ASM.

The cited benchmarks was made using "DejaVu Sans" with 16px height 
(19px line spacing)

About the C snippets - unfortunately, I can only read C and only if it 
is not so complex. This way I simply can't provide C code snippets at 
all. 
I can write them in Pascal, but writing everything from scratch only
for a mailing list question is IMHO not very efficient.

-- 
http://fresh.flatassembler.net
http://asm32.info
John Found <address@hidden>



reply via email to

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