Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
lhecker committed Nov 22, 2023
1 parent 63b3820 commit b229afb
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 727 deletions.
8 changes: 2 additions & 6 deletions src/propsheet/console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ UINT gnCurrentPage;
#define SYSTEM_ROOT (L"%SystemRoot%")
#define SYSTEM_ROOT_LENGTH (sizeof(SYSTEM_ROOT) - sizeof(WCHAR))

void RecreateFontHandles(const HWND hWnd);

void UpdateItem(HWND hDlg, UINT item, UINT nNum)
{
SetDlgItemInt(hDlg, item, nNum, TRUE);
Expand Down Expand Up @@ -622,9 +620,6 @@ INT_PTR ConsolePropertySheet(__in HWND hWnd, __in PCONSOLE_STATE_INFO pStateInfo
gpStateInfo->FontWeight,
gpStateInfo->CodePage);

// since we just triggered font enumeration, recreate our font handles to adapt for DPI
RecreateFontHandles(hWnd);

//
// Find the available default console/terminal packages
//
Expand Down Expand Up @@ -758,7 +753,8 @@ void UnregisterClasses(HINSTANCE hModule)
gpStateInfo->CodePage);

gpStateInfo->FontFamily = FontInfo[g_currentFontIndex].Family;
gpStateInfo->FontSize = FontInfo[g_currentFontIndex].Size;
gpStateInfo->FontSize.X = (SHORT)FontInfo[g_currentFontIndex].Size.cx;
gpStateInfo->FontSize.Y = (SHORT)FontInfo[g_currentFontIndex].Size.cy;
gpStateInfo->FontWeight = FontInfo[g_currentFontIndex].Weight;
return StringCchCopyW(gpStateInfo->FaceName, ARRAYSIZE(gpStateInfo->FaceName), FontInfo[g_currentFontIndex].FaceName);
}
7 changes: 4 additions & 3 deletions src/propsheet/dbcs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ void MakeAltRasterFont(
if (!TM_IS_TT_FONT(FontInfo[i].Family) &&
IS_ANY_DBCS_CHARSET(FontInfo[i].tmCharSet) == fDbcsCharSet)
{
FontDelta.X = (SHORT)abs(FontSize.X - FontInfo[i].Size.X);
FontDelta.Y = (SHORT)abs(FontSize.Y - FontInfo[i].Size.Y);
FontDelta.X = (SHORT)abs(FontSize.cx - FontInfo[i].Size.cx);
FontDelta.Y = (SHORT)abs(FontSize.cy - FontInfo[i].Size.cy);
if (Find > (DWORD)(FontDelta.X + FontDelta.Y))
{
Find = (DWORD)(FontDelta.X + FontDelta.Y);
Expand All @@ -56,7 +56,8 @@ void MakeAltRasterFont(

*AltFontIndex = FontIndex;
StringCchCopy(AltFaceName, LF_FACESIZE, FontInfo[*AltFontIndex].FaceName);
*AltFontSize = FontInfo[*AltFontIndex].Size;
AltFontSize->X = (SHORT)FontInfo[*AltFontIndex].Size.cx;
AltFontSize->Y = (SHORT)FontInfo[*AltFontIndex].Size.cy;
*AltFontFamily = FontInfo[*AltFontIndex].Family;

DBGFONTS(("MakeAltRasterFont : AltFontIndex = %ld\n", *AltFontIndex));
Expand Down
12 changes: 1 addition & 11 deletions src/propsheet/font.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ Revision History:
typedef struct _FONT_INFO
{
HFONT hFont;
COORD Size; // font size obtained
COORD SizeWant; // 0;0 if Raster font
LONG Weight;
LPTSTR FaceName;
BYTE Family;
Expand All @@ -74,7 +72,6 @@ typedef struct tagFACENODE

#define TM_IS_TT_FONT(x) (((x)&TMPF_TRUETYPE) == TMPF_TRUETYPE)
#define IS_BOLD(w) ((w) >= FW_SEMIBOLD)
#define SIZE_EQUAL(s1, s2) (((s1).X == (s2).X) && ((s1).Y == (s2).Y))
#define POINTS_PER_INCH 72
#define MIN_PIXEL_HEIGHT 5
#define MAX_PIXEL_HEIGHT 72
Expand All @@ -99,17 +96,10 @@ int FindCreateFont(
__in LONG Weight,
__in UINT CodePage);

BOOL DoFontEnum(
__in_opt HDC hDC,
__in_ecount_opt(LF_FACESIZE) LPTSTR ptszFace,
__in_ecount_opt(nTTPoints) PSHORT pTTPoints,
__in UINT nTTPoints);
BOOL DoFontEnum(__in_opt HDC hDC, __in_ecount_opt(LF_FACESIZE) LPTSTR ptszFace);

[[nodiscard]] NTSTATUS GetTTFontFaceForCodePage(const UINT uiCodePage,
_Out_writes_(cchFaceName) PWSTR pszFaceName,
const size_t cchFaceName);

bool IsFontSizeCustom(__in PCWSTR pwszFaceName, const __in SHORT sSize);
void CreateSizeForAllTTFonts(const __in SHORT sSize);

#endif /* !FONT_H */
Loading

0 comments on commit b229afb

Please sign in to comment.