[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ft] Extracting sub-glyph transformation
From: |
Kevin Rogovin |
Subject: |
Re: [ft] Extracting sub-glyph transformation |
Date: |
Fri, 31 Aug 2018 10:21:34 +0300 |
Hi,
Thankyuo for the fast reply. The part that I am having trickiness is when
flags has the bit ARGS_ARE_XY_VALUES as down; then the values of args1 and
arg2 are indices into an array, the relevant code I found is
src/truetype/ttgload.c, function TT_Process_Composite_Component():
[code]
FT_UInt num_points = (FT_UInt)gloader->base.outline.n_points;
FT_UInt k = (FT_UInt)subglyph->arg1;
FT_UInt l = (FT_UInt)subglyph->arg2;
FT_Vector* p1;
FT_Vector* p2;
/* match l-th point of the newly loaded component to the k-th point */
/* of the previously loaded components. */
/* change to the point numbers used by our outline */
k += start_point;
l += num_base_points;
if ( k >= num_base_points ||
l >= num_points )
return FT_THROW( Invalid_Composite );
p1 = gloader->base.outline.points + k;
p2 = gloader->base.outline.points + l;
x = p1->x - p2->x;
y = p1->y - p2->y;
[/code]
I see that arg1 and arg2 function as indices when the bit
ARGS_ARE_XY_VALUES are down, but I don't know how to get those vertices
from the index values. And that is likely the easy part... for then I need
to copy the tricky code to adjust the translations too.
Would it be possible to add a new entry point to FreeType that returns the
computed translation? Users will still likely want the flags (for example
to have a fast check if the FT_Matrix is identity, scaling only or 2x2).
Related question: are the values of the FT_Matrix returned by
FT_GetSubGlyphInfo() in units of the parent glyph?
Best Regards,
-Kevin Rogovin
On Fri, Aug 31, 2018 at 8:00 AM Werner LEMBERG <address@hidden> wrote:
>
> > I am trying to load glyph’s geometric data with FT_LOAD_NO_RECURSE.
> > The entry point FT_GetSubGlyphInfo() has almost what I needed, but
> > not quite. It does provide the 2x2 matrix, but not the translation
> > (at least when I read the docs and FreeType source code). [...]
>
> The FreeType documentation explicitly refers to the OpenType
> specification; for clarity, I've now added a link.
>
> I hope this helps. It's quite tricky, indeed.
>
>
> Werner
>