ClanLib
2.3.7
Main Page
Modules
Namespaces
Classes
Files
File List
File Members
Sources
API
Display
Font
font.h
Go to the documentation of this file.
1
/*
2
** ClanLib SDK
3
** Copyright (c) 1997-2011 The ClanLib Team
4
**
5
** This software is provided 'as-is', without any express or implied
6
** warranty. In no event will the authors be held liable for any damages
7
** arising from the use of this software.
8
**
9
** Permission is granted to anyone to use this software for any purpose,
10
** including commercial applications, and to alter it and redistribute it
11
** freely, subject to the following restrictions:
12
**
13
** 1. The origin of this software must not be misrepresented; you must not
14
** claim that you wrote the original software. If you use this software
15
** in a product, an acknowledgment in the product documentation would be
16
** appreciated but is not required.
17
** 2. Altered source versions must be plainly marked as such, and must not be
18
** misrepresented as being the original software.
19
** 3. This notice may not be removed or altered from any source distribution.
20
**
21
** Note: Some of the libraries ClanLib may link to may have additional
22
** requirements or restrictions.
23
**
24
** File Author(s):
25
**
26
** Magnus Norddahl
27
*/
28
31
32
#pragma once
33
34
#include "../api_display.h"
35
#include "../../Core/System/sharedptr.h"
36
#include "../Render/graphic_context.h"
37
#include "../Image/pixel_buffer.h"
38
#include "
font_description.h
"
39
40
class
CL_FontProvider
;
41
class
CL_Font_Impl;
42
46
class
CL_API_DISPLAY
CL_Font
47
{
50
51
public
:
53
CL_Font
();
54
55
// \brief Constructs standard font - Currently this defaults to CL_Font_System
56
CL_Font
(
CL_GraphicContext
&context,
const
CL_StringRef
&typeface_name,
int
height);
57
58
// \brief Constructs standard font - Currently this defaults to CL_Font_System
59
CL_Font
(
CL_GraphicContext
&context,
const
CL_FontDescription
&desc);
60
64
CL_Font
(
CL_FontProvider
*provider);
65
69
CL_Font
(
const
CL_Font
©);
70
71
virtual
~
CL_Font
();
72
76
77
public
:
78
82
bool
is_null()
const
;
83
85
CL_FontProvider
*get_provider()
const
;
86
90
91
public
:
92
102
void
draw_text(
CL_GraphicContext
&gc,
int
x,
int
y,
const
CL_StringRef
&text,
const
CL_Colorf
&color =
CL_Colorf::white
);
103
113
void
draw_text(
CL_GraphicContext
&gc,
float
x,
float
y,
const
CL_StringRef
&text,
const
CL_Colorf
&color =
CL_Colorf::white
);
114
123
void
draw_text(
CL_GraphicContext
&gc,
const
CL_Pointf
&position,
const
CL_StringRef
&text,
const
CL_Colorf
&color =
CL_Colorf::white
);
124
135
void
draw_text_ellipsis(
CL_GraphicContext
&gc,
int
x,
int
y,
CL_Rect
content_box,
const
CL_StringRef
&text,
const
CL_Colorf
&color =
CL_Colorf::white
);
136
147
void
draw_text_ellipsis(
CL_GraphicContext
&gc,
float
x,
float
y,
CL_Rectf
content_box,
const
CL_StringRef
&text,
const
CL_Colorf
&color =
CL_Colorf::white
);
148
158
void
draw_text_ellipsis(
CL_GraphicContext
&gc,
const
CL_Pointf
&position,
CL_Rectf
content_box,
const
CL_StringRef
&text,
const
CL_Colorf
&color =
CL_Colorf::white
);
159
168
CL_Size
get_text_size(
CL_GraphicContext
&gc,
const
CL_StringRef
&text);
169
176
CL_Size
get_glyph_size(
CL_GraphicContext
&gc,
unsigned
int
glyph);
177
179
CL_FontMetrics
get_font_metrics();
180
189
int
get_character_index(
CL_GraphicContext
&gc,
const
CL_String
&text,
const
CL_Point
&point);
190
194
195
private
:
196
CL_SharedPtr<CL_Font_Impl> impl;
198
};
199
203
class
CL_API_DISPLAY
CL_FontPixelBuffer
204
{
205
public
:
206
CL_FontPixelBuffer
() : glyph(0), empty_buffer(true), offset(0,0), increment(0,0) { };
207
209
unsigned
int
glyph;
210
212
bool
empty_buffer
;
213
215
CL_PixelBuffer
buffer
;
216
218
CL_Rect
buffer_rect
;
219
221
224
CL_Point
offset
;
225
227
230
CL_Point
increment
;
231
};
232
234
Generated on Fri Jun 14 2013 13:05:45 for ClanLib by
1.8.4