This repository has been archived on 2024-12-16. You can view files and clone it, but cannot push or open issues or pull requests.
CodeBlocksPortable/WATCOM/samples/win/watzee/wfont.c

44 lines
1,023 B
C

#include <stdlib.h>
#include <windows.h>
#include "watzee.h"
/*
* CreateFonts -- set up two logical font structures
*/
extern void CreateFonts( void )
/*****************************/
{
SmallNormalFont.lfHeight = 9 * CharHeight / 10;
SmallNormalFont.lfWidth = 2 * CharWidth / 5;
SmallNormalFont.lfWeight = FW_NORMAL;
SmallBoldFont.lfHeight = 9 * CharHeight / 10;
SmallBoldFont.lfWidth = 2 * CharWidth / 5;
SmallBoldFont.lfWeight = FW_BOLD;
}
/*
* GetFontInfo -- determine the height and width of the system font
*/
extern void GetFontInfo( void )
/*****************************/
{
HDC hdc;
TEXTMETRIC tm;
int sc_height;
hdc = CreateIC( "DISPLAY", NULL, NULL, NULL );
SelectObject( hdc, GetStockObject( SYSTEM_FONT ) );
GetTextMetrics( hdc, &tm );
sc_height = GetSystemMetrics( SM_CYSCREEN );
CharHeight = min( tm.tmHeight, sc_height/28 );
SysHeight = tm.tmHeight;
CharWidth = tm.tmMaxCharWidth;
DeleteDC( hdc );
}