Re: Font Sizes



thumper plover net writes: 
buffer = gtk_text_view_get_buffer(view);
    
tag = gtk_text_tag_table_lookup(gtk_text_buffer_get_tag_table(buffer),
                                "Normal");

g_object_get(G_OBJECT(tag), "font-desc", &font_desc, NULL);
context = gtk_widget_get_pango_context(GTK_WIDGET(view));
metrics = pango_context_get_metrics(context, font_desc,
                                    pango_context_get_language(context));



And when the pango_context_get_metrics function is run, my program
dies, complaining:


glkfoo (pid:1069): ** WARNING **: Couldn't load font "monospace"
falling back to "Sans"

I have no idea what this is about. If you write up a small compilable
test case and add it to bugzilla.gnome.org I can look at it.
Are you using plain X fonts or Xft?
  
gtk is *supposed* to have object-oriented stuff, but I can't figure
out how to do simple inheritence stuff with it (mostly I just want to
add a "percent" property and replace gtk_paned_compute_position)...

Object-oriented doesn't magically mean that exactly the part of a
widget you want to override has been made virtual/protected rather
than private. To allow you to override this someone would have had to
anticipate that it was interesting to override, and no one did.
Java/C++ have a "private" keyword for a reason.

What's the recommended way to do this and not have maintenance
nightmares?  I suppose I could use lots of preprocessor stuff instead
of search-replace to make applying patches easier, but that's not much
of a solution... and having to copy an entire widget to make one minor
change doesn't seem very elegant.

I don't know of a magic solution to that in any language or toolkit,
that's just how programming works. If you want to change something
that the API hasn't anticipated wanting to change, you are kind of
hosed. Whether the API involves derivation or not is an orthogonal
issue.

You can always file an enhancement request on
http://bugzilla.gnome.org explaining what problem you are trying to
solve (i.e. give use-cases) and suggesting the new API be included in
future GTK versions. We're going to release far more often then every
three years now, we promise.

Havoc



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