GR_UnixPangoGraphics Class Reference

#include <gr_UnixPangoGraphics.h>

Inheritance diagram for GR_UnixPangoGraphics:

GR_Graphics GR_UnixPangoPixmapGraphics UnixNull_Graphics

List of all members.

Public Member Functions

virtual ~GR_UnixPangoGraphics ()
virtual UT_uint32 getClassId ()
virtual GR_Capability getCapability ()
virtual UT_sint32 measureUnRemappedChar (const UT_UCSChar c, UT_uint32 *height=0)
virtual void drawChars (const UT_UCSChar *pChars, int iCharOffset, int iLength, UT_sint32 xoff, UT_sint32 yoff, int *pCharWidth)
virtual void drawGlyph (UT_uint32 glyph_idx, UT_sint32 xoff, UT_sint32 yoff)
virtual UT_uint32 measureString (const UT_UCSChar *s, int iOffset, int num, UT_GrowBufElement *pWidths, UT_uint32 *height=0)
virtual GR_FontgetDefaultFont (UT_String &fontFamily, const char *pszLang)
virtual void setFont (const GR_Font *)
virtual void clearFont (void)
virtual void setZoomPercentage (UT_uint32 iZoom)
virtual bool itemize (UT_TextIterator &text, GR_Itemization &I)
virtual bool shape (GR_ShapingInfo &si, GR_RenderInfo *&ri)
virtual void prepareToRenderChars (GR_RenderInfo &ri)
virtual void renderChars (GR_RenderInfo &ri)
virtual void measureRenderedCharWidths (GR_RenderInfo &ri)
virtual void appendRenderedCharsToBuff (GR_RenderInfo &ri, UT_GrowBuf &buf) const
virtual bool canBreak (GR_RenderInfo &ri, UT_sint32 &iNext, bool bAfter)
virtual bool needsSpecialCaretPositioning (GR_RenderInfo &ri)
virtual UT_uint32 adjustCaretPosition (GR_RenderInfo &ri, bool bForward)
virtual void adjustDeletePosition (GR_RenderInfo &ri)
virtual bool nativeBreakInfoForRightEdge ()
virtual UT_sint32 resetJustification (GR_RenderInfo &ri, bool bPermanent)
virtual UT_sint32 countJustificationPoints (const GR_RenderInfo &ri) const
virtual void justify (GR_RenderInfo &ri)
virtual UT_uint32 XYToPosition (const GR_RenderInfo &ri, UT_sint32 x, UT_sint32 y) const
virtual void positionToXY (const GR_RenderInfo &ri, UT_sint32 &x, UT_sint32 &y, UT_sint32 &x2, UT_sint32 &y2, UT_sint32 &height, bool &bDirection) const
virtual UT_sint32 getTextWidth (GR_RenderInfo &ri)
virtual const UT_VersionInfogetVersion () const
virtual void setColor (const UT_RGBColor &clr)
virtual void getColor (UT_RGBColor &clr)
virtual GR_FontgetGUIFont (void)
PangoFontMap * getFontMap () const
PangoContext * getContext () const
PangoFontMap * getLayoutFontMap () const
PangoContext * getLayoutContext () const
virtual UT_uint32 getFontAscent ()
virtual UT_uint32 getFontDescent ()
virtual UT_uint32 getFontHeight ()
virtual UT_uint32 getFontAscent (const GR_Font *)
virtual UT_uint32 getFontDescent (const GR_Font *)
virtual UT_uint32 getFontHeight (const GR_Font *)
virtual void fillRect (GR_Color3D c, UT_sint32 x, UT_sint32 y, UT_sint32 w, UT_sint32 h)
virtual void fillRect (GR_Color3D c, UT_Rect &r)
virtual void polygon (UT_RGBColor &c, UT_Point *pts, UT_uint32 nPoints)
virtual void clearArea (UT_sint32, UT_sint32, UT_sint32, UT_sint32)
virtual void drawImage (GR_Image *pImg, UT_sint32 xDest, UT_sint32 yDest)
virtual void xorLine (UT_sint32, UT_sint32, UT_sint32, UT_sint32)
virtual void polyLine (UT_Point *pts, UT_uint32 nPoints)
virtual void fillRect (const UT_RGBColor &c, UT_sint32 x, UT_sint32 y, UT_sint32 w, UT_sint32 h)
virtual void invertRect (const UT_Rect *pRect)
virtual void drawLine (UT_sint32, UT_sint32, UT_sint32, UT_sint32)
bool isDingbat (void) const
bool isSymbol (void) const
virtual GR_Font_findFont (const char *pszFontFamily, const char *pszFontStyle, const char *pszFontVariant, const char *pszFontWeight, const char *pszFontStretch, const char *pszFontSize, const char *pszLang)
virtual void getCoverage (UT_NumberVector &coverage)
virtual void setLineWidth (UT_sint32)
virtual void setClipRect (const UT_Rect *pRect)
virtual UT_uint32 getDeviceResolution (void) const
virtual GR_FontgetDefaultFont (GR_Font::FontFamilyEnum f=GR_Font::FF_Roman, const char *pszLang=NULL)
int dtpu (int d) const
int ptdu (int p) const
int ptlu (int p) const
int ptlunz (int p) const
int ltpu (int l) const
int ltpunz (int l) const
int pftlu (int pf) const
virtual bool queryProperties (GR_Graphics::Properties gp) const
virtual GR_ImagecreateNewImage (const char *pszName, const UT_ByteBuf *pBB, UT_sint32 iDisplayWidth, UT_sint32 iDisplayHeight, GR_Image::GRType=GR_Image::GRT_Raster)
virtual bool startPrint (void)
virtual bool endPrint (void)
virtual bool startPage (const char *szPageLabel, UT_uint32 pageNumber, bool bPortrait, UT_uint32 iWidth, UT_uint32 iHeight)
virtual void setColorSpace (GR_Graphics::ColorSpace c)
virtual GR_Graphics::ColorSpace getColorSpace (void) const
virtual void setCursor (GR_Graphics::Cursor c)
virtual GR_Graphics::Cursor getCursor (void) const
virtual void setColor3D (GR_Color3D c)
virtual bool getColor3D (GR_Color3D name, UT_RGBColor &color)
void init3dColors (GtkStyle *pStyle)
void createPixmapFromXPM (char **pXPM, GdkPixmap *source, GdkBitmap *mask)
virtual void scroll (UT_sint32, UT_sint32)
virtual void scroll (UT_sint32 x_dest, UT_sint32 y_dest, UT_sint32 x_src, UT_sint32 y_src, UT_sint32 width, UT_sint32 height)
virtual void saveRectangle (UT_Rect &r, UT_uint32 iIndx)
virtual void restoreRectangle (UT_uint32 iIndx)
virtual GR_ImagegenImageFromRectangle (const UT_Rect &r)
virtual void setLineProperties (double inWidth, GR_Graphics::JoinStyle inJoinStyle=JOIN_MITER, GR_Graphics::CapStyle inCapStyle=CAP_BUTT, GR_Graphics::LineStyle inLineStyle=LINE_SOLID)
GdkWindow * getWindow ()

Static Public Member Functions

static UT_uint32 s_getClassId ()
static const char * graphicsDescriptor ()
static GR_GraphicsgraphicsAllocator (GR_AllocInfo &)
static const std::vector
< const char * > & 
getAllFontNames (void)
static UT_uint32 getAllFontCount ()

Protected Member Functions

 GR_UnixPangoGraphics (GdkWindow *win)
 GR_UnixPangoGraphics ()
bool _scriptBreak (GR_UnixPangoRenderInfo &ri)
virtual GdkDrawable * _getDrawable (void)
void _scaleCharacterMetrics (GR_UnixPangoRenderInfo &RI)
void _scaleJustification (GR_UnixPangoRenderInfo &RI)
UT_uint32 _measureExtent (PangoGlyphString *pg, PangoFont *pf, UT_BidiCharType iDir, const char *pUtf8, int *&pLogOffsets, UT_sint32 &iStart, UT_sint32 &iEnd)
int * _calculateLogicalOffsets (PangoGlyphString *pGlyphs, UT_BidiCharType iVisDir, const char *pUtf8)
void _setIsSymbol (bool b)
void _setIsDingbat (bool b)
void _setColor (GdkColor &c)
PangoFont * _adjustedPangoFont (GR_UnixPangoFont *pFont, PangoFont *pf)
PangoFont * _adjustedLayoutPangoFont (GR_UnixPangoFont *pFont, PangoFont *pf)
void init ()

Protected Attributes

PangoFontMap * m_pFontMap
PangoContext * m_pContext
PangoFontMap * m_pLayoutFontMap
PangoContext * m_pLayoutContext
bool m_bOwnsFontMap
GR_UnixPangoFontm_pPFont
GR_UnixPangoFontm_pPFontGUI
PangoFont * m_pAdjustedPangoFont
PangoFont * m_pAdjustedLayoutPangoFont
GR_UnixPangoFontm_pAdjustedPangoFontSource
UT_uint32 m_iAdjustedPangoFontZoom
UT_uint32 m_iDeviceResolution
GdkWindow * m_pWin
GdkGC * m_pGC
GdkGC * m_pXORGC
GdkColormap * m_pColormap
int m_iWindowHeight
int m_iWindowWidth
UT_sint32 m_iLineWidth
GR_Graphics::Cursor m_cursor
GR_Graphics::ColorSpace m_cs
GdkColor m_3dColors [COUNT_3D_COLORS]
Drawable m_Drawable
Visual * m_pVisual
Colormap m_Colormap
UT_GenericVector< UT_Rect * > m_vSaveRect
UT_GenericVector< GdkPixbuf * > m_vSaveRectBuf
XftDraw * m_pXftDraw
XftColor m_XftColor
UT_RGBColor m_curColor
UT_sint32 m_iXoff
UT_sint32 m_iYoff
bool m_bIsSymbol
bool m_bIsDingbat

Static Private Attributes

static UT_uint32 s_iInstanceCount = 0
static UT_VersionInfo s_Version
static int s_iMaxScript = 0

Friends

class GR_UnixImage


Constructor & Destructor Documentation

GR_UnixPangoGraphics::~GR_UnixPangoGraphics (  )  [virtual]

GR_UnixPangoGraphics::GR_UnixPangoGraphics ( GdkWindow *  win  )  [protected]

References init().

GR_UnixPangoGraphics::GR_UnixPangoGraphics (  )  [protected]

References init().

Referenced by graphicsAllocator().


Member Function Documentation

static UT_uint32 GR_UnixPangoGraphics::s_getClassId (  )  [inline, static]

virtual UT_uint32 GR_UnixPangoGraphics::getClassId (  )  [inline, virtual]

Reimplemented from GR_Graphics.

Reimplemented in UnixNull_Graphics, and GR_UnixPangoPixmapGraphics.

References GR_Graphics::s_getClassId().

virtual GR_Capability GR_UnixPangoGraphics::getCapability (  )  [inline, virtual]

Reimplemented from GR_Graphics.

Reimplemented in UnixNull_Graphics.

References GRCAP_SCREEN_ONLY.

static const char* GR_UnixPangoGraphics::graphicsDescriptor ( void   )  [inline, static]

GR_Graphics * GR_UnixPangoGraphics::graphicsAllocator ( GR_AllocInfo info  )  [static]

UT_sint32 GR_UnixPangoGraphics::measureUnRemappedChar ( const UT_UCSChar  c,
UT_uint32 height = 0 
) [virtual]

Implements GR_Graphics.

References measureString().

void GR_UnixPangoGraphics::drawChars ( const UT_UCSChar pChars,
int  iCharOffset,
int  iLength,
UT_sint32  xoff,
UT_sint32  yoff,
int *  pCharWidth 
) [virtual]

void GR_UnixPangoGraphics::drawGlyph ( UT_uint32  glyph_idx,
UT_sint32  xoff,
UT_sint32  yoff 
) [virtual]

Implements GR_Graphics.

References drawChars().

UT_uint32 GR_UnixPangoGraphics::measureString ( const UT_UCSChar s,
int  iOffset,
int  num,
UT_GrowBufElement pWidths,
UT_uint32 height = 0 
) [virtual]

GR_Font * GR_UnixPangoGraphics::getDefaultFont ( UT_String fontFamily,
const char *  pszLang 
) [virtual]

void GR_UnixPangoGraphics::setFont ( const GR_Font pFont  )  [virtual]

virtual void GR_UnixPangoGraphics::clearFont ( void   )  [inline, virtual]

Implements GR_Graphics.

void GR_UnixPangoGraphics::setZoomPercentage ( UT_uint32  iZoom  )  [virtual]

bool GR_UnixPangoGraphics::itemize ( UT_TextIterator text,
GR_Itemization I 
) [virtual]

bool GR_UnixPangoGraphics::shape ( GR_ShapingInfo si,
GR_RenderInfo *&  ri 
) [virtual]

void GR_UnixPangoGraphics::prepareToRenderChars ( GR_RenderInfo ri  )  [virtual]

Do any pre-processing that might be needed for rendering our text (This function is guaranteed to be called just before renderChars(), but where drawing of a single RI item is done inside of a loop, e.g., drawing the different segments of partially selected run, this function can be take out of the loop.)

Reimplemented from GR_Graphics.

References _scaleCharacterMetrics(), GR_RenderInfo::getType(), GR_Graphics::getZoomPercentage(), GRRI_UNIX_PANGO, and UT_return_if_fail.

void GR_UnixPangoGraphics::renderChars ( GR_RenderInfo ri  )  [virtual]

void GR_UnixPangoGraphics::measureRenderedCharWidths ( GR_RenderInfo ri  )  [virtual]

This function is called after shaping and before any operations are done on the glyphs. Although Pango does not have a separate character placement stage, we need to scale the glyph metrics to appropriate zoom level (since we shape % zoom).

NB: this is probably not ideal with int arithmetic as moving from one zoom to another, and back we are bound to end up with incorrect metrics due to rounding errors.

Reimplemented from GR_Graphics.

References _scaleCharacterMetrics(), _scaleJustification(), GR_RenderInfo::getType(), GRRI_UNIX_PANGO, and UT_return_if_fail.

void GR_UnixPangoGraphics::appendRenderedCharsToBuff ( GR_RenderInfo ri,
UT_GrowBuf buf 
) const [virtual]

Reimplemented from GR_Graphics.

References UT_NOT_IMPLEMENTED, and UT_return_if_fail.

bool GR_UnixPangoGraphics::canBreak ( GR_RenderInfo ri,
UT_sint32 iNext,
bool  bAfter 
) [virtual]

bool GR_UnixPangoGraphics::needsSpecialCaretPositioning ( GR_RenderInfo ri  )  [virtual]

Reimplemented from GR_Graphics.

UT_uint32 GR_UnixPangoGraphics::adjustCaretPosition ( GR_RenderInfo ri,
bool  bForward 
) [virtual]

void GR_UnixPangoGraphics::adjustDeletePosition ( GR_RenderInfo ri  )  [virtual]

virtual bool GR_UnixPangoGraphics::nativeBreakInfoForRightEdge (  )  [inline, virtual]

Reimplemented from GR_Graphics.

UT_sint32 GR_UnixPangoGraphics::resetJustification ( GR_RenderInfo ri,
bool  bPermanent 
) [virtual]

I believe this code clears all the justification points. MES June 2008 It returns the total space assigned to justify the text in layout units.

Reimplemented from GR_Graphics.

References _scaleCharacterMetrics(), GR_RenderInfo::getType(), GRRI_UNIX_PANGO, ptlunz(), and UT_return_val_if_fail.

UT_sint32 GR_UnixPangoGraphics::countJustificationPoints ( const GR_RenderInfo ri  )  const [virtual]

void GR_UnixPangoGraphics::justify ( GR_RenderInfo ri  )  [virtual]

We take the same approach as with Uniscribe; we store the justification amount in a separate array of the ri and add it to the offsets before we draw. We will probably need some static buffers to speed things up

It requires as input RI.m_iJustificationAmount and RI.m_iJustificationPoints. These are determined in fp_TextRun using calculations in layout units

Reimplemented from GR_Graphics.

References _scaleCharacterMetrics(), UT_TextIterator::getChar(), UT_TextIterator::getStatus(), GR_RenderInfo::getType(), GRRI_UNIX_PANGO, ltpunz(), text, UCS_SPACE, UT_BIDI_LTR, UT_BIDI_RTL, UT_return_if_fail, UTIter_OK, and xxx_UT_DEBUGMSG.

UT_uint32 GR_UnixPangoGraphics::XYToPosition ( const GR_RenderInfo ri,
UT_sint32  x,
UT_sint32  y 
) const [virtual]

void GR_UnixPangoGraphics::positionToXY ( const GR_RenderInfo ri,
UT_sint32 x,
UT_sint32 y,
UT_sint32 x2,
UT_sint32 y2,
UT_sint32 height,
bool &  bDirection 
) const [virtual]

UT_sint32 GR_UnixPangoGraphics::getTextWidth ( GR_RenderInfo ri  )  [virtual]

virtual const UT_VersionInfo& GR_UnixPangoGraphics::getVersion (  )  const [inline, virtual]

Reimplemented from GR_Graphics.

void GR_UnixPangoGraphics::setColor ( const UT_RGBColor clr  )  [virtual]

void GR_UnixPangoGraphics::getColor ( UT_RGBColor clr  )  [virtual]

Implements GR_Graphics.

Reimplemented in UnixNull_Graphics.

References m_curColor.

GR_Font * GR_UnixPangoGraphics::getGUIFont ( void   )  [virtual]

PangoFontMap* GR_UnixPangoGraphics::getFontMap (  )  const [inline]

Referenced by shape().

PangoContext* GR_UnixPangoGraphics::getContext (  )  const [inline]

PangoFontMap* GR_UnixPangoGraphics::getLayoutFontMap (  )  const [inline]

PangoContext* GR_UnixPangoGraphics::getLayoutContext (  )  const [inline]

UT_uint32 GR_UnixPangoGraphics::getFontAscent (  )  [virtual]

Implements GR_Graphics.

References m_pPFont.

Referenced by drawChars(), and renderChars().

UT_uint32 GR_UnixPangoGraphics::getFontDescent (  )  [virtual]

Implements GR_Graphics.

References m_pPFont.

UT_uint32 GR_UnixPangoGraphics::getFontHeight (  )  [virtual]

UT_uint32 GR_UnixPangoGraphics::getFontAscent ( const GR_Font pFont  )  [virtual]

UT_uint32 GR_UnixPangoGraphics::getFontDescent ( const GR_Font pFont  )  [virtual]

UT_uint32 GR_UnixPangoGraphics::getFon