After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 97036 - Gdk::Drawable::draw_glyphs() uses a C type.
Gdk::Drawable::draw_glyphs() uses a C type.
Status: RESOLVED FIXED
Product: gtkmm
Classification: Bindings
Component: general
2.4
Other Linux
: Normal minor
: 3
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2002-10-28 16:25 UTC by Morus Walter
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Morus Walter 2002-10-28 16:25:12 UTC
(from my mail to the mailing list)

I would like to make two aditional remarks on the methods I used
for low level text rendering:

- the method Gdk::Drawable::draw_glyphs, which is used for low level
  text rendering, takes a c pointer PangoGlyphString* glyphs instead of
  a Pango::GlyphString object.
  This is not a problem since one can use the gobj method of
  Pango::GlyphStringto get the c pointer from the object, but it looks
  a bit inconsistent to me.

  void  draw_glyphs (const Glib::RefPtr<const GC>& gc, 
  const Glib::RefPtr<const Pango::Font>& font, int x, int y, 
  PangoGlyphString* glyphs)

- similar point for pango_shape where no c++ wrapper exists.
  Again one can use the c function directly by using the gobj methods.

  void pango_shape (const gchar      *text,
                    gint              length,
                    PangoAnalysis    *analysis,
                    PangoGlyphString *glyphs);

Of course both functions are needed for low level text rendering with pango 
only and this is rather esoteric and discouraged for most uses anyway.

So I wouldn't mind, if you decide not to do anything about this.
Comment 1 Morus Walter 2002-10-28 19:25:22 UTC
As Martin Schulze pointed out in the mailing list, I was wrong
about the missing pango_shape wrapper.
It's a shape mathod for Pango::Item.

Sorry.
Morus
Comment 2 Murray Cumming 2002-10-30 10:27:08 UTC
In

void draw_glyphs (const Glib::RefPtr<const GC>& gc, 
  const Glib::RefPtr<const Pango::Font>& font, int x, int y, 
  PangoGlyphString* glyphs)

The glyphs parameter is an _array_, not a single instance. The C
documentation suggests that it's difficult to get such an array:
http://developer.gnome.org/doc/API/2.0/gdk/gdk-drawing-primitives.html#gdk-draw-glyphs
and says that this is a very low-level function.
And this documentation is reused in gtkmm's reference docs:
http://www.gtkmm.org/gtkmm2/docs/reference/html/classGdk_1_1Drawable.html#a19

So, unless someone can suggest how it might be improved, I will close
this bug.
Comment 3 Daniel Elstner 2002-10-30 15:58:49 UTC
The documentation of gdk_draw_glyphs() sounds complicated, but it
really isn't -- at least from a narrow-minded lets-wrap-this-function
point of view ;)

The glyphs parameter itself is _not_ an array.  What they probably
mean is that PangoGlyphString contains an array of glyphs, just like a
C-string really is an array of char.  But unlike char*,
PangoGlyphString is a self-contained struct we don't have to know
anything about in order to wrap it.

It becomes clearer by looking at the PangoGlyphString docs:
http://developer.gnome.org/doc/API/2.0/pango/pango-glyph-storage.html#PangoGlyphString

From that you can see that the PangoGlyphString struct takes care of
the array of glyphs.  So all we have to do is defining a
Pango::GlyphString to PangoGlyphString* conversion (if it doesn't
exists already) and use it in _WRAP_METHOD().  Business as usual.

Well, one for 2.2.

--Daniel
Comment 4 Murray Cumming 2002-10-31 11:58:48 UTC
OK, thanks for the explanation. Awaiting a patch for a future
API-break maybe 2.2. or 2.4.
Comment 5 Murray Cumming 2004-01-12 12:30:44 UTC
Now would be a good time to submit a patch. We must freeze the API soon.
Comment 6 Bryan Forbes 2004-02-11 20:18:56 UTC
Commited in cvs.