Re: [ft-devel] How to determine if horizontal hinting is happening?
> Also, I don't think it's necessarily too late to get the information > after FT_Load_Glyph is called. Adam, Ben, To be honest, I do not quite follow how Chromium does text rendering. It was under impression that you guys do font atlasing (aka preloading of font texture). We just provided presetting of bitmap dimensions to facilitate that if you wish. This is a sort of GPU caching system. Now you are asking about subpixel positioning, which is basically uncacheable because you would have unique bitmap for each subpixel position. I am totally confused now. Well, you can use LCD rendered bitmaps as 3 individual bitmaps shifted by 1/3 pixel and have that granularity but not truly continuous. I just wish I could understand where Chromium is going in order to help more intelligently. Alexei ___ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel
Re: [ft-devel] How to determine if horizontal hinting is happening?
On Mon, Feb 19, 2018 at 3:05 PM, Werner LEMBERGwrote: > 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 ___ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel
Re: [ft-devel] How to determine if horizontal hinting is happening?
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. Werner ___ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel
Re: [ft-devel] LLP64 model outside Win64
On Tue, Feb 13, 2018 at 4:39 AM, Chris Liddellwrote: > Using C99 types, with sane fallbacks makes sense, but using the more > invasive parts of C99 (like mixing declarations and code) could be > problematic. This is basically what FreeType is doing already. FreeType gains speed from "long long" on LLP64: http://git.savannah.gnu.org/cgit/freetype/freetype2.git/tree/builds/unix/ftconfig.in#n301 We suppress the long long warning while enforcing ANSI otherwise. This does not cover Visual C++ unfortunately, which still needs FT_CONFIG_OPTION_FORCE_INT64. I would actually propose flipping the option to _AVOID_INT64 for ancient platforms and embracing long long by default. Here is anther place where we use embrace long long, again leaving Visual C++ behind: http://git.savannah.gnu.org/cgit/freetype/freetype2.git/tree/include/freetype/internal/ftcalc.h#n188 ___ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel
Re: [ft-devel] LLP64 model outside Win64
On Mon, Feb 12, 2018 at 4:39 PM, Werner LEMBERGwrote: >> Can we properly use the FT_List data field as an actual pointer to >> the glyph index instead of stuffing the integer into the pointer? > > Certainly, if you are going to dynamically allocate a slot for it. > I tried to avoid that. Totally untested, but why wouldn't this work? diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index 32ed34a..efb7c3c 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -1508,7 +1508,7 @@ /* */ static FT_Error load_truetype_glyph( TT_Loader loader, - FT_UIntglyph_index, + FT_UInt* index, FT_UIntrecurse_count, FT_Boolheader_only ) { @@ -1518,6 +1518,7 @@ TT_Face face = loader->face; FT_GlyphLoader gloader = loader->gloader; FT_Bool opened_frame = 0; +FT_UInt glyph_index = *index; #ifdef FT_CONFIG_OPTION_INCREMENTAL FT_StreamRecinc_stream; @@ -1783,22 +1784,13 @@ /* normalize the `n_contours' value */ loader->n_contours = -1; - /* - * We store the glyph index directly in the `node->data' pointer, - * following the glib solution (cf. macro `GUINT_TO_POINTER') with a - * double cast to make this portable. Note, however, that this needs - * pointers with a width of at least 32 bits. - */ - - /* clear the nodes filled by sibling chains */ node = ft_list_get_node_at( >composites, recurse_count ); for ( node2 = node; node2; node2 = node2->next ) -node2->data = (void*)FT_ULONG_MAX; +node2->data = NULL; /* check whether we already have a composite glyph with this index */ - if ( FT_List_Find( >composites, - FT_UINT_TO_POINTER( glyph_index ) ) ) + if ( FT_List_Find( >composites, index ) ) { FT_TRACE1(( "TT_Load_Composite_Glyph:" " infinite recursion detected\n" )); @@ -1807,13 +1799,13 @@ } else if ( node ) -node->data = FT_UINT_TO_POINTER( glyph_index ); +node->data = (void*)index; else { if ( FT_NEW( node ) ) goto Exit; -node->data = FT_UINT_TO_POINTER( glyph_index ); +node->data = (void*)index; FT_List_Add( >composites, node ); } @@ -2019,7 +2011,7 @@ num_base_points = (FT_UInt)gloader->base.outline.n_points; error = load_truetype_glyph( loader, - (FT_UInt)subglyph->index, + >index, recurse_count + 1, FALSE ); if ( error ) @@ -2773,7 +2765,7 @@ { /* for the bbox we need the header only */ (void)tt_loader_init( , size, glyph, load_flags, TRUE ); - (void)load_truetype_glyph( , glyph_index, 0, TRUE ); + (void)load_truetype_glyph( , _index, 0, TRUE ); tt_loader_done( ); glyph->linearHoriAdvance = loader.linear; glyph->linearVertAdvance = loader.vadvance; @@ -2818,7 +2810,7 @@ glyph->outline.flags = 0; /* main loading loop */ -error = load_truetype_glyph( , glyph_index, 0, FALSE ); +error = load_truetype_glyph( , _index, 0, FALSE ); if ( !error ) { if ( glyph->format == FT_GLYPH_FORMAT_COMPOSITE ) ___ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel
Re: [ft-devel] How to determine if horizontal hinting is happening?
On Mon, Feb 19, 2018 at 6:41 AM, Alexei Podtelezhnikovwrote: > On Sun, Feb 18, 2018 at 6:11 PM, Werner LEMBERG 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 ? 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. ___ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel
Re: [ft-devel] How to determine if horizontal hinting is happening?
On Sun, Feb 18, 2018 at 6:11 PM, Werner LEMBERGwrote: >> 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 ? ___ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel