From 56a41706c7c533b8f4a4f1652d58091fb6358b67 Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Wed, 23 Apr 2008 21:38:48 +0200 Subject: [PATCH] winhelp: Setup a better font size for the richedit rendering. --- programs/winhelp/hlpfile.c | 8 +++++--- programs/winhelp/winhelp.c | 6 +++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/programs/winhelp/hlpfile.c b/programs/winhelp/hlpfile.c index aae1385fc9d..78a9643801c 100644 --- a/programs/winhelp/hlpfile.c +++ b/programs/winhelp/hlpfile.c @@ -1113,13 +1113,15 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, BYTE case 0x80: { unsigned font = GET_USHORT(format, 1); + unsigned fs; attributes.wFont = font; WINE_TRACE("Changing font to %d\n", attributes.wFont); format += 3; + fs = (4 * page->file->fonts[font].LogFont.lfHeight - 3) / 5; /* FIXME: missing at least colors, also bold attribute looses information */ + sprintf(tmp, "\\f%d\\cf%d\\fs%d%s%s%s%s", - font, font + 2, - -2 * page->file->fonts[font].LogFont.lfHeight, + font, font + 2, fs, page->file->fonts[font].LogFont.lfWeight > 400 ? "\\b" : "\\b0", page->file->fonts[font].LogFont.lfItalic ? "\\i" : "\\i0", page->file->fonts[font].LogFont.lfUnderline ? "\\ul" : "\\ul0", @@ -1530,7 +1532,7 @@ static BOOL HLPFILE_ReadFont(HLPFILE* hlpfile) flag = ref[dscr_offset + i * 11 + 0]; family = ref[dscr_offset + i * 11 + 2]; - hlpfile->fonts[i].LogFont.lfHeight = -ref[dscr_offset + i * 11 + 1] / 2 - 3; + hlpfile->fonts[i].LogFont.lfHeight = ref[dscr_offset + i * 11 + 1]; hlpfile->fonts[i].LogFont.lfWidth = 0; hlpfile->fonts[i].LogFont.lfEscapement = 0; hlpfile->fonts[i].LogFont.lfOrientation = 0; diff --git a/programs/winhelp/winhelp.c b/programs/winhelp/winhelp.c index 047a89e33ba..fd605a9c7a3 100644 --- a/programs/winhelp/winhelp.c +++ b/programs/winhelp/winhelp.c @@ -1803,7 +1803,11 @@ static BOOL WINHELP_SplitLines(HWND hWnd, LPSIZE newsize) HLPFILE* hlpfile = win->page->file; if (!hlpfile->fonts[p->u.text.wFont].hFont) - hlpfile->fonts[p->u.text.wFont].hFont = CreateFontIndirect(&hlpfile->fonts[p->u.text.wFont].LogFont); + { + LOGFONT lf = hlpfile->fonts[p->u.text.wFont].LogFont; + lf.lfHeight = -lf.lfHeight / 2 - 3; + hlpfile->fonts[p->u.text.wFont].hFont = CreateFontIndirect(&lf); + } hFont = hlpfile->fonts[p->u.text.wFont].hFont; color = hlpfile->fonts[p->u.text.wFont].color; }