freetype-devel
[Top][All Lists]
Advanced

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

Re: [ft-devel] FT_Slot_LoadFunc load_flags info?


From: Werner LEMBERG
Subject: Re: [ft-devel] FT_Slot_LoadFunc load_flags info?
Date: Mon, 26 Oct 2009 07:42:56 +0100 (CET)

Sorry for the late reply.

> I'm wondering if there's any docs (or if anyone can summarize) which
> of the various FT_LOAD_* flags my FT_Slot_LoadFunc function is
> responsible for detecting/obeying, and which ones I can ignore?

No, there isn't.

> I've already learnt that FT_LOAD_NO_SCALE needs to be handled [*],
> and I'm thinking maybe FT_LOAD_IGNORE_TRANSFORM needs to be handled
> too (Or, maybe I am supposed to be doing something when that flag
> *isn't* present?  Hmmm...).  Any others?

I suggest that you check which of those flags is used in the files
located in the src/base subdirectory -- a grep for `FT_LOAD_' gives 28
lines.

> [*] Can someone sanity-check my pseudo-calculations for NO_SCALE?
>        double xScale, yScale;
>        if (load_flags & FT_LOAD_NO_SCALE)
>               xScale = yScale = inSlot->face->scale;
>        else
>               xScale = inSlot->face->scale *
>                     inSize->metrics.x_scale / (double)(0x10000);
>               yScale = inSlot->face->scale *
>                     inSize->metrics.y_scale / (double)(0x10000);
>        ...
>        currPnt.x = xScale * myPnt.x;
>        currPnt.y = yScale * myPnt.y;
>        inSlot->face->glyph_loader->current.outline.points[count]
>                                                    = currPnt;

I always have difficulties with the scaling parameters :-) In
ttgload.c, function TT_Process_Simple_Glyph, you can find

  FT_Vector*  vec     = outline->points;
  FT_Vector*  limit   = outline->points + n_points;
  FT_Fixed    x_scale = ((TT_Size)loader->size)->metrics.x_scale;
  FT_Fixed    y_scale = ((TT_Size)loader->size)->metrics.y_scale;


  for ( ; vec < limit; vec++ )
  {
    vec->x = FT_MulFix( vec->x, x_scale );
    vec->y = FT_MulFix( vec->y, y_scale );
  }


    Werner




reply via email to

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