Re: font renderers in gdk



lupus@lettere.unipd.it (Paolo Molaro) writes:
> 
> On Tue, Jan 27, 1998 at 03:07:39AM -0800, Christoph Toshok wrote:
> > Hey all,
> > 
> > spurred by raster's comments about FnLib and anti-aliased fonts, I've
> > hacked a font renderer abstraction into gdk.
> 
> That's fine!
> Two comments: some font libs (t1lib for example) requires some
> initialization (eg the pathname to a config file).
> You want to expose that maybe with a:
> +	gint	(*Init)(GdkFontRenderer*, gchar* config_spec);

Ah, good idea.  I'll add the entry.  Problem is where to store these
config_specs.

> The other thing we (I?) need is rotation: t1lib can do that
> and so freetype, AFAIK.
> +   void                (*RenderStringRot)(GdkFontRenderer *, GdkDrawable *,
> +                               GdkFont *font,
> +                               GdkGC *gc,
> +                               const gchar *string,
> +                               gint length, gint x, gint y, gfloat angle);
> 

Actually, I'll just add the angle parameter to RenderString.  This
vtable should be hidden from programmers, so they can call either
gdk_draw_text or gdk_draw_text_rot, and they'll both call the same
vtable entry (the first one will of course pass 0 for angle.)

> > The function gdk_font_load now checks if the font_name begins with
> > "font:" or "fontset:".  If it does, it dispatches through a list of
> > registered font renderers until it finds one that actually knows about
> > the font.  If it doesn't begin with one of those two strings (such as
> > in the case of XLFD's), it uses the default font renderer, which is
> > uses XFontStructs/XFontSets.
> 
> It can be useful to have a backup scheme: if the fontload routine
> doesn't find a font, it should look for the nearest available
> (this is hard, I know) and of course it should notify the programmer
> as well...

Hard, but doable.  And a good idea.  I always hated it when X can't
find a, say, 24 point font, and substitutes "fixed".

> > font:/VeryCoolFont?point-size=24&weight=bold&slant=italic
> > 
> > Mind you, this format isn't set in stone...  In fact, no code has been
> 
> The simpler, the better (this is going to be exposed to the users...).

So, is this a simple method?  One thing that has always bugged me
about XLFD is that it is rather obtuse (unless you're an Xhead.)

> > The X font renderer is compiled into gdk (but doesn't necessarily have
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> This is important: the default should be compiled in.
> 

Cool - less work for me :)

Chris



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