Move font functions to sdk
This commit is contained in:
@@ -1148,24 +1148,6 @@ BOOLEAN PhGetListViewContextMenuPoint(
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
HFONT PhDuplicateFontWithNewWeight(
|
||||
_In_ HFONT Font,
|
||||
_In_ LONG NewWeight
|
||||
)
|
||||
{
|
||||
LOGFONT logFont;
|
||||
|
||||
if (GetObject(Font, sizeof(LOGFONT), &logFont))
|
||||
{
|
||||
logFont.lfWeight = NewWeight;
|
||||
return CreateFontIndirect(&logFont);
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
VOID PhSetWindowOpacity(
|
||||
_In_ HWND WindowHandle,
|
||||
_In_ ULONG OpacityPercent
|
||||
|
||||
@@ -212,11 +212,6 @@ PhGetListViewContextMenuPoint(
|
||||
);
|
||||
// end_phapppub
|
||||
|
||||
HFONT PhDuplicateFontWithNewWeight(
|
||||
_In_ HFONT Font,
|
||||
_In_ LONG NewWeight
|
||||
);
|
||||
|
||||
VOID PhSetWindowOpacity(
|
||||
_In_ HWND WindowHandle,
|
||||
_In_ ULONG OpacityPercent
|
||||
|
||||
@@ -629,6 +629,32 @@ PhLoadPngImageFromResource(
|
||||
_In_ BOOLEAN RGBAImage
|
||||
);
|
||||
|
||||
FORCEINLINE
|
||||
HFONT
|
||||
PhCreateFont(
|
||||
_In_ PWSTR Name,
|
||||
_In_ ULONG Size,
|
||||
_In_ ULONG Weight
|
||||
)
|
||||
{
|
||||
return CreateFont(
|
||||
-(LONG)PhMultiplyDivide(Size, PhGlobalDpi, 72),
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
Weight,
|
||||
FALSE,
|
||||
FALSE,
|
||||
FALSE,
|
||||
ANSI_CHARSET,
|
||||
OUT_DEFAULT_PRECIS,
|
||||
CLIP_DEFAULT_PRECIS,
|
||||
DEFAULT_QUALITY,
|
||||
DEFAULT_PITCH,
|
||||
Name
|
||||
);
|
||||
}
|
||||
|
||||
FORCEINLINE
|
||||
HFONT
|
||||
PhCreateCommonFont(
|
||||
@@ -668,6 +694,39 @@ PhCreateCommonFont(
|
||||
|
||||
return fontHandle;
|
||||
}
|
||||
|
||||
FORCEINLINE
|
||||
HFONT
|
||||
PhDuplicateFont(
|
||||
_In_ HFONT Font
|
||||
)
|
||||
{
|
||||
LOGFONT logFont;
|
||||
|
||||
if (GetObject(Font, sizeof(LOGFONT), &logFont))
|
||||
return CreateFontIndirect(&logFont);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
FORCEINLINE
|
||||
HFONT
|
||||
PhDuplicateFontWithNewWeight(
|
||||
_In_ HFONT Font,
|
||||
_In_ LONG NewWeight
|
||||
)
|
||||
{
|
||||
LOGFONT logFont;
|
||||
|
||||
if (GetObject(Font, sizeof(LOGFONT), &logFont))
|
||||
{
|
||||
logFont.lfWeight = NewWeight;
|
||||
return CreateFontIndirect(&logFont);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// end_phapppub
|
||||
|
||||
// sessmsg
|
||||
|
||||
+2
-26
@@ -488,30 +488,6 @@ VOID PhInitializeCommonControls(
|
||||
InitCommonControlsEx(&icex);
|
||||
}
|
||||
|
||||
HFONT PhpCreateFont(
|
||||
_In_ PWSTR Name,
|
||||
_In_ ULONG Size,
|
||||
_In_ ULONG Weight
|
||||
)
|
||||
{
|
||||
return CreateFont(
|
||||
-(LONG)PhMultiplyDivide(Size, PhGlobalDpi, 72),
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
Weight,
|
||||
FALSE,
|
||||
FALSE,
|
||||
FALSE,
|
||||
ANSI_CHARSET,
|
||||
OUT_DEFAULT_PRECIS,
|
||||
CLIP_DEFAULT_PRECIS,
|
||||
DEFAULT_QUALITY,
|
||||
DEFAULT_PITCH,
|
||||
Name
|
||||
);
|
||||
}
|
||||
|
||||
VOID PhInitializeFont(
|
||||
_In_ HWND hWnd
|
||||
)
|
||||
@@ -533,8 +509,8 @@ VOID PhInitializeFont(
|
||||
success = !!SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &metrics, 0);
|
||||
|
||||
if (
|
||||
!(PhApplicationFont = PhpCreateFont(L"Microsoft Sans Serif", 8, FW_NORMAL)) &&
|
||||
!(PhApplicationFont = PhpCreateFont(L"Tahoma", 8, FW_NORMAL))
|
||||
!(PhApplicationFont = PhCreateFont(L"Microsoft Sans Serif", 8, FW_NORMAL)) &&
|
||||
!(PhApplicationFont = PhCreateFont(L"Tahoma", 8, FW_NORMAL))
|
||||
)
|
||||
{
|
||||
if (success)
|
||||
|
||||
@@ -319,7 +319,7 @@ INT_PTR CALLBACK CustomizeStatusBarDialogProc(
|
||||
context->MoveDownButtonHandle = GetDlgItem(hwndDlg, IDC_MOVEDOWN);
|
||||
context->AddButtonHandle = GetDlgItem(hwndDlg, IDC_ADD);
|
||||
context->RemoveButtonHandle = GetDlgItem(hwndDlg, IDC_REMOVE);
|
||||
context->FontHandle = CommonDuplicateFont((HFONT)SendMessage(StatusBarHandle, WM_GETFONT, 0, 0));
|
||||
context->FontHandle = PhDuplicateFont((HFONT)SendMessage(StatusBarHandle, WM_GETFONT, 0, 0));
|
||||
|
||||
ListBox_SetItemHeight(context->AvailableListHandle, 0, PH_SCALE_DPI(22)); // BitmapHeight
|
||||
ListBox_SetItemHeight(context->CurrentListHandle, 0, PH_SCALE_DPI(22)); // BitmapHeight
|
||||
|
||||
@@ -523,7 +523,7 @@ INT_PTR CALLBACK CustomizeToolbarDialogProc(
|
||||
context->BrushNormal = GetSysColorBrush(COLOR_WINDOW);
|
||||
context->BrushHot = CreateSolidBrush(RGB(145, 201, 247));
|
||||
context->BrushPushed = CreateSolidBrush(RGB(153, 209, 255));
|
||||
context->FontHandle = CommonDuplicateFont((HFONT)SendMessage(ToolBarHandle, WM_GETFONT, 0, 0));
|
||||
context->FontHandle = PhDuplicateFont((HFONT)SendMessage(ToolBarHandle, WM_GETFONT, 0, 0));
|
||||
|
||||
ListBox_SetItemHeight(context->AvailableListHandle, 0, context->CXWidth + 6); // BitmapHeight
|
||||
ListBox_SetItemHeight(context->CurrentListHandle, 0, context->CXWidth + 6); // BitmapHeight
|
||||
|
||||
@@ -569,18 +569,5 @@ FormatAnsiString(
|
||||
return FormatAnsiString_V(Format, argptr);
|
||||
}
|
||||
|
||||
FORCEINLINE
|
||||
HFONT
|
||||
CommonDuplicateFont(
|
||||
_In_ HFONT Font
|
||||
)
|
||||
{
|
||||
LOGFONT logFont;
|
||||
|
||||
if (GetObject(Font, sizeof(LOGFONT), &logFont))
|
||||
return CreateFontIndirect(&logFont);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user