font info missing on X.org gtk 2.4.14



The following simple program prints char-by-char info on a XFLD
font. For GTK+ 1.2, it works fine. For my GTK+ 2.4.14/X.org
installation (FC3), it fails to provide any char-by-char info. It also
fails using GTK+1.2 on X.org. 

Any clues why not? The font exists, but apparently without metrics. 

--p

#include <gtk/gtk.h>
#include <gdk/gdktypes.h>
#include <stdio.h>

int
main (int argc, char* argv[])
{
	GdkFont* font;
	int i;
	char text[1];
	int lbearing, rbearing, ch_width, ascent, descent;

	gtk_init (&argc, &argv);

	fprintf (stderr, "loading %s\n", argv[1]);

	font = gdk_font_load (argv[1]);

	if (!font)
		return -1;

	fprintf (stderr, "have font\n");

	for (i = 0; i < 256; i++) {
		text[0] = i;
		gdk_text_extents (font, text, 1,
				  &lbearing, &rbearing, &ch_width, &ascent, &descent);
		printf ("char[%d] = %d %d %d %d %d\n", i,
			lbearing, rbearing, ch_width, ascent, descent);
	}

	return 0;
}



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