![]() |
VR-Vantage 1.4.1 API Class Documentation
|
00001 /****************************************************************************** 00002 ** Copyright (c) 2010 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 ******************************************************************************/ 00005 00009 00010 #pragma once 00011 00012 #include <vrvGraphics/vrvGraphics.h> 00013 #include <vector> 00014 #include <string> 00015 #include <vrvGraphics/DtBoundingBox.h> 00016 #include <vrvUtil/DtUnicode.h> 00017 00018 namespace makVrv 00019 { 00020 class DtUnicode; 00021 class DtPen; 00022 class DtGlyph; 00023 class DtGlyphRenderer; 00024 class DtFontManager; 00025 00028 class DT_DLL_VRVGRAPHICS DtFont 00029 { 00030 public: 00031 00032 enum TextAlignement 00033 { 00034 AlignLeft, 00035 AlignCenter, 00036 AlignRight, 00037 AlignJustify 00038 }; 00039 00041 ~DtFont(); 00042 00044 const std::string& fontName() const; 00045 00047 bool attachFile(const char* fontFilePath); 00048 00050 void setFreeTypeLoadFlags(unsigned int flags); 00051 00053 bool setCharacterMap(unsigned int encoding); 00054 00056 const unsigned int* characterMaps(); 00057 00059 unsigned int characterMapCount() const; 00060 00061 // Set the Character face size. 00062 bool setFaceSize(const unsigned int size); 00063 00064 // Get the character face size. 00065 unsigned int faceSize() const; 00066 00067 // Get the global ascender height for the face. 00068 float globalAscender() const; 00069 00070 // Gets the global descender height for the face. 00071 float globalDescender() const; 00072 00073 // Gets the line spacing for the font. 00074 float lineHeight() const; 00075 00077 DtBoundingBox calculateBoundingBox(const DtPen& pen, 00078 const DtUnicode& string, unsigned int pos = 0, int len = -1); 00079 00081 DtPoint calculateGlyphSize(const DtPen& pen, 00082 const DtUnicode& string, unsigned int pos = 0, int len = -1); 00083 00084 // Get the advance for a string. 00085 float calculateAdvance(const DtPen& pen, const DtUnicode& string, 00086 unsigned int pos = 0, int len = -1); 00087 00088 // Render the string. 00089 void renderString(DtGlyphRenderer& renderer, DtPen& pen, 00090 const DtUnicode& string, unsigned int pos = 0, int len = -1); 00091 00092 // Render the string, with an allignment and a line width for wrapping. 00093 void renderString(DtGlyphRenderer& renderer, DtPen& pen, 00094 TextAlignement alignment, unsigned int lineWidth, 00095 const DtUnicode& string, unsigned int pos = 0, int len = -1); 00096 00097 // Release any font resources. 00098 void releaseResources(); 00099 00101 class FontPrivate; 00102 00103 protected: 00104 00105 friend class DtFontManager; 00106 00108 DtFont(DtFontManager& fm, const std::string& fontFilePath); 00109 00110 protected: 00111 00113 FontPrivate* myImpl; 00114 }; 00115 }