freetype-devel
[Top][All Lists]
Advanced

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

Re: [ft-devel] How to determine if horizontal hinting is happening?


From: Adam Goode
Subject: Re: [ft-devel] How to determine if horizontal hinting is happening?
Date: Mon, 19 Feb 2018 16:36:42 -0500

On Mon, Feb 19, 2018 at 3:05 PM, Werner LEMBERG <address@hidden> wrote:
>>>>> What I need is a reliable mechanism (across Freetype versions and
>>>>> fonts) to determine if a font has horizontal hinting applied or
>>>>> not.  It looks like it's something Freetype might need to
>>>>> provide, since the true answer seems to come from the interaction
>>>>> of flags, fonts, and engines.
>>>>>
>>>>> Could this be something that I can read out of FT_FaceRec?
>>>>
>>>> No, it can't, since FT_Load_Glyph's load flags determine that,
>>>> which comes later than the creation of `FT_Face'.
>>>
>>> Could you get this from comparing linearHoriAdvance with
>>> advance.x<<10 ?
>
> I don't think so.
>
>> What if we store the resulting load_flags after all massaging inside
>> FT_Load_Glyph into the reserved field of FT_GlyphSlot?  Would this
>> work?  Sorry, I do not like adding new function interfaces.
>
> The very issue is to get information on how FreeType will render a
> glyph *before* the actual rendering.  This essentially means we have
> to call a function *instead* of `FT_Load_Glyph'.
>
> Abusing `FT_Load_Glyph' for that purpose (for example, by introducing
> a new FT_LOAD_GET_RENDERING_INFO flag that do what you suggest) looks
> inelegant.

Is there a way to use the property mechanism to implement this? I
agree adding a new function interface is good to avoid if possible.
https://www.freetype.org/freetype2/docs/reference/ft2-properties.html

I feel like using properties might be the right way to do it, combined
with a new bit of documentation that explains how and what to query.
This is a natural extension to the current state of the documentation
which incompletely documents the effects certain flags and compilation
options have on horizontal hinting. (Example:
https://www.freetype.org/freetype2/docs/reference/ft2-base_interface.html#FT_LOAD_TARGET_XXX).
I don't know if this would be possible though, given that it's
font-dependent which engine is used, especially if

Also, I don't think it's necessarily too late to get the information
after FT_Load_Glyph is called. FT_Render_Glyph is already a separate
operation, correct? This is a similar operation to the pseudocode at
the bottom of 
https://www.freetype.org/freetype2/docs/reference/ft2-base_interface.html#FT_Size_Metrics.

(The note there is a bit confusing though: "Only the application knows
in advance that it is going to use native hinting for TTFs" doesn't
seem to make sense in all cases, since Freetype can override this if
no FT_LOAD_FORCE_AUTOHINT or FT_LOAD_NO_AUTOHINT are used. This seems
like a very similar issue, something that would be nice to be able to
query, or have clearly documented.)


Thanks,

Adam



reply via email to

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