[Top][All Lists]

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

Re: [ft-devel] controlling FreeType modules

From: Werner LEMBERG
Subject: Re: [ft-devel] controlling FreeType modules
Date: Wed, 22 Aug 2012 08:01:59 +0200 (CEST)

> What are the void* pointers typically expected to point to...?

Property data structures.

> As I suppose these void* values are often pointers to some malloced
> memory in many cases, how is it expected that resource management of
> that memory is done...?  I.e., when the a list gets destroyed
> because a FT library is destroyed, who's responsible for cleaning up
> the pointed-to property data?

FreeType.  If there is ever a need to pass a new string to the library
(for which I currently don't have a use case), the data will be

> "property" tends to bring to mind simple things like numeric or
> string settings.  Strings could I suppose passed directly; how about
> numbers?

Here's a typical example.  Let's say I want to control the range where
the auto-hinter rounds the hinted size more easily to larger integers.

  typedef  range_
    FT_Int32  min;
    FT_Int32  max;

  } range;

  range  increase_x_height = { 6, 22 };

  FT_Property_Set( library, "autofitter", "increase-x-height", &range );

Another example is to get a pointer to the auto-hinter's internal
`glyph_script' array which holds a map between glyph indices and its
assigned scripts.  The idea is to fix entries which need OpenType
support (for example, small caps or superscripts which are normally
not visible in the cmap).

  typedef  glyph_idx_to_script_
    FT_Long   count;
    FT_Byte*  scripts;

  } glyph_idx_to_script;

  void*                 v;
  glyph_idx_to_script*  map;
  FT_Long               idx;

  FT_Property_Get( library, "autofitter", "glyph-to-script-map", &v );
  map = (glyph_idx_to_script*)v;

  /* change an entry */
  idx = 12;
  if ( idx < map->count )
    map->scripts[idx] = AF_SCRIPT_LATIN;

Structures like `range' or `glyph_idx_to_script' are predefined.


reply via email to

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