VR-Vantage API Documentation
Home
Modules
Namespaces
Classes
Files
Libraries
Examples
Tutorials
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
include
vrvGraphics
DtFont.h
Go to the documentation of this file.
1
/******************************************************************************
2
** Copyright (c) 2014 MAK Technologies, Inc.
3
** All rights reserved.
4
******************************************************************************/
5
9
10
#pragma once
11
12
#include <
vrvGraphics/vrvGraphics.h
>
13
#include <vector>
14
#include <string>
15
#include <
vrvGraphics/DtBoundingBox.h
>
16
#include <
vrvUtil/DtUnicode.h
>
17
18
namespace
makVrv
19
{
20
class
DtUnicode;
21
class
DtPen;
22
class
DtGlyph;
23
class
DtGlyphRenderer;
24
class
DtFontManager;
25
class
DtFreeTypeFace;
26
29
class
DT_DLL_VRVGRAPHICS
DtFont
30
{
31
public
:
32
33
enum
TextAlignement
34
{
35
AlignLeft
,
36
AlignCenter
,
37
AlignRight
,
38
AlignJustify
39
};
40
42
~
DtFont
();
43
45
const
std::string
&
fontName
()
const
;
46
48
bool
attachFile(
const
char
* fontFilePath);
49
51
void
setFreeTypeLoadFlags(
unsigned
int
flags
);
52
54
bool
setCharacterMap(
unsigned
int
encoding);
55
57
const
unsigned
int
* characterMaps();
58
60
unsigned
int
characterMapCount()
const
;
61
62
// Returns the free type face object
63
const
DtFreeTypeFace
& freeTypeFace()
const
;
64
65
// Set the Character face size.
66
bool
setFaceSize(
const
unsigned
int
size
);
67
68
// Get the character face size.
69
unsigned
int
faceSize()
const
;
70
71
// Get the global ascender height for the face.
72
float
globalAscender()
const
;
73
74
// Gets the global descender height for the face.
75
float
globalDescender()
const
;
76
77
// Gets the line spacing for the font.
78
float
lineHeight()
const
;
79
81
DtBoundingBox
calculateBoundingBox(
const
DtPen
& pen,
82
const
DtUnicode
&
string
,
unsigned
int
pos = 0,
int
len
= -1);
83
85
Dt2dPoint
calculateGlyphSize(
const
DtPen
& pen,
86
const
DtUnicode
&
string
,
unsigned
int
pos = 0,
int
len
= -1);
87
88
// Get the advance for a string.
89
float
calculateAdvance(
const
DtPen
& pen,
const
DtUnicode
&
string
,
90
unsigned
int
pos = 0,
int
len
= -1);
91
92
// Release any font resources.
93
void
releaseResources();
94
96
bool
isValid()
const
;
97
99
bool
checkError()
const
;
100
103
DtGlyph
* findOrLoadGlyphForRendering(
DtGlyphRenderer
& renderer,
const
unsigned
int
characterCode,
104
bool
characterCodeIsIndex =
false
);
105
107
DtGlyph
* findOrLoadGlyph(
const
unsigned
int
chr);
108
111
unsigned
int
indexInFont(
const
unsigned
int
characterCode)
const
;
112
113
// Calculate the kerning vector between two glyphs
114
Dt2dPoint
calculateKerning(
unsigned
int
index1,
unsigned
int
index2);
115
117
class
FontPrivate;
118
119
protected
:
120
121
friend
class
DtFontManager
;
122
124
DtFont
(
DtFontManager
& fm,
const
std::string
& fontFilePath);
125
126
protected
:
127
129
FontPrivate*
myImpl
;
130
};
131
}
Copyright © 2005-2013 VT MÄK. All Rights Reserved (
www.mak.com
)