Re: drawing text and GdkPixbuf



The best solution very much depends on how much and what kind of text you
need. Possible alternatives are:

* Use X font -> bitmap -> image conversion. For last render you can
probably also use art_rgb_bitmap_affine, if you need affine and do not
need alpha. X fonts are surely most standard, but the API sucks, and
they can only be obtained in raster

* If you prefer using Gnome Type1 fonts, take GnomeFont/GnomeFontMap, get
ArtBpath, convert to SVP and render this to buffer. If Gnome
(gnome-print) is installed, you can usually count, that standard (Times
etc.) Type1 fonts are also available.

* If you dare, you can use FreeType to render TTF fonts into graymaps, and
overlay these to buffer, or convert TTF outlines to ArtBpath and render
these via SVP-s. Unfortunately you cannot guess anything about available
TTF fonts in user system.

Regards,
Lauris Kaplinski


On 2 May 2000, Havoc Pennington wrote:

> Darin Adler <darin@eazel.com> writes:
> > Here's the situation. I have a GdkPixbuf. I want to draw some text and
> > overlay it on top of the existing stuff in the pixbuf within a particular
> > rectangle. How can I do that? Can I create a GdkBitmap and draw into that
> > and then composite that into the GdkPixbuf somehow? Is this whole thing just
> > a misguided X novice problem?
> > 
> > Do I have to suck fonts out of the X server like the GnomeCanvasText canvas
> > item does?
> > 
> 
> Something gruesome like that, yes.
> 
> You might draw to a bitmap; copy to one-bit GdkImage; then for each
> pixel in the image, if the pixel is set, write a pixel to the pixbuf.
> 
> Havoc
> 
> _______________________________________________
> gnome-devel-list mailing list
> gnome-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gnome-devel-list
> 





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