Module: wine Branch: master Commit: dea3745eb8ed1b96f54e10bc097396e2fe524760 URL: http://source.winehq.org/git/wine.git/?a=commit;h=dea3745eb8ed1b96f54e10bc09...
Author: Huw Davies huw@codeweavers.com Date: Thu Apr 22 10:11:07 2010 +0100
wineps.drv: Defer accessing the font metrics until we really need them.
---
dlls/wineps.drv/download.c | 33 ++++++++++++--------------------- 1 files changed, 12 insertions(+), 21 deletions(-)
diff --git a/dlls/wineps.drv/download.c b/dlls/wineps.drv/download.c index bf9cb09..a6ab9d0 100644 --- a/dlls/wineps.drv/download.c +++ b/dlls/wineps.drv/download.c @@ -196,29 +196,9 @@ static BOOL get_bbox(HDC hdc, RECT *rc, UINT *emsize) */ BOOL PSDRV_SelectDownloadFont(PSDRV_PDEVICE *physDev) { - char *ps_name; - LPOUTLINETEXTMETRICA potm; - DWORD len = GetOutlineTextMetricsA(physDev->hdc, 0, NULL); - - if(!len) return FALSE; - potm = HeapAlloc(GetProcessHeap(), 0, len); - GetOutlineTextMetricsA(physDev->hdc, len, potm); - get_download_name(physDev, potm, &ps_name); - physDev->font.fontloc = Download; - physDev->font.fontinfo.Download = is_font_downloaded(physDev, ps_name); + physDev->font.fontinfo.Download = NULL;
- physDev->font.size = abs(PSDRV_YWStoDS(physDev, /* ppem */ - potm->otmTextMetrics.tmAscent + - potm->otmTextMetrics.tmDescent - - potm->otmTextMetrics.tmInternalLeading)); - physDev->font.underlineThickness = potm->otmsUnderscoreSize; - physDev->font.underlinePosition = potm->otmsUnderscorePosition; - physDev->font.strikeoutThickness = potm->otmsStrikeoutSize; - physDev->font.strikeoutPosition = potm->otmsStrikeoutPosition; - - HeapFree(GetProcessHeap(), 0, ps_name); - HeapFree(GetProcessHeap(), 0, potm); return TRUE; }
@@ -241,6 +221,17 @@ BOOL PSDRV_WriteSetDownloadFont(PSDRV_PDEVICE *physDev) GetOutlineTextMetricsA(physDev->hdc, len, potm);
get_download_name(physDev, potm, &ps_name); + physDev->font.fontinfo.Download = is_font_downloaded(physDev, ps_name); + + physDev->font.size = abs(PSDRV_YWStoDS(physDev, /* ppem */ + potm->otmTextMetrics.tmAscent + + potm->otmTextMetrics.tmDescent - + potm->otmTextMetrics.tmInternalLeading)); + physDev->font.underlineThickness = potm->otmsUnderscoreSize; + physDev->font.underlinePosition = potm->otmsUnderscorePosition; + physDev->font.strikeoutThickness = potm->otmsStrikeoutSize; + physDev->font.strikeoutPosition = potm->otmsStrikeoutPosition; +
if(physDev->font.fontinfo.Download == NULL) { RECT bbox;