Author: tkreuzer
Date: Mon Mar 31 07:48:40 2008
New Revision: 32791
URL:
http://svn.reactos.org/svn/reactos?rev=32791&view=rev
Log:
- give the fontview class an EXTLOGFONT to set the font, fixes display of wrong font
style.
- add font size 8
Modified:
trunk/rosapps/fontview/display.c
trunk/rosapps/fontview/display.h
trunk/rosapps/fontview/fontview.c
Modified: trunk/rosapps/fontview/display.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/fontview/display.c?rev=327…
==============================================================================
--- trunk/rosapps/fontview/display.c [iso-8859-1] (original)
+++ trunk/rosapps/fontview/display.c [iso-8859-1] Mon Mar 31 07:48:40 2008
@@ -140,7 +140,7 @@
}
static LRESULT
-Display_SetTypeFace(HWND hwnd, LPARAM lParam)
+Display_SetTypeFace(HWND hwnd, PEXTLOGFONTW pExtLogFont)
{
DISPLAYDATA* pData;
TEXTMETRIC tm;
@@ -148,19 +148,19 @@
RECT rect;
SCROLLINFO si;
int i;
+ LOGFONTW logfont;
/* Set the new type face name */
pData = (DISPLAYDATA*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- snwprintf(pData->szTypeFaceName, LF_FULLFACESIZE, (WCHAR*)lParam);
+ snwprintf(pData->szTypeFaceName, LF_FULLFACESIZE, pExtLogFont->elfFullName);
/* Create the new fonts */
hDC = GetDC(hwnd);
DeleteObject(pData->hCharSetFont);
- pData->hCharSetFont = CreateFontW(-MulDiv(16, GetDeviceCaps(GetDC(NULL), LOGPIXELSY),
72),
- 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE,
- ANSI_CHARSET, OUT_DEFAULT_PRECIS,
- CLIP_DEFAULT_PRECIS, PROOF_QUALITY,
- DEFAULT_PITCH , pData->szTypeFaceName);
+
+ logfont = pExtLogFont->elfLogFont;
+ logfont.lfHeight = -MulDiv(16, GetDeviceCaps(GetDC(NULL), LOGPIXELSY), 72);
+ pData->hCharSetFont = CreateFontIndirectW(&logfont);
/* Get font format */
// FIXME: Get the real font format (OpenType?)
@@ -174,11 +174,8 @@
for (i = 0; i < MAX_SIZES; i++)
{
DeleteObject(pData->hFonts[i]);
- pData->hFonts[i] = CreateFontW(-MulDiv(pData->nSizes[i], GetDeviceCaps(hDC,
LOGPIXELSY), 72),
- 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE,
- ANSI_CHARSET, OUT_DEFAULT_PRECIS,
- CLIP_DEFAULT_PRECIS, PROOF_QUALITY,
- DEFAULT_PITCH , pData->szTypeFaceName);
+ logfont.lfHeight = -MulDiv(pData->nSizes[i], GetDeviceCaps(hDC, LOGPIXELSY), 72);
+ pData->hFonts[i] = CreateFontIndirectW(&logfont);
}
/* Calculate new page dimensions */
@@ -216,8 +213,13 @@
Display_OnCreate(HWND hwnd)
{
DISPLAYDATA* pData;
- const int nSizes[MAX_SIZES] = {12, 18, 24, 36, 48, 60, 72};
+ const int nSizes[MAX_SIZES] = {8, 12, 18, 24, 36, 48, 60, 72};
int i;
+ EXTLOGFONTW ExtLogFont = {{50, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE,
+ ANSI_CHARSET, OUT_DEFAULT_PRECIS,
+ CLIP_DEFAULT_PRECIS, PROOF_QUALITY,
+ DEFAULT_PITCH , L"Ms Shell Dlg"},
+ L"Ms Shell Dlg"};
/* Create data structure */
pData = malloc(sizeof(DISPLAYDATA));
@@ -231,18 +233,13 @@
pData->nSizes[i] = nSizes[i];
}
- pData->hCaptionFont = CreateFontW(50, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE,
- ANSI_CHARSET, OUT_DEFAULT_PRECIS,
- CLIP_DEFAULT_PRECIS, PROOF_QUALITY,
- DEFAULT_PITCH , L"Ms Shell Dlg");
-
- pData->hSizeFont = CreateFontW(12, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE,
- ANSI_CHARSET, OUT_DEFAULT_PRECIS,
- CLIP_DEFAULT_PRECIS, PROOF_QUALITY,
- DEFAULT_PITCH , L"Ms Shell Dlg");
+ pData->hCaptionFont = CreateFontIndirectW(&ExtLogFont.elfLogFont);
+ ExtLogFont.elfLogFont.lfHeight = 12;
+ pData->hSizeFont = CreateFontIndirectW(&ExtLogFont.elfLogFont);
Display_SetString(hwnd, (LPARAM)L"Jackdaws love my big sphinx of quartz.
1234567890");
- Display_SetTypeFace(hwnd, (LPARAM)L"Ms Shell Dlg");
+
+ Display_SetTypeFace(hwnd, &ExtLogFont);
return 0;
}
@@ -398,7 +395,7 @@
return Display_OnVScroll(hwnd, wParam);
case FVM_SETTYPEFACE:
- return Display_SetTypeFace(hwnd, lParam);
+ return Display_SetTypeFace(hwnd, (PEXTLOGFONTW)lParam);
case FVM_SETSTRING:
return Display_SetString(hwnd, lParam);
Modified: trunk/rosapps/fontview/display.h
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/fontview/display.h?rev=327…
==============================================================================
--- trunk/rosapps/fontview/display.h [iso-8859-1] (original)
+++ trunk/rosapps/fontview/display.h [iso-8859-1] Mon Mar 31 07:48:40 2008
@@ -8,7 +8,7 @@
/* Size restrictions */
#define MAX_STRING 100
#define MAX_FORMAT 20
-#define MAX_SIZES 7
+#define MAX_SIZES 8
extern const WCHAR g_szFontDisplayClassName[];
Modified: trunk/rosapps/fontview/fontview.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/fontview/fontview.c?rev=32…
==============================================================================
--- trunk/rosapps/fontview/fontview.c [iso-8859-1] (original)
+++ trunk/rosapps/fontview/fontview.c [iso-8859-1] Mon Mar 31 07:48:40 2008
@@ -23,8 +23,7 @@
#include "fontview.h"
HINSTANCE g_hInstance;
-WCHAR g_szTypeFaceName[LF_FULLFACESIZE];
-LOGFONTW g_LogFontW;
+EXTLOGFONTW g_ExtLogFontW;
static const WCHAR g_szFontViewClassName[] = L"FontViewWClass";
@@ -117,15 +116,15 @@
PGFRI GetFontResourceInfoW = (PGFRI)GetProcAddress(hDLL,
"GetFontResourceInfoW");
/* Get the font name */
- dwSize = sizeof(g_szTypeFaceName);
- if (!GetFontResourceInfoW(argv[1], &dwSize, g_szTypeFaceName, 1))
+ dwSize = sizeof(g_ExtLogFontW.elfFullName);
+ if (!GetFontResourceInfoW(argv[1], &dwSize, g_ExtLogFontW.elfFullName, 1))
{
ErrorMsgBox(0, IDS_ERROR, IDS_ERROR_NOFONT, argv[1]);
return -1;
}
dwSize = sizeof(LOGFONTW);
- if (!GetFontResourceInfoW(argv[1], &dwSize, &g_LogFontW, 2))
+ if (!GetFontResourceInfoW(argv[1], &dwSize, &g_ExtLogFontW.elfLogFont, 2))
{
ErrorMsgBox(0, IDS_ERROR, IDS_ERROR_NOFONT, argv[1]);
return -1;
@@ -162,7 +161,7 @@
hMainWnd = CreateWindowExW(
0, /* Extended possibilites for variation */
g_szFontViewClassName, /* Classname */
- g_szTypeFaceName, /* Title Text */
+ g_ExtLogFontW.elfFullName,/* Title Text */
WS_OVERLAPPEDWINDOW, /* default window */
CW_USEDEFAULT, /* Windows decides the position */
CW_USEDEFAULT, /* where the window ends up on the screen */
@@ -215,7 +214,7 @@
SendMessage(hDisplay, FVM_SETSTRING, 0, (LPARAM)szString);
/* Init the display window with the font name */
- SendMessage(hDisplay, FVM_SETTYPEFACE, 0, (LPARAM)&g_LogFontW.lfFaceName);
+ SendMessage(hDisplay, FVM_SETTYPEFACE, 0, (LPARAM)&g_ExtLogFontW);
ShowWindow(hDisplay, SW_SHOWNORMAL);
/* Create the quit button */