-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFont.cpp
More file actions
124 lines (94 loc) · 2.11 KB
/
Copy pathFont.cpp
File metadata and controls
124 lines (94 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#include "Font.h"
namespace TkinterWindow
{
HFONT Font::GetFontObject(HDC hDC)
{
// Select the font for drawing and also return the font object.
BOOL fontItalic;
BOOL fontUnderLine;
BOOL fontLineMid;
if (ItalicFont)
{
fontItalic = TRUE;
}
else
{
fontItalic = FALSE;
}
if (underLineFont)
{
fontUnderLine = TRUE;
}
else
{
fontUnderLine = FALSE;
}
if (midLineFont)
{
fontLineMid = TRUE;
}
else
{
fontLineMid = FALSE;
}
SetGraphicsMode(hDC, GM_ADVANCED);
hFont = CreateFontA(sizeFont, heightFont, fontEscapment, fontOrientation, weightFont, fontItalic, fontUnderLine, fontLineMid, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, (LPCSTR)styleFont.c_str());
SelectObject(hDC, hFont);
return hFont;
}
void Font::DeleteFontObject()
{
// Delete font object and clear the memory
DeleteObject(hFont);
}
void Font::SetItalicFontStyle(bool italicStyle)
{
// Set the font to the italic font style.
ItalicFont = italicStyle;
}
void Font::SetMidLineFontStyle(bool midLineStyle)
{
// Set the font to show the mid line on the font.
midLineFont = midLineStyle;
}
void Font::SetFontWeight(int fontWeight)
{
// Set the weight ( boldness ) of the font.
weightFont = fontWeight;
}
void Font::SetFontSize(int fontSize)
{
// Set the fontsize ( font width ) of the font.
sizeFont = fontSize;
}
void Font::SetFontWidth(int fontWidth)
{
// Set the font width. same as SetFontSize().
sizeFont = fontWidth;
}
void Font::SetFontHeight(int fontHeight)
{
// Set the font height of the font.
heightFont = fontHeight;
}
void Font::SetUnderLineFontStyle(bool underLineStyle)
{
// It show the line below the font.
underLineFont = underLineStyle;
}
void Font::SetFontEscapment(int degree)
{
// Set the orientation of one by one character.
fontEscapment = degree;
}
void Font::SetFontOrientation(int degree)
{
// Set the orientation of the whole font.
fontOrientation = degree;
}
void Font::SetFontStyle(std::string fontStyle)
{
// Set the font style.
styleFont = fontStyle;
}
}