uLib  User mode C/C++ extended API library for Win32 programmers.
TTResFont Class Reference

TTResFont supports TrueType fonts embedded as resources. More...

#include <uLib/ResFont.h>

Detailed Description

TTResFont supports TrueType fonts embedded as resources.

It uses the TTF name table to find the typeface name, hence
using it on a non-TTF resource will produce undefined results, possibly GPF.

Definition at line 28 of file ResFont.h.

Public Data

TCHAR TypeFace [LF_FACESIZE]
 

Public Functions

 TTResFont ()
 
 TTResFont (HMODULE hModule, CSTR Id, CSTR Type)
 
virtual ~TTResFont ()
 
bool Load (HMODULE hModule, CSTR Id, CSTR Type)
 
HFONT CreateFont (int Points, int Weight, DWORD CharSet=ANSI_CHARSET, DWORD Quality=ANTIALIASED_QUALITY)
 

Constructor & Destructor Documentation

◆ TTResFont() [1/2]

TTResFont::TTResFont ( )

You must use Load() to load the TTF before use.

Definition at line 12 of file ResFont.cpp.

◆ TTResFont() [2/2]

TTResFont::TTResFont ( HMODULE  hModule,
CSTR  Id,
CSTR  Type 
)

Initialize and call Load().

Definition at line 18 of file ResFont.cpp.

◆ ~TTResFont()

TTResFont::~TTResFont ( )
virtual

Uninstall and free memory..

Definition at line 25 of file ResFont.cpp.

Member Function Documentation

◆ Load()

bool TTResFont::Load ( HMODULE  hModule,
CSTR  Id,
CSTR  Type 
)

Load a TTF resource with Id from hModule.
As this is a custom resource, you should normally use a Type id > 255.

Definition at line 30 of file ResFont.cpp.

◆ CreateFont()

HFONT TTResFont::CreateFont ( int  Points,
int  Weight,
DWORD  CharSet = ANSI_CHARSET,
DWORD  Quality = ANTIALIASED_QUALITY 
)

Create a GUI font of the TTF species.

Since TypeFace is already known, you don't need to specify it.

Parameters
PointsHeight, in typographic points (1/72" each).
WeightWeight, f.ex. FW_NORMAL or FW_BOLD.
CharSetCharacter set to use. Default is ANSI.
QualityFont rendering quality

Definition at line 44 of file ResFont.cpp.

Member Data Documentation

◆ TypeFace

TCHAR TTResFont::TypeFace[LF_FACESIZE]

Font name. Initialized by Load().

Definition at line 30 of file ResFont.h.


The documentation for this class was generated from the following files: