Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes

GR_Win32Font Class Reference

#include <gr_Win32Graphics.h>

Inheritance diagram for GR_Win32Font:
GR_Font GR_Win32USPFont

List of all members.

Classes

struct  allocFont

Public Member Functions

virtual ~GR_Win32Font ()
void setAscent (UT_uint32 n)
void setDescent (UT_uint32 n)
void setHeight (UT_uint32 n)
UT_uint32 getAscent (HDC hdc, HDC printHDC)
UT_uint32 getDescent (HDC hdc, HDC printHDC)
UT_uint32 getHeight (HDC hdc, HDC printHDC)
UT_uint32 getUnscaledHeight () const
HFONT getDisplayFont (GR_Graphics *pGr)
virtual UT_sint32 measureUnremappedCharForCache (UT_UCSChar cChar) const
UT_sint32 measureUnRemappedChar (UT_UCSChar c, UT_uint32 *height=0)
virtual GR_CharWidthsnewFontWidths (void) const
virtual bool glyphBox (UT_UCS4Char g, UT_Rect &rec, GR_Graphics *pG)
void selectFontIntoDC (GR_Graphics *pGr, HDC hdc)
void markGUIFont ()
bool isFontGUI () const
HDC getPrimaryHDC () const
HDC getXHDC () const
HDC getYHDC () const
void setPrimaryHDC (HDC hdc)
void setXHDC (HDC hdc)
void setYHDC (HDC hdc)
HFONT getFontHandle () const
double getPointSize () const
HFONT getFontFromCache (UT_uint32 pixelsize, bool bIsLayout, UT_uint32 zoomPercentage) const
void fetchFont (UT_uint32 pixelsize) const
const TEXTMETRICW & getTextMetric () const

Static Public Member Functions

static GR_Win32FontnewFont (LOGFONTW &lf, double fPoints, HDC hdc, HDC printDC)

Protected Member Functions

 GR_Win32Font (LOGFONTW &lf, double fPoints, HDC hdc, HDC printHDC)
GR_Win32CharWidths_getCharWidths () const
virtual void _clearAnyCachedInfo ()
void _updateFontYMetrics (HDC hdc, HDC printHDC)

Private Member Functions

void insertFontInCache (UT_uint32 pixelsize, HFONT pFont) const

Private Attributes

HDC m_hdc
HDC m_xhdc
HDC m_yhdc
UT_uint32 m_defaultCharWidth
HFONT m_layoutFont
TEXTMETRICW m_tm
UT_uint32 m_iHeight
UT_Vector m_allocFonts
bool m_bGUIFont
double m_fPointSize

Constructor & Destructor Documentation

GR_Win32Font::GR_Win32Font ( LOGFONTW &  lf,
double  fPoints,
HDC  hdc,
HDC  printHDC 
) [protected]

Member Function Documentation

virtual void GR_Win32Font::_clearAnyCachedInfo (  )  [inline, protected, virtual]

Reimplemented in GR_Win32USPFont.

GR_Win32CharWidths* GR_Win32Font::_getCharWidths (  )  const [inline, protected]
void GR_Win32Font::_updateFontYMetrics ( HDC  hdc,
HDC  printHDC 
) [protected]

hdc -- handle to the primary DC on which we draw printHDC -- handle to the DC on which we want to measure the font (typically the printer) can be NULL (in which case hdc will be used

NB: the caller must ensure that the corresponding HFONT is already selected onto the DC represented by printHDC (or hdc if NULL).

References GR_Graphics::getResolution(), m_tm, m_yhdc, and UT_return_if_fail.

Referenced by getAscent(), getDescent(), getHeight(), and GR_Win32Font().

void GR_Win32Font::fetchFont ( UT_uint32  pixelsize  )  const
UT_uint32 GR_Win32Font::getAscent ( HDC  hdc,
HDC  printHDC 
)

hdc - handle to device context for which the measurment is required

References _updateFontYMetrics(), m_bGUIFont, and m_tm.

Referenced by GR_Win32USPGraphics::getFontAscent(), and GR_Win32Graphics::getFontAscent().

UT_uint32 GR_Win32Font::getDescent ( HDC  hdc,
HDC  printHDC 
)

hdc - handle to device context for which the measurment is required

References _updateFontYMetrics(), m_bGUIFont, and m_tm.

Referenced by GR_Win32USPGraphics::getFontDescent(), and GR_Win32Graphics::getFontDescent().

HFONT GR_Win32Font::getFontHandle (  )  const [inline]
UT_uint32 GR_Win32Font::getHeight ( HDC  hdc,
HDC  printHDC 
)

hdc - handle to device context for which the measurment is required

References _updateFontYMetrics(), m_bGUIFont, and m_tm.

Referenced by GR_Win32USPGraphics::getFontHeight(), and GR_Win32Graphics::getFontHeight().

HDC GR_Win32Font::getPrimaryHDC (  )  const [inline]
const TEXTMETRICW& GR_Win32Font::getTextMetric (  )  const [inline]
UT_uint32 GR_Win32Font::getUnscaledHeight (  )  const [inline]
HDC GR_Win32Font::getXHDC (  )  const [inline]
HDC GR_Win32Font::getYHDC (  )  const [inline]
bool GR_Win32Font::glyphBox ( UT_UCS4Char  g,
UT_Rect rec,
GR_Graphics pG 
) [virtual]

UT_Rect of glyph in Logical units. rec.left = bearing Left (distance from origin to start) rec.width = width of the glyph rec.top = distance from the origin to the top of the glyph rec.height = total height of the glyph

This function will only work on win NT -- check the return value before doing anything with the rectangle (win9x implementation would have to use GetGlyphOutlineA() and convert the UT_UCS4Char to an appropriate ansi value

Implements GR_Font.

References fetchFont(), GR_Font::getAllocNumber(), getFontFromCache(), GR_Win32Graphics::getPrimaryDC(), getPrimaryHDC(), GR_Win32Graphics::getPrintDC(), GR_Graphics::getResolution(), getUnscaledHeight(), UT_Rect::height, UT_Rect::left, m_bGUIFont, m_fPointSize, GR_Win32Graphics::setDCFontAllocNo(), GR_Win32Graphics::setPrintDCFontAllocNo(), UT_Rect::top, UT_DEBUGMSG, UT_IsWinNT(), UT_return_val_if_fail, and UT_Rect::width.

void GR_Win32Font::insertFontInCache ( UT_uint32  pixelsize,
HFONT  pFont 
) const [private]
bool GR_Win32Font::isFontGUI (  )  const [inline]
void GR_Win32Font::markGUIFont (  )  [inline]
GR_Win32Font * GR_Win32Font::newFont ( LOGFONTW &  lf,
double  fPoints,
HDC  hdc,
HDC  printDC 
) [static]

Reimplemented in GR_Win32USPFont.

References getFontHandle(), and GR_Win32Font().

Referenced by GR_Win32Graphics::_newFont().

GR_CharWidths * GR_Win32Font::newFontWidths ( void   )  const [virtual]

Implements a GR_CharWidths. Override if you which to instanciate a subclass.

Reimplemented from GR_Font.

References UT_NOT_IMPLEMENTED, and UT_return_val_if_fail.

void GR_Win32Font::selectFontIntoDC ( GR_Graphics pGr,
HDC  hdc 
)
void GR_Win32Font::setAscent ( UT_uint32  n  )  [inline]
void GR_Win32Font::setDescent ( UT_uint32  n  )  [inline]
void GR_Win32Font::setHeight ( UT_uint32  n  )  [inline]
void GR_Win32Font::setPrimaryHDC ( HDC  hdc  )  [inline]
void GR_Win32Font::setXHDC ( HDC  hdc  )  [inline]
void GR_Win32Font::setYHDC ( HDC  hdc  )  [inline]

Member Data Documentation

double GR_Win32Font::m_fPointSize [private]

Referenced by glyphBox().

HDC GR_Win32Font::m_hdc [private]

Referenced by ~GR_Win32Font().

HDC GR_Win32Font::m_xhdc [private]

Referenced by GR_Win32Font().

HDC GR_Win32Font::m_yhdc [private]

The documentation for this class was generated from the following files: