VR-Vantage
Loading...
Searching...
No Matches
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
13#include <vector>
14#include <string>
17#include <vrvUtil/DtUnicode.h>
18
19namespace makVrv
20{
21 class DtUnicode;
22 class DtPen;
23 class DtGlyph;
24 class DtGlyphRenderer;
25 class DtGLFontManager;
26 class DtFreeTypeFace;
27
31 {
32 public:
33
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
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
75 const DtUnicode& string, unsigned int pos = 0, int len = -1);
76
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.
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}
Contains the makVrv::DtBoundingBox class declaration.
Contains makVrv::DtFontInterface class declaration.
Definition DtBoundingBox.h:20
Definition DtBoundingBox.h:102
void setFreeTypeLoadFlags(unsigned int flags)
Set the FreeType load flags.
virtual DtBoundingBox calculateBoundingBox(const DtPen &pen, const DtUnicode &string, unsigned int pos=0, int len=-1)
Calculate the bounding box for a string.
unsigned int characterMapCount() const
Get the number of charater maps.
const DtFreeTypeFace & freeTypeFace() const
float globalAscender() const
bool setFaceSize(const unsigned int size)
void releaseResources()
friend class DtGLFontManager
Definition DtFont.h:114
bool checkError() const
Asks the private implementation to see if there is an error with the font.
FontPrivate * myImpl
Internal FTGL FTFont implementation object. For private use only.
Definition DtFont.h:122
bool isValid() const
Returns true if this font is valid (has a character map).
bool setCharacterMap(unsigned int encoding)
Set the FreeType characte encoding map.
unsigned int indexInFont(const unsigned int characterCode) const
virtual Dt2dPoint calculateGlyphSize(const DtPen &pen, const DtUnicode &string, unsigned int pos=0, int len=-1)
Calculate the bounding box for a string.
const std::string & fontName() const
Get the name.
float calculateAdvance(const DtPen &pen, const DtUnicode &string, unsigned int pos=0, int len=-1)
float globalDescender() const
DtGlyph * findOrLoadGlyph(const unsigned int chr)
Load the glyph, or return null if the glyph is not loaded.
Dt2dPoint calculateKerning(unsigned int index1, unsigned int index2)
unsigned int faceSize() const
DtFont(DtGLFontManager &fm, const std::string &fontFilePath)
CTOR create and load a font.
const unsigned int * characterMaps()
Get the list of character maps.
virtual float lineHeight() const
DtGlyph * findOrLoadGlyphForRendering(DtGlyphRenderer &renderer, const unsigned int characterCode, bool characterCodeIsIndex=false)
bool attachFile(const char *fontFilePath)
Attach auxilliary file to font e.g font metrics.
DtFontInterface()=default
CTOR.
Definition DtFreeTypeFace.h:24
Definition DtGLFontManager.h:27
Definition DtGlyph.h:22
Definition DtGlyphRenderer.h:22
Definition DtBoundingBox.h:81
Definition DtUnicode.h:34
#define DT_DLL_VRVGRAPHICS
Contains DLL export macros.
Definition vrvGraphics.h:19
Contains DtCreateSensorFieldOfViewCommand and DtCreateSensorFieldOfViewCommandCreator class declarati...
Definition DtGridLinesSettingsRecord.h:16