-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
dd_fontrenderer.h
137 lines (104 loc) · 3.73 KB
/
dd_fontrenderer.h
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
125
126
127
128
129
130
131
132
133
134
135
136
137
/**\file dd_fontrenderer.h
*\section License
* License: GPL
* Online License Link: http://www.gnu.org/licenses/gpl.html
*
*\author Copyright © 1999-2011 Jaakko Keränen <jaakko.keranen@iki.fi>
*\author Copyright © 2006-2011 Daniel Swanson <danij@dengine.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
/**
* Font Renderer.
*/
#ifndef LIBDENG_API_FONT_RENDERER_H
#define LIBDENG_API_FONT_RENDERER_H
#include "dd_uri.h"
typedef uint32_t fontid_t;
/**
* Find the associated font for @a name.
*
* @param name Name of the font to lookup.
* @return Unique id of the found font.
*/
fontid_t FR_FindFontForName(const char* name);
void FR_ResetTypeInTimer(void);
/**
* @defGroup drawTextFlags Draw Text Flags
*/
/*@{*/
#define DTF_NO_TYPEIN 0x0001
#define DTF_NO_SHADOW 0x0002
#define DTF_NO_GLITTER 0x0004
#define DTF_NO_EFFECTS (DTF_NO_TYPEIN|DTF_NO_SHADOW|DTF_NO_GLITTER)
#define DTF_ONLY_SHADOW (DTF_NO_TYPEIN|DTF_NO_GLITTER)
/*@}*/
#define FR_MAX_ATTRIB_STACK_DEPTH (4)
/// @return Unique identifier associated with the current font.
fontid_t FR_Font(void);
/// Change the current font.
void FR_SetFont(fontid_t font);
/// Push the attribute stack.
void FR_PushAttrib(void);
/// Pop the attribute stack.
void FR_PopAttrib(void);
/// Load the default attributes at the current stack depth.
void FR_LoadDefaultAttrib(void);
/// @return Current leading.
float FR_Leading(void);
void FR_SetLeading(float value);
/// @return Current tracking.
int FR_Tracking(void);
void FR_SetTracking(int value);
/// Retrieve the current shadow offset.
void FR_ShadowOffset(int* offsetX, int* offsetY);
void FR_SetShadowOffset(int offsetX, int offsetY);
/// @return Current shadow strength.
float FR_ShadowStrength(void);
void FR_SetShadowStrength(float value);
/// @return Current glitter strength.
float FR_GlitterStrength(void);
void FR_SetGlitterStrength(float value);
/// @return Current case scale.
boolean FR_CaseScale(void);
void FR_SetCaseScale(boolean value);
/**
* Text: A block of possibly formatted and/or multi-line text.
*/
void FR_DrawText(const char* string, int x, int y, int alignFlags, short flags);
// Utility routines:
void FR_TextDimensions(int* width, int* height, const char* string);
int FR_TextWidth(const char* string);
int FR_TextHeight(const char* string);
/**
* Text fragments: A single line of unformatted text.
*/
void FR_DrawTextFragment(const char* string, int x, int y);
void FR_DrawTextFragment2(const char* string, int x, int y, int alignFlags, short flags);
// Utility routines:
void FR_TextFragmentDimensions(int* width, int* height, const char* string);
int FR_TextFragmentWidth(const char* string);
int FR_TextFragmentHeight(const char* string);
/**
* Single character.
*/
void FR_DrawChar(unsigned char ch, int x, int y);
void FR_DrawChar2(unsigned char ch, int x, int y, int alignFlags, short flags);
// Utility routines:
void FR_CharDimensions(int* width, int* height, unsigned char ch);
int FR_CharWidth(unsigned char ch);
int FR_CharHeight(unsigned char ch);
#endif /* LIBDENG_API_FONT_RENDERER_H */