freetype-devel
[Top][All Lists]
Advanced

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

Re: [ttf2pt1-devel] Re: FreeType front-end in ttf2pt1


From: Stefan Seefeld
Subject: Re: [ttf2pt1-devel] Re: FreeType front-end in ttf2pt1
Date: Sat, 14 Oct 2000 21:28:38 -0400

Werner LEMBERG wrote:

> > the idea is to avoid dynamic typing (which is what you suggest if
> > you want to query a given font instance for the presence of a
> > specific feature) but rather use static typing, i.e. to make a
> > TTFont a *type*, which can be checked for at compile time. Only this
> > type and its associated API provides the means to access TT specific
> > features.
> 
> I fully agree.  But (to continue your example) which values should be
> queried with get_general_feature?  And in which format shall the
> values be returned?

it wasn't meant to be used exactly that way. It was merely an illustration
of how to extend types. What I would propose is similar to the 'dynamic_cast'
template in C++ (and often referred to as 'narrowing', or 'downcasting':
Given the current (general) API, you may add a method which 'tries' to cast
the font type to a special font type. As with dynamic_cast, this call will
simply return 0 if the font isn't of the required type, the sub type if it is.

FT_Face face;
// create the face here

TT_Face ttface;
if (narrow_to_TT(face, ttface) == -1) { // error...};

// now you can operate on TT_Face, which provides a richer API than FT_Face

Hope this helps,

Stefan
_______________________________________________________              
              
Stefan Seefeld
Departement de Physique
Universite de Montreal
email: address@hidden

_______________________________________________________

      ...ich hab' noch einen Koffer in Berlin...



reply via email to

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