ReactOS  0.4.12-dev-75-g00dd17e
font Namespace Reference

Functions

HFONT MakeFont (IN HDC hDestDC, IN LPCSTR typeface_name, IN int point_size, IN const BYTE charset, IN const DWORD style)
 

Variables

static const ULONG FS_NONE = 0x00000000
 
static const ULONG FS_BOLD = 0x00000001
 
static const ULONG FS_ITALIC = 0x00000002
 
static const ULONG FS_UNDERLINE = 0x00000004
 
static const ULONG FS_STRIKEOUT = 0x00000008
 
static const ULONG FS_NONE = 0x00000000
 
static const ULONG FS_BOLD = 0x00000001
 
static const ULONG FS_ITALIC = 0x00000002
 
static const ULONG FS_UNDERLINE = 0x00000004
 
static const ULONG FS_STRIKEOUT = 0x00000008
 

Function Documentation

◆ MakeFont()

HFONT font::MakeFont ( IN HDC  hDestDC,
IN LPCSTR  typeface_name,
IN int  point_size,
IN const BYTE  charset,
IN const DWORD  style 
)

Definition at line 23 of file mk_font.cpp.

Referenced by MainWndProc().

30 {
31  //
32  // NOTE: On Windows 9x/Me, GetWorldTransform is not
33  // supported. For compatibility with these platforms you
34  // should initialize the XFORM::eM22 data member to 1.0.
35  //
36  XFORM xf = {0, 0, 0, 1.0, 0, 0};
37  GetWorldTransform(hDestDC, &xf);
38  int pixels_per_inch = GetDeviceCaps(hDestDC, LOGPIXELSY);
39 
40  POINT PSize = {
41  0,
42  -MulDiv(static_cast<int>(xf.eM22 * point_size + 0.5),
43  pixels_per_inch, 72)
44  };
45 
46  HFONT hResult = NULL;
47  if (DPtoLP(hDestDC, &PSize, 1))
48  {
49  LOGFONT lf;
50  memset(&lf, 0, sizeof(LOGFONT));
51 
52  lf.lfHeight = PSize.y;
53  lf.lfCharSet = charset;
54  lstrcpyn(reinterpret_cast<LPTSTR>(&lf.lfFaceName),
55  typeface_name, LF_FACESIZE);
56 
58  lf.lfItalic = (style & FS_ITALIC) ? true : false;
59  lf.lfUnderline = (style & FS_UNDERLINE) ? true : false;
60  lf.lfStrikeOut = (style & FS_STRIKEOUT) ? true : false;
61 
62  // create the logical font
63  hResult = CreateFontIndirect(&lf);
64  }
65  return hResult;
66 }
BYTE lfItalic
Definition: dimm.idl:47
#define LF_FACESIZE
Definition: dimm.idl:39
CFF_Charset charset
Definition: cffcmap.c:138
long y
Definition: polytest.cpp:48
BYTE lfStrikeOut
Definition: dimm.idl:49
BYTE lfUnderline
Definition: dimm.idl:48
BYTE lfCharSet
Definition: dimm.idl:50
static const ULONG FS_ITALIC
Definition: mk_font.h:26
BOOL WINAPI DPtoLP(_In_ HDC hdc, _Inout_updates_(c) LPPOINT lppt, _In_ int c)
LONG lfHeight
Definition: dimm.idl:42
LONG lfWeight
Definition: dimm.idl:46
static const ULONG FS_UNDERLINE
Definition: mk_font.h:27
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI GetWorldTransform(_In_ HDC, _Out_ LPXFORM)
Definition: coord.c:274
static const ULONG FS_STRIKEOUT
Definition: mk_font.h:28
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define FW_DONTCARE
Definition: wingdi.h:366
#define FW_BOLD
Definition: wingdi.h:376
FLOAT eM22
Definition: wingdi.h:1701
#define CreateFontIndirect
Definition: wingdi.h:4421
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
CHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:55
#define LOGPIXELSY
Definition: wingdi.h:717
Arabic default style
Definition: afstyles.h:93
static const ULONG FS_BOLD
Definition: mk_font.h:25
#define memset(x, y, z)
Definition: compat.h:39
#define MulDiv(x, y, z)
Definition: gdifloat.h:86
#define lstrcpyn
Definition: winbase.h:3689

Variable Documentation

◆ FS_BOLD [1/2]

const ULONG font::FS_BOLD = 0x00000001
static

Definition at line 25 of file mk_font.h.

Referenced by MainWndProc(), and MakeFont().

◆ FS_BOLD [2/2]

const ULONG font::FS_BOLD = 0x00000001
static

Definition at line 25 of file mk_font.h.

◆ FS_ITALIC [1/2]

const ULONG font::FS_ITALIC = 0x00000002
static

Definition at line 26 of file mk_font.h.

◆ FS_ITALIC [2/2]

const ULONG font::FS_ITALIC = 0x00000002
static

Definition at line 26 of file mk_font.h.

Referenced by MakeFont().

◆ FS_NONE [1/2]

const ULONG font::FS_NONE = 0x00000000
static

Definition at line 24 of file mk_font.h.

◆ FS_NONE [2/2]

const ULONG font::FS_NONE = 0x00000000
static

Definition at line 24 of file mk_font.h.

◆ FS_STRIKEOUT [1/2]

const ULONG font::FS_STRIKEOUT = 0x00000008
static

Definition at line 28 of file mk_font.h.

Referenced by MakeFont().

◆ FS_STRIKEOUT [2/2]

const ULONG font::FS_STRIKEOUT = 0x00000008
static

Definition at line 28 of file mk_font.h.

◆ FS_UNDERLINE [1/2]

const ULONG font::FS_UNDERLINE = 0x00000004
static

Definition at line 27 of file mk_font.h.

Referenced by MainWndProc(), and MakeFont().

◆ FS_UNDERLINE [2/2]

const ULONG font::FS_UNDERLINE = 0x00000004
static

Definition at line 27 of file mk_font.h.