Text-View width
- From: Alberto Manuel Brandao Simoes <albie alfarrabio di uminho pt>
- To: GTK-List <gtk-list gnome org>
- Subject: Text-View width
- Date: Sat, 12 Jan 2002 12:27:01 +0000
Hi!
Like Havoc suggestion, I've made:
gint console_view_get_width(ConsoleView *self, GtkTextTag *tag)
{
PangoFontDescription *fdesc;
PangoFontMetrics *metrics;
PangoContext *context;
GtkWidget *widget;
GValue *value;
int char_width;
int width_in_chars;
widget = GTK_WIDGET(self->text_view);
context = gtk_widget_get_pango_context (widget);
g_object_get(tag, "font-desc", fdesc, NULL);
metrics = pango_context_get_metrics (context, fdesc,
pango_context_get_language (context));
char_width = pango_font_metrics_get_approximate_char_width (metrics);
width_in_chars = widget->allocation.width / char_width;
return width_in_chars;
}
But, here's something wrong. The fdesc variable does not contain a correct
font Description!
Cheers
Alberto
--
f u cn rd ths, u cn gt a gd jb n cmptr prgrmmng.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]