#include <gr_Win32Graphics.h>
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_CharWidths * | newFontWidths (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_Win32Font * | newFont (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 |
GR_Win32Font::~GR_Win32Font | ( | ) | [virtual] |
GR_Win32Font::GR_Win32Font | ( | LOGFONTW & | lf, | |
double | fPoints, | |||
HDC | hdc, | |||
HDC | printHDC | |||
) | [protected] |
hdc - the primary hdc on which we are expected to draw printHDC - the hdc for which to retrive metrics
References _getCharWidths(), _updateFontYMetrics(), d, GR_Font::getCharWidthFromCache(), insertFontInCache(), LOG_WIN32_EXCPT, m_defaultCharWidth, GR_Font::m_hashKey, m_iHeight, m_layoutFont, m_tm, m_xhdc, m_yhdc, GR_Win32CharWidths::setCharWidthsOfRange(), UT_return_if_fail, and UT_std_string_sprintf().
Referenced by newFont().
virtual void GR_Win32Font::_clearAnyCachedInfo | ( | ) | [inline, protected, virtual] |
Reimplemented in GR_Win32USPFont.
GR_Win32CharWidths* GR_Win32Font::_getCharWidths | ( | ) | const [inline, protected] |
Reimplemented from GR_Font.
References GR_Font::_getCharWidths(), UT_NOT_IMPLEMENTED, and UT_return_val_if_fail.
Referenced by GR_Win32Font(), and measureUnremappedCharForCache().
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 |
References insertFontInCache(), and m_layoutFont.
Referenced by GR_Win32USPGraphics::_setupFontOnDC(), getDisplayFont(), and glyphBox().
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::getDisplayFont | ( | GR_Graphics * | pGr | ) |
References fetchFont(), getFontFromCache(), GR_Graphics::getZoomPercentage(), m_bGUIFont, and m_iHeight.
Referenced by GR_Win32Graphics::drawChar(), GR_Win32Graphics::drawChars(), and selectFontIntoDC().
HFONT GR_Win32Font::getFontHandle | ( | ) | const [inline] |
Referenced by GR_Win32Graphics::drawChar(), GR_Win32USPFont::newFont(), and newFont().
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().
double GR_Win32Font::getPointSize | ( | ) | const [inline] |
HDC GR_Win32Font::getPrimaryHDC | ( | ) | const [inline] |
Referenced by glyphBox(), and GR_Win32Graphics::setFont().
const TEXTMETRICW& GR_Win32Font::getTextMetric | ( | ) | const [inline] |
Referenced by GR_Win32USPGraphics::renderChars().
UT_uint32 GR_Win32Font::getUnscaledHeight | ( | ) | const [inline] |
Referenced by GR_Win32USPGraphics::_setupFontOnDC(), and glyphBox().
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] |
References GR_Win32Font::allocFont::hFont, m_allocFonts, GR_Win32Font::allocFont::pixelSize, and UT_GenericVector< T >::push_back().
Referenced by fetchFont(), and GR_Win32Font().
bool GR_Win32Font::isFontGUI | ( | ) | const [inline] |
Referenced by GR_Win32USPGraphics::_setupFontOnDC().
void GR_Win32Font::markGUIFont | ( | ) | [inline] |
Referenced by GR_Win32Graphics::getGUIFont().
UT_sint32 GR_Win32Font::measureUnRemappedChar | ( | UT_UCSChar | c, | |
UT_uint32 * | height = 0 | |||
) |
References GR_Font::getCharWidthFromCache(), UCS_LIGATURE_PLACEHOLDER, UT_NOT_IMPLEMENTED, and UT_return_val_if_fail.
Referenced by GR_Win32Graphics::measureUnRemappedChar().
UT_sint32 GR_Win32Font::measureUnremappedCharForCache | ( | UT_UCSChar | cChar | ) | const [virtual] |
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 | |||
) |
References getDisplayFont(), and UT_ASSERT_HARMLESS.
Referenced by GR_Win32Graphics::drawChar(), and GR_Win32Graphics::setFont().
void GR_Win32Font::setAscent | ( | UT_uint32 | n | ) | [inline] |
Referenced by GR_Win32USPGraphics::measureRenderedCharWidths().
void GR_Win32Font::setDescent | ( | UT_uint32 | n | ) | [inline] |
Referenced by GR_Win32USPGraphics::measureRenderedCharWidths().
void GR_Win32Font::setHeight | ( | UT_uint32 | n | ) | [inline] |
Referenced by GR_Win32USPGraphics::measureRenderedCharWidths().
void GR_Win32Font::setPrimaryHDC | ( | HDC | hdc | ) | [inline] |
void GR_Win32Font::setXHDC | ( | HDC | hdc | ) | [inline] |
void GR_Win32Font::setYHDC | ( | HDC | hdc | ) | [inline] |
UT_Vector GR_Win32Font::m_allocFonts [mutable, private] |
Referenced by getFontFromCache(), insertFontInCache(), and ~GR_Win32Font().
bool GR_Win32Font::m_bGUIFont [private] |
Referenced by getAscent(), getDescent(), getDisplayFont(), getHeight(), and glyphBox().
UT_uint32 GR_Win32Font::m_defaultCharWidth [private] |
Referenced by GR_Win32Font().
double GR_Win32Font::m_fPointSize [private] |
Referenced by glyphBox().
HDC GR_Win32Font::m_hdc [private] |
Referenced by ~GR_Win32Font().
UT_uint32 GR_Win32Font::m_iHeight [private] |
Referenced by getDisplayFont(), and GR_Win32Font().
HFONT GR_Win32Font::m_layoutFont [private] |
Referenced by fetchFont(), GR_Win32Font(), and measureUnremappedCharForCache().
TEXTMETRICW GR_Win32Font::m_tm [private] |
Referenced by _updateFontYMetrics(), getAscent(), getDescent(), getHeight(), and GR_Win32Font().
HDC GR_Win32Font::m_xhdc [private] |
Referenced by GR_Win32Font().
HDC GR_Win32Font::m_yhdc [private] |
Referenced by _updateFontYMetrics(), and GR_Win32Font().