Re: font renderers in gdk




Christoph Toshok <toshok@Hungry.COM> writes:

> struct _GdkFontRendererVtable
> {
>   gint		(*GetAPIVersion)(GdkFontRenderer *);
>   const gchar*	(*GetName)(GdkFontRenderer *);
>   const gchar*	(*GetVendor)(GdkFontRenderer *);
>   const gchar*	(*GetVersion)(GdkFontRenderer *);
>   const gchar*	(*GetBlurb)(GdkFontRenderer *);
>   gint		(*CountFonts)(GdkFontRenderer *);
>   gint		(*ListFonts)(GdkFontRenderer *, const gchar **font_specs);
>   GdkFont*	(*LoadFont)(GdkFontRenderer *, const gchar *font_spec, gint is_fontset);
>   void		(*DestroyFont)(GdkFontRenderer *, GdkFont *font);
>   void		(*RenderString)(GdkFontRenderer *, GdkDrawable *,
> 				GdkFont *font,
> 				GdkGC *gc,
> 				const gchar *string,
> 				gint length, gint x, gint y);
                                             ^^^^^^^^^^^^^^

For antialiased text, "phases" (non-integer coordinates) are essential
to get really good results. 

And as somebody pointed out, rotation should probably be in here
too. (How many people know that X11R6 supports rotated fonts? (but
not rotated text strings, unfortunately))

>   void		(*GetAscentDescent)(GdkFontRenderer *, GdkFont *font, gint *ascent, gint *descent);
>   gint		(*GetAdvancement)(GdkFontRenderer *, GdkFont *font, gchar *character, gint length);
>   gint		(*GetMaxAdvancement)(GdkFontRenderer *, GdkFont *font);
>   gint		(*StringWidth)(GdkFontRenderer *, GdkFont *font,
> 			       const gchar *string, gint length);
>   gint		(*FontEqual)(GdkFontRenderer *, GdkFont *fonta, GdkFont *fontb);
> };

[...]

> Would you guys be interested in something like this?  Do you think the
> Gdk guys would be (are there any gdk guys on this list?)  If anyone is
> interested in diff's to the gtk+ tip, let me know.

As one "GTK/GDK guy" I'd say that I think people would be interested
in this type of thing in GTK (though not exactly immediately).
But I'm not sure that keeping the same API and only modifying the
internal is the right way to do things. 

X's font handling is quite primitive, and if we want to start
adding rendering on the client side, we should provide something
better. Something things to look at:

The two available free engines
  - t1lib    
  - FreeType

And QuickDraw GX, which by general consensus has the best typographic
model ever made publically available.

Of course, I don't know if GTK needs to be _that_ good. But it
shouldn't be limited by the current X font model.

Regards,
                                        Owen



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