Re: [gtkmm] Two optional return values in pango functions: what to do?



At Sat, 7 Sep 2002 11:03:25 +0200,
Martin Schulze wrote:
> 
> Am 06.09.2002 23:14 schrieb(en) Naofumi Yasufuku:
> > At Fri, 6 Sep 2002 22:39:11 +0200,
> > Martin Schulze wrote:
> > >
> > > So far only for one pango function this has been completely implemented
> > in
> > > pangomm: There are three wrapper functions for
> > > pango_font_get_glyph_extents:
> > >
> > > 1) void Font::get_glyph_extents(Glyph glyph, Rectangle& ink_rect,
> > > Rectangle& logical_rect)
> > > 2) void Font::get_glyph_extents_ink_rect_only (Glyph glyph, Rectangle&
> > > ink_rect)
> > > 3) void Font::get_glyph_extents_logical_rect_only (Glyph glyph,
> > Rectangle&
> > > logical_rect)
> > >
> > > So the return values are really optional here.
> > >
> > > For other funtions, like GlyphString::extents(), that also return two
> > > rectangles we only have 1). Now, in my opinion, it would be an overkill
> > to
> > > add 2) and 3) for every such function. E.g. GlyphString::extents()
> > already
> > > has an overload because some parameters are optional. If we added 2)
> > and 3)
> > > for both overloads, we would have 6 functions in the whole that wrap
> > the
> > > same
> > > single pango function.
> > >
> > > On the other hand, if people agreed that it isn't desirable to add 2)
> > and
> > > 3)
> > > whereever possible, I would want to know whether anyone has some need
> > for
> > > the
> > > existing functions 2) and 3) in Pango::Font. Otherwise, I would just
> > remove
> > > them to be consistent with the other wrapper functions that only have
> > 1).
> > >
> > 
> > I think pango_font_get_glyph_extents() means that
> > 
> >  I.   Programmers can get the ink extents of a glyph within a font.
> > 
> >     Rectangle Font::get_glyph_ink_extents(Glyph glyph)
> > 
> >  II.  Programmers can get the logical extents of a glyph within a font.
> > 
> >     Rectangle Font::get_glyph_logical_extents(Glyph glyph)
> > 
> >  III. Programmers can also get both extents at once.
> > 
> >     void Font::get_glyph_extents(Glyph glyph,
> >                                  Rectangle& ink_rect,
> >                                  Rectangle& logocal_rect)
> > 
> > 
> > Regards,
> > --Naofumi
> > 
> 
> So you do want this convenient interface for each function that has two
> return values?
> 

Yes. I think it would be a clear API.

Regards,
--Naofumi



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