[PATCH 9/9] [WinHelp]: setup a better font size for the richedit rendering

Eric Pouech eric.pouech at orange.fr
Wed Apr 23 14:38:48 CDT 2008




A+
---

 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 aae1385..78a9643 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 047a89e..fd605a9 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;
                 }





More information about the wine-patches mailing list