Re: [ft-devel] FT_Get_Advance() docs
Testing suggests that [FT_Get_Advance] returns glyph-linearHoriAdvance, not glyph-advance.x. This is understandable, but unintuitive and not documented. Hmm. In fact, the following suggests that FT_Get_Advance() may in fact take hinting into account: This is correct. But apparently it doesn't. It does. At any rate, would be nice to document what exactly is it that FT_Get_Advance() returns, and what tests can the client use to determine whether what FT_Get_Advance() returns matches glyph-advance.x. The behaviour depends on `load_flags' and on FT_ADVANCE_FLAG_FAST_ONLY: . If a glyph is unhinted (FT_LOAD_NO_HINTING), or unscaled (FT_LOAD_NO_SCALE), or bitmapped, or if the light-hinted rendering mode is active (FT_RENDER_MODE_LIGHT), quick retrieval of advance widths is possible in general. However, you can only be sure about that if you add FT_ADVANCE_FLAG_FAST_ONLY to `load_flags' and assure that you don't get an error. Depending on the load flags, you get either advance values in FUnits (the sentence about `default' in the description of FT_Get_Advance is rather unfortunate) or scaled values which are then identical to the glyph-linear{Hori,Vert}Advance values. . If the above conditions aren't met, FT_Load_Glyph is called, and you get glyph-advance.{x,y} values. I would be glad if you could suggest a better wording of the documentation. Werner ___ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel
Re: [ft-devel] FT_Get_Advance() docs
I know this isn't a welcome remark, but I'm going to say it anyway, because it's a rule I apply to myself: if an API is difficult to explain then it should be changed. Yes, I know you can't do that - but it's an argument for carefully documenting something as it is written, and changing it before release if the documentation gets too hard to write. And rather than saying a wording is unfortunate, just change it. An attempt at better wording for the quoted text: You can set a flag that allows fast retrieval of advance values: FT_ADVANCE_FLAG_FAST_ONLY. To use it, combine it with any other flags you're passing to FT_Get_Advance or FT_Get_Advances. But it works only if the glyph is unhinted (FT_LOAD_NO_HINTING), or unscaled (FT_LOAD_NO_SCALE), or bitmapped, or if light hinting is used (FT_RENDER_MODE_LIGHT). If none of these conditions is met, FT_Get_Advance or FT_Get_Advances will fail with FT_Err_Unimplemented_Feature. Graham From: Werner LEMBERG w...@gnu.org To: beh...@behdad.org Cc: freetype-devel@nongnu.org Sent: Wednesday, 30 November 2011, 14:30 Subject: Re: [ft-devel] FT_Get_Advance() docs Testing suggests that [FT_Get_Advance] returns glyph-linearHoriAdvance, not glyph-advance.x. This is understandable, but unintuitive and not documented. Hmm. In fact, the following suggests that FT_Get_Advance() may in fact take hinting into account: This is correct. But apparently it doesn't. It does. At any rate, would be nice to document what exactly is it that FT_Get_Advance() returns, and what tests can the client use to determine whether what FT_Get_Advance() returns matches glyph-advance.x. The behaviour depends on `load_flags' and on FT_ADVANCE_FLAG_FAST_ONLY: . If a glyph is unhinted (FT_LOAD_NO_HINTING), or unscaled (FT_LOAD_NO_SCALE), or bitmapped, or if the light-hinted rendering mode is active (FT_RENDER_MODE_LIGHT), quick retrieval of advance widths is possible in general. However, you can only be sure about that if you add FT_ADVANCE_FLAG_FAST_ONLY to `load_flags' and assure that you don't get an error. Depending on the load flags, you get either advance values in FUnits (the sentence about `default' in the description of FT_Get_Advance is rather unfortunate) or scaled values which are then identical to the glyph-linear{Hori,Vert}Advance values. . If the above conditions aren't met, FT_Load_Glyph is called, and you get glyph-advance.{x,y} values. I would be glad if you could suggest a better wording of the documentation. Werner ___ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel___ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel
Re: [ft-devel] FT_Get_Advance() docs
I know this isn't a welcome remark, but I'm going to say it anyway, because it's a rule I apply to myself: if an API is difficult to explain then it should be changed. :-) Fortunately, it's not me to blame for the design of this API. And I haven't written the documentation either. Yes, I know you can't do that - but it's an argument for carefully documenting something as it is written, and changing it before release if the documentation gets too hard to write. And rather than saying a wording is unfortunate, just change it. Hehe. It was a call for help, and behold, a saviour has appeared. Thanks! An attempt at better wording for the quoted text: You can set a flag that allows fast retrieval of advance values: [...] But this is not correct! If you set the flag, *only* fast retrieval is tried. If you don't set it, you get fast retrieval also if supported. Below is my proposal for an improved documentation of FT_Get_Advance. Werner == Function FT_Get_Advance Description Retrieve the advance value of a given glyph outline in an @FT_Face. Input face :: The source @FT_Face handle. gindex :: The glyph index. load_flags :: A set of bit flags similar to those used when calling @FT_Load_Glyph. Output padvance :: The advance value, either in font units if @FT_LOAD_NO_SCALE is used, or in 16.16 format for all other load flags. If @FT_LOAD_VERTICAL_LAYOUT is set, this is the vertical advance corresponding to a vertical layout. Otherwise, it is the horizontal advance in a horizontal layout. Return FreeType error code. 0 means success. Note Quick retrieval of advance widths is possible if a glyph is unhinted (@FT_LOAD_NO_HINTING), or unscaled (@FT_LOAD_NO_SCALE), or bitmapped, or if light-hinting is used (@FT_RENDER_MODE_LIGHT), and the font backend supports it. To check these conditions, add the @FT_ADVANCE_FLAG_FAST_ONLY flag to `load_flags'; in case of failure `FT_Err_Unimplemented_Feature' is returned. If the above conditions are met and @FT_LOAD_NO_SCALE isn't set, values equal to the `linearHoriAdvance' (or `linearVertAdvance') field of a @FT_GlyphSlot structure are returned in `padvance'. If the above conditions aren't met and @FT_LOAD_NO_SCALE isn't set, @FT_Load_Glyph is called, and values equal to the `advance' field of a @FT_GlyphSlot structure are returned in `padvance' (but in 16.16 format). If the returned advance value gets scaled, the affine transformation specified by @FT_Set_Transform is not applied. ___ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel
Re: [ft-devel] FT_Get_Advance() docs
The problem that your description starts with long cumbersome condition. Start description with what the flag actually does: FT_ADVANCE_FLAG_FAST_ONLY: . Enable quick retrieval of advance in the special cases of - unhinted (FT_LOAD_NO_HINTING), - lightly hinted (FT_RENDER_MODE_LIGHT), - unscaled (FT_LOAD_NO_SCALE), - or bitmapped glyphs. Depending on these load flags, you get either advance values in FUnits (the sentence about `default' in the description of FT_Get_Advance is rather unfortunate) or scaled values which are then identical to the glyph-linear{Hori,Vert}Advance values. Also . If the above conditions aren't met, FT_Load_Glyph is called, and you get glyph-advance.{x,y} values. Check for return errors to ensure proper return values. On Wed, Nov 30, 2011 at 9:30 AM, Werner LEMBERG w...@gnu.org wrote: The behaviour depends on `load_flags' and on FT_ADVANCE_FLAG_FAST_ONLY: . If a glyph is unhinted (FT_LOAD_NO_HINTING), or unscaled (FT_LOAD_NO_SCALE), or bitmapped, or if the light-hinted rendering mode is active (FT_RENDER_MODE_LIGHT), quick retrieval of advance widths is possible in general. However, you can only be sure about that if you add FT_ADVANCE_FLAG_FAST_ONLY to `load_flags' and assure that you don't get an error. Depending on the load flags, you get either advance values in FUnits (the sentence about `default' in the description of FT_Get_Advance is rather unfortunate) or scaled values which are then identical to the glyph-linear{Hori,Vert}Advance values. . If the above conditions aren't met, FT_Load_Glyph is called, and you get glyph-advance.{x,y} values. ___ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel
Re: [ft-devel] FT_Get_Advance() docs
The problem that your description starts with long cumbersome condition. Start description with what the flag actually does: FT_ADVANCE_FLAG_FAST_ONLY: . Enable quick retrieval of advance in the special cases of - unhinted (FT_LOAD_NO_HINTING), - lightly hinted (FT_RENDER_MODE_LIGHT), - unscaled (FT_LOAD_NO_SCALE), - or bitmapped glyphs. This is wrong, see my other mail. Werner ___ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel
Re: [ft-devel] Suggestions with cross-compiled FreeType with gcc 4.5.2
Able to display scaled fonts, but hang/crash when I do rotation angle 0. Please docs/DEBUG. Maybe this helps. I then re-compiled and ran qemu and the code seemed to die at: The code crashed right after FT_Glyph_Transform(glyph, pf-matrix, 0); while trying to do: FT_Glyph_To_Bitmap(glyph, render_mode, 0,// no additional translation 1); // do not destroy copy in image Any ideas? No, sorry. Werner ___ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel