freetype-devel
[Top][All Lists]
Advanced

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

[Devel] change to incremental interface


From: Graham Asher
Subject: [Devel] change to incremental interface
Date: Thu, 13 Feb 2003 18:06:50 -0000

I have changed the interface for loading fonts incrementally in an
incompatible way. None of this matters unless you define
FT_CONFIG_OPTION_INCREMENTAL. And I think I am the only person who does
apart from people at Artifex (like the long-suffering Igor Melichev) who
have to use my code; and they know what they are doing.

What has happened is that the callback function for overriding glyph metrics
has changed from


/***************************************************************************
  *
  * @type:
  *   FT_Incremental_GetGlyphMetricsFunc
  *
  * @description:
  *   A function used to retrieve the basic metrics of a given glyph index
  *   before accessing its data.  This is necessary because, in certain
  *   formats like TrueType, the metrics are stored in a different place
from
  *   the glyph images proper.
  *
  * @input:
  *   incremental ::
  *     A handle to an opaque @FT_Incremental handle provided by the client
  *     application.
  *
  *   glyph_index ::
  *     Index of relevant glyph.
  *
  *   vertical ::
  *     If true, return vertical metrics.
  *
  * @output:
  *   ametrics ::
  *     The glyph metrics in font units.
  *
  *   afound ::
  *     True if there are metrics at all.
  *
  */
  typedef FT_Error
  (*FT_Incremental_GetGlyphMetricsFunc)
                      ( FT_Incremental              incremental,
                        FT_UInt                     glyph_index,
                        FT_Bool                     vertical,
                        FT_Incremental_MetricsRec  *ametrics,
                        FT_Bool                    *afound );

to


/***************************************************************************
  *
  * @type:
  *   FT_Incremental_GetGlyphMetricsFunc
  *
  * @description:
  *   A function used to retrieve the basic metrics of a given glyph index
  *   before accessing its data.  This is necessary because, in certain
  *   formats like TrueType, the metrics are stored in a different place
from
  *   the glyph images proper.
  *
  * @input:
  *   incremental ::
  *     A handle to an opaque @FT_Incremental handle provided by the client
  *     application.
  *
  *   glyph_index ::
  *     Index of relevant glyph.
  *
  *   vertical ::
  *     If true, return vertical metrics.
  *
  *   ametrics ::
  *     This parameter is used for both input and output.
  *     The original glyph metrics, if any, in font units.  If metrics are
  *     not available all the values must be set to zero.
  *
  * @output:
  *   ametrics ::
  *     The replacement glyph metrics in font units.
  *
  */
  typedef FT_Error
  (*FT_Incremental_GetGlyphMetricsFunc)
                      ( FT_Incremental                   incremental,
                        FT_UInt                          glyph_index,
                        FT_Bool                          vertical,
                        FT_Incremental_MetricsRec        *ametrics );

and the code that calls this function, or rather, calls a function pointer
pointing to a function of this type, has also changed. The method used now
allows metrics to be modified, perhaps by adding a constant, as happens for
CFF fonts passed by GhostScript. Under the old system, GetGlyphMetrics was
called, and if some metrics were found, indicated by a true value being
returned for 'afound', these metrics were used, and the built-in metrics
were never fetched.

The new system always gets the built-in metrics, if any, and passes them to
GetGlyphMetrics, which can modify or override them at will.

Graham Asher




reply via email to

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