FT_SubGlyphRec in FreeType 2.2 - Amanith

View: New views
4 Messages — Rating Filter:   Alert me  

FT_SubGlyphRec in FreeType 2.2 - Amanith

by Matteo Muratori :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi everybody, I'm Matteo, the main developer of Amanith framework (
http://www.amanith.org ).
Amanith uses freetype2 just to read fonts data (essentially control
points, glyphs and kerning tables), from external files.
To render vector font properly, Amanith loads also matrixes for each
subglyphs, that tell how the subglyph is positioned respect to its father.
In particular we use FT_SubGlyphRec_ structure. Inside freetype.h there
is the following line:

typedef struct FT_SubGlyphRec_*  FT_SubGlyph;

But to make my load routines know how that structure is done, i have to
include ftgloadr.h, where FT_SubGlyphRec_ is fully defined (so i can
access matrixes and flags).
In freetype2 2.2 it seems that internal(s) are not ever exposed.
How can i solve this problem for Amanith ?
Can you freetype2 team expose it?
I read that for 2.2 version you have asked for devs feedback, and here
it is. I will appreciate any help, and i wish my feedback will be wellcome.

Thanks in advance.

Matteo Muratori , main Amanith developer - www.amanith.org



_______________________________________________
Freetype-devel mailing list
Freetype-devel@...
http://lists.nongnu.org/mailman/listinfo/freetype-devel

Re: FT_SubGlyphRec in FreeType 2.2 - Amanith

by Werner LEMBERG :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> To render vector font properly, Amanith loads also matrixes for each
> subglyphs, that tell how the subglyph is positioned respect to its
> father.  In particular we use FT_SubGlyphRec_ structure. Inside
> freetype.h there is the following line:
>
> typedef struct FT_SubGlyphRec_*  FT_SubGlyph;
>
> But to make my load routines know how that structure is done, i have
> to include ftgloadr.h, where FT_SubGlyphRec_ is fully defined (so i
> can access matrixes and flags).

What members of this structure do you need?

> In freetype2 2.2 it seems that internal(s) are not ever exposed.

Correct.

> How can i solve this problem for Amanith ?  Can you freetype2 team
> expose it?

We can, I think :-)  I just wonder whether it is better to provide a
function, or whether we shall simply move the structure to a public
header.  David?


    Werner


_______________________________________________
Freetype-devel mailing list
Freetype-devel@...
http://lists.nongnu.org/mailman/listinfo/freetype-devel

Re: FT_SubGlyphRec in FreeType 2.2 - Amanith

by david turner-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi All,


How can i solve this problem for Amanith ?  Can you freetype2 team
expose it?
    

We can, I think :-)  I just wonder whether it is better to provide a
function, or whether we shall simply move the structure to a public
header.  David?

  
I've implemented a new function yesterday night, it's in the CVS. You'll find the corresponding
freetype.h snippet below. Note that I only exposed the FT_SUBGLYPH_FLAG_XXX macros,
the structure itself is still internal, which gives us room for changes in the future.

Hope this helps,

- David Turner
- The FreeType Project  (www.freetype.org)

----------------------------- cut here ------------------------------------
 /**
  * @macro: FT_SUBGLYPH_FLAG_XXX
  *
  * @description:
  *   a list of constant used to describe each subglyph
  *
  * @values:
  *   FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS ::
  *   FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES ::
  *   FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID ::
  *   FT_SUBGLYPH_FLAG_SCALE ::
  *   FT_SUBGLYPH_FLAG_XY_SCALE ::
  *   FT_SUBGLYPH_FLAG_2X2 ::
  *   FT_SUBGLYPH_FLAG_USE_MY_METRICS ::
  */
#define FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS          1
#define FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES      2
#define FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID        4
#define FT_SUBGLYPH_FLAG_SCALE                   8
#define FT_SUBGLYPH_FLAG_XY_SCALE             0x40
#define FT_SUBGLYPH_FLAG_2X2                  0x80
#define FT_SUBGLYPH_FLAG_USE_MY_METRICS      0x200

 /**
  * @func: FT_Get_SubGlyph_Info
  *
  * @description:
  *   a function used to retrieve a description of a given subglyph.
  *   only use it when 'glyph->format' is FT_GLYPH_FORMAT_COMPOSITE, or
  *   an error will be returned
  *
  * @input:
  *   glyph     :: source glyph slot
  *   sub_index :: index of subglyph. must be less than 'glyph->num_subglyphs'
  *
  * @output:
  *   p_index     :: subglyph glyph index
  *   p_flags     :: subglyph flags, see @FT_SUBGLYPH_FLAG_XXX
  *   p_arg1      :: subglyph first argument  (if any)
  *   p_arg2      :: subglyph second argument (if any)
  *   p_transform :: subglyph transform (if any)
  *
  * @return:
  *   error code. 0 means success
  *
  * @note:
  *   the values of *p_arg1, *p_arg2 and *p_transform must be interpreted
  *   depending on the flags returns in *p_flags. See the TrueType specification
  *   for details
  */
  FT_EXPORT( FT_Error )
  FT_Get_SubGlyph_Info( FT_GlyphSlot  glyph,
                        FT_UInt       sub_index,
                        FT_Int       *p_index,
                        FT_UInt      *p_flags,
                        FT_Int       *p_arg1,
                        FT_Int       *p_arg2,
                        FT_Matrix    *p_transform );


***********************************************************************************
Information contained in this email message is confidential and may be privileged, and is intended only for use of the individual or entity named above. If the reader of this message is not the intended recipient, or the employee or agent responsible to deliver it to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the postmaster@... and destroy the original message.
***********************************************************************************

_______________________________________________
Freetype-devel mailing list
Freetype-devel@...
http://lists.nongnu.org/mailman/listinfo/freetype-devel

Re: FT_SubGlyphRec in FreeType 2.2 - Amanith

by Matteo Muratori :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


> What members of this structure do you need?
>  
All of them, in particular, given a FT_SubGlyphRec subGlyph, we use:

subGlyph.index
subGlyph.flags
subGlyph.transform.xx
subGlyph.transform.xy
subGlyph.transform.yx
subGlyph.transform.yy
subGlyph.arg1
subGlyph.arg2

as you can see in
http://svn.berlios.de/svnroot/repos/amanith/trunk/plugins/fonts/gfontsimpexp.cpp 
(function LoadGlyph)
Thanks in advance.

Matteo - www.amanith.org


_______________________________________________
Freetype-devel mailing list
Freetype-devel@...
http://lists.nongnu.org/mailman/listinfo/freetype-devel