Re: Problems with window position, virtual desktops and fonts



> 1. Positioning of windows

I have success calling gtk_widget_set_uposition( widget, x, y ) during
->realize(), and gdk_window_get_root_origin( widget->window, &x, &y ) during
popdown.

> 2. Show / Hide a window on the same virtual desktop
> 3. Quick way to find the best font to fill an area

Good questions, I don't know :-(

When you load a font, X will render all of the glyphs for that size (very slow).
You can speed this up a little by loading a font, measuring the sizes of each of
the characters you need, and saving the font metrics in a table somewhere.
Later, when you need to find a font size to fit a string to a width, you can
guess from your cache of metrics.

This will not work very well for accented characters, ligatures, etc. :-( I
don't know of a good way with plain X to find metrics without rendering the
font. No doubt pango fixes this (don't know).

John




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