Question for C++ guru's..

From: <msevior_at_physics.unimelb.edu.au>
Date: Tue Dec 26 2006 - 04:21:19 CET

Hi everyone,
            After a little investigating I found that the reason printing
on unix is not working right is because the virtual methods
are called.
GR_UnixPangoGraphics is defined with this inheritence..

class ABI_EXPORT GR_UnixPangoGraphics : public GR_UnixGraphics

and has these methods..

        virtual UT_uint32 getFontAscent(GR_Font *);
        virtual UT_uint32 getFontDescent(GR_Font *);
        virtual UT_uint32 getFontHeight(GR_Font *);

XAP_UnixGnomePrintGraphics is defined this way

class XAP_UnixGnomePrintGraphics : public GR_Graphics

has the same virtual methods..

        virtual UT_uint32 getFontAscent(GR_Font *);
        virtual UT_uint32 getFontDescent(GR_Font *);
        virtual UT_uint32 getFontHeight(GR_Font *);

Now the constructor of XAP_UnixGnomePrintGraphics also contonstructs
GR_UnixPangoGraphics, then in fp_Run.cpp::_inheritProperties we calculate
the height of the run with this call...

                       _setHeight(getGraphics()->getFontHeight(pFont));

Which resolves to

GR_UnixPangoGraphics::getFontHeight(GR_Font *)

and not to

XAP_UnixGnomePrintGraphics::getFontHeight(GR_Font *)

Which is why the line spacing when printing is wrong.

Do any of our C++ guru's know what is going on and how to fix it?

Cheers

Martin
Received on Tue Dec 26 04:21:57 2006

This archive was generated by hypermail 2.1.8 : Tue Dec 26 2006 - 04:21:58 CET