On Fri, 3 Nov 2000, Lee Brown wrote:
> First of all thank you for responding.
>
> On Thu, 02 Nov 2000, Jon M. Taylor wrote:
> >
> > No you don't. You want to use opaque, platform-independent
> > handles and types at the API level and deal with gluing that to X fonts or
> > FreeType fonts or console fonts or whatever.
>
> Hmm... how would you make the following three functions happen?
>
> fnt_font_t fntInitFTFont(FT_Face ftface);
> fnt_font_t fntInitXFont(XFont xfont);
> int fntPrintChar(ggi_visual_t vis, fnt_font_t font, uint32 char_code, sint32
>x,sint32 y);
int fntInit(void);
int fntPrintChar(ggi_visual_t vis, fnt_font_t font, uint32 char_code, sint32 x,sint32
y);
And in libfnt/display/x, something like this:
static int GGIOpen(...)
{
ggifntext *priv = LIBGGI_FNTEXT(vis);
priv->printchar = GGIfnt_x_printchar;
...other API hooks...
}
In libfnt/display/freetype:
static int GGIOpen(...)
{
ggifntext *priv = LIBGGI_FNTEXT(vis);
priv->printchar = GGIfnt_ft_printchar;
...other API hooks...
}
I hope you get the idea. At the top LibFNT API level, all
functions are generic and all types are opaque. You encapsulate all the
target-specific code and data structures within the target code itself.
Again, please look at the MISC extension for examples.
Jon
---
'Cloning and the reprogramming of DNA is the first serious step in
becoming one with God.'
- Scientist G. Richard Seed