Now filling external leading in font cells.

This commit is contained in:
Eric Pouech 2005-11-03 09:51:00 +00:00 committed by Alexandre Julliard
parent 753e4ee9bd
commit 8ad685c5b3
3 changed files with 22 additions and 5 deletions

View File

@ -432,7 +432,7 @@ static BOOL select_font(struct dialog_info* di)
WCUSER_FillLogFont(&lf, di->font[size_idx].faceName, WCUSER_FillLogFont(&lf, di->font[size_idx].faceName,
di->font[size_idx].height, di->font[size_idx].weight); di->font[size_idx].height, di->font[size_idx].weight);
hFont = WCUSER_CopyFont(&config, PRIVATE(di->data)->hWnd, &lf); hFont = WCUSER_CopyFont(&config, PRIVATE(di->data)->hWnd, &lf, NULL);
if (!hFont) return FALSE; if (!hFont) return FALSE;
if (config.cell_height != di->font[size_idx].height) if (config.cell_height != di->font[size_idx].height)
@ -571,7 +571,7 @@ static BOOL WINAPI WCUSER_FontDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM
WCUSER_FillLogFont(&lf, di->font[val].faceName, WCUSER_FillLogFont(&lf, di->font[val].faceName,
di->font[val].height, di->font[val].weight); di->font[val].height, di->font[val].weight);
DeleteObject(WCUSER_CopyFont(&di->config, DeleteObject(WCUSER_CopyFont(&di->config,
PRIVATE(di->data)->hWnd, &lf)); PRIVATE(di->data)->hWnd, &lf, NULL));
} }
val = (GetWindowLong(GetDlgItem(hDlg, IDC_FNT_COLOR_BK), 0) << 4) | val = (GetWindowLong(GetDlgItem(hDlg, IDC_FNT_COLOR_BK), 0) << 4) |

View File

@ -50,6 +50,8 @@ static void WCUSER_FillMemDC(const struct inner_data* data, int upd_tp, int upd_
HFONT hOldFont; HFONT hOldFont;
WORD attr; WORD attr;
WCHAR* line; WCHAR* line;
RECT r;
HBRUSH hbr;
/* no font has been set up yet, don't worry about filling the bitmap, /* no font has been set up yet, don't worry about filling the bitmap,
* we'll do it once a font is chosen * we'll do it once a font is chosen
@ -77,6 +79,16 @@ static void WCUSER_FillMemDC(const struct inner_data* data, int upd_tp, int upd_
} }
TextOut(PRIVATE(data)->hMemDC, i * data->curcfg.cell_width, j * data->curcfg.cell_height, TextOut(PRIVATE(data)->hMemDC, i * data->curcfg.cell_width, j * data->curcfg.cell_height,
line, k - i); line, k - i);
if (PRIVATE(data)->ext_leading &&
(hbr = CreateSolidBrush(WCUSER_ColorMap[(attr>>4)&0x0F])))
{
r.left = i * data->curcfg.cell_width;
r.top = (j + 1) * data->curcfg.cell_height - PRIVATE(data)->ext_leading;
r.right = k * data->curcfg.cell_width;
r.bottom = (j + 1) * data->curcfg.cell_height;
FillRect(PRIVATE(data)->hMemDC, &r, hbr);
DeleteObject(hbr);
}
i = k - 1; i = k - 1;
} }
} }
@ -410,7 +422,7 @@ static int CALLBACK get_first_font_enum(const LOGFONT* lf, const TEXTMETRIC* tm,
* get the relevant information from the font described in lf and store them * get the relevant information from the font described in lf and store them
* in config * in config
*/ */
HFONT WCUSER_CopyFont(struct config_data* config, HWND hWnd, const LOGFONT* lf) HFONT WCUSER_CopyFont(struct config_data* config, HWND hWnd, const LOGFONT* lf, LONG* el)
{ {
TEXTMETRIC tm; TEXTMETRIC tm;
HDC hDC; HDC hDC;
@ -461,6 +473,7 @@ HFONT WCUSER_CopyFont(struct config_data* config, HWND hWnd, const LOGFONT* lf)
config->cell_height = tm.tmHeight + tm.tmExternalLeading; config->cell_height = tm.tmHeight + tm.tmExternalLeading;
config->font_weight = tm.tmWeight; config->font_weight = tm.tmWeight;
lstrcpy(config->face_name, lf->lfFaceName); lstrcpy(config->face_name, lf->lfFaceName);
if (el) *el = tm.tmExternalLeading;
return hFont; return hFont;
err: err:
@ -503,15 +516,17 @@ void WCUSER_FillLogFont(LOGFONT* lf, const WCHAR* name, UINT height, UINT wei
BOOL WCUSER_SetFont(struct inner_data* data, const LOGFONT* logfont) BOOL WCUSER_SetFont(struct inner_data* data, const LOGFONT* logfont)
{ {
HFONT hFont; HFONT hFont;
LONG el;
if (PRIVATE(data)->hFont != 0 && WCUSER_AreFontsEqual(&data->curcfg, logfont)) if (PRIVATE(data)->hFont != 0 && WCUSER_AreFontsEqual(&data->curcfg, logfont))
return TRUE; return TRUE;
hFont = WCUSER_CopyFont(&data->curcfg, PRIVATE(data)->hWnd, logfont); hFont = WCUSER_CopyFont(&data->curcfg, PRIVATE(data)->hWnd, logfont, &el);
if (!hFont) {WINE_ERR("wrong font\n"); return FALSE;} if (!hFont) {WINE_ERR("wrong font\n"); return FALSE;}
if (PRIVATE(data)->hFont) DeleteObject(PRIVATE(data)->hFont); if (PRIVATE(data)->hFont) DeleteObject(PRIVATE(data)->hFont);
PRIVATE(data)->hFont = hFont; PRIVATE(data)->hFont = hFont;
PRIVATE(data)->ext_leading = el;
WCUSER_ComputePositions(data); WCUSER_ComputePositions(data);
WCUSER_NewBitmap(data); WCUSER_NewBitmap(data);

View File

@ -30,6 +30,7 @@ struct inner_data_user {
/* the following fields are only user by the USER backend (should be hidden in user) */ /* the following fields are only user by the USER backend (should be hidden in user) */
HWND hWnd; /* handle to windows for rendering */ HWND hWnd; /* handle to windows for rendering */
HFONT hFont; /* font used for rendering, usually fixed */ HFONT hFont; /* font used for rendering, usually fixed */
LONG ext_leading; /* external leading for hFont */
HDC hMemDC; /* memory DC holding the bitmap below */ HDC hMemDC; /* memory DC holding the bitmap below */
HBITMAP hBitmap; /* bitmap of display window content */ HBITMAP hBitmap; /* bitmap of display window content */
HMENU hPopMenu; /* popup menu triggered by right mouse click */ HMENU hPopMenu; /* popup menu triggered by right mouse click */
@ -50,7 +51,8 @@ extern BOOL WCUSER_ValidateFontMetric(const struct inner_data* data,
const TEXTMETRIC* tm, DWORD fontType); const TEXTMETRIC* tm, DWORD fontType);
extern BOOL WCUSER_AreFontsEqual(const struct config_data* config, extern BOOL WCUSER_AreFontsEqual(const struct config_data* config,
const LOGFONT* lf); const LOGFONT* lf);
extern HFONT WCUSER_CopyFont(struct config_data* config, HWND hWnd, const LOGFONT* lf); extern HFONT WCUSER_CopyFont(struct config_data* config, HWND hWnd, const LOGFONT* lf,
LONG* el);
extern void WCUSER_FillLogFont(LOGFONT* lf, const WCHAR* name, extern void WCUSER_FillLogFont(LOGFONT* lf, const WCHAR* name,
UINT height, UINT weight); UINT height, UINT weight);