VR-Vantage 3.1 API Documentation
Home
Modules
Namespaces
Classes
Files
Libraries
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
include
vrvGraphics
DtFont.h
Go to the documentation of this file.
1
/******************************************************************************
2
** Copyright (c) 2023 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 <
vrvCore/DtBoundingBox.h
>
16
#include <
vrvCore/DtFontInterface.h
>
17
#include <
vrvUtil/DtUnicode.h
>
18
19
namespace
makVrv
20
{
21
class
DtUnicode;
22
class
DtPen;
23
class
DtGlyph;
24
class
DtGlyphRenderer;
25
class
DtGLFontManager;
26
class
DtFreeTypeFace;
27
30
class
DT_DLL_VRVGRAPHICS
DtFont
:
public
DtFontInterface
31
{
32
public
:
33
35
~
DtFont
();
36
38
const
std::string
&
fontName
()
const
;
39
41
bool
attachFile(
const
char
* fontFilePath);
42
44
void
setFreeTypeLoadFlags(
unsigned
int
flags
);
45
47
bool
setCharacterMap(
unsigned
int
encoding);
48
50
const
unsigned
int
* characterMaps();
51
53
unsigned
int
characterMapCount()
const
;
54
55
// Returns the free type face object
56
const
DtFreeTypeFace
& freeTypeFace()
const
;
57
58
// Set the Character face size.
59
bool
setFaceSize(
const
unsigned
int
size
);
60
61
// Get the character face size.
62
unsigned
int
faceSize()
const
;
63
64
// Get the global ascender height for the face.
65
float
globalAscender()
const
;
66
67
// Gets the global descender height for the face.
68
float
globalDescender()
const
;
69
70
// Gets the line spacing for the font.
71
virtual
float
lineHeight()
const
;
72
74
virtual
DtBoundingBox
calculateBoundingBox(
const
DtPen
& pen,
75
const
DtUnicode
&
string
,
unsigned
int
pos = 0,
int
len
= -1);
76
78
virtual
Dt2dPoint
calculateGlyphSize(
const
DtPen
& pen,
79
const
DtUnicode
&
string
,
unsigned
int
pos = 0,
int
len
= -1);
80
81
// Get the advance for a string.
82
float
calculateAdvance(
const
DtPen
& pen,
const
DtUnicode
&
string
,
83
unsigned
int
pos = 0,
int
len
= -1);
84
85
// Release any font resources.
86
void
releaseResources();
87
89
bool
isValid()
const
;
90
92
bool
checkError()
const
;
93
96
DtGlyph
* findOrLoadGlyphForRendering(
DtGlyphRenderer
& renderer,
const
unsigned
int
characterCode,
97
bool
characterCodeIsIndex =
false
);
98
100
DtGlyph
* findOrLoadGlyph(
const
unsigned
int
chr);
101
104
unsigned
int
indexInFont(
const
unsigned
int
characterCode)
const
;
105
106
// Calculate the kerning vector between two glyphs
107
Dt2dPoint
calculateKerning(
unsigned
int
index1,
unsigned
int
index2);
108
110
class
FontPrivate;
111
112
protected
:
113
114
friend
class
DtGLFontManager
;
115
117
DtFont
(
DtGLFontManager
& fm,
const
std::string
& fontFilePath);
118
119
protected
:
120
122
FontPrivate*
myImpl
;
123
};
124
}
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (
www.mak.com
)