VR-Vantage API Documentation
DtFont.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2010 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
13 #include <vector>
14 #include <string>
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 
29  {
30  public:
31 
33  {
37  AlignJustify
38  };
39 
41  ~DtFont();
42 
44  const std::string& fontName() const;
45 
47  bool attachFile(const char* fontFilePath);
48 
50  void setFreeTypeLoadFlags(unsigned int flags);
51 
53  bool setCharacterMap(unsigned int encoding);
54 
56  const unsigned int* characterMaps();
57 
59  unsigned int characterMapCount() const;
60 
61  // Set the Character face size.
62  bool setFaceSize(const unsigned int size);
63 
64  // Get the character face size.
65  unsigned int faceSize() const;
66 
67  // Get the global ascender height for the face.
68  float globalAscender() const;
69 
70  // Gets the global descender height for the face.
71  float globalDescender() const;
72 
73  // Gets the line spacing for the font.
74  float lineHeight() const;
75 
77  DtBoundingBox calculateBoundingBox(const DtPen& pen,
78  const DtUnicode& string, unsigned int pos = 0, int len = -1);
79 
81  DtPoint calculateGlyphSize(const DtPen& pen,
82  const DtUnicode& string, unsigned int pos = 0, int len = -1);
83 
84  // Get the advance for a string.
85  float calculateAdvance(const DtPen& pen, const DtUnicode& string,
86  unsigned int pos = 0, int len = -1);
87 
88  // Render the string.
89  void renderString(DtGlyphRenderer& renderer, DtPen& pen,
90  const DtUnicode& string, unsigned int pos = 0, int len = -1);
91 
92  // Render the string, with an allignment and a line width for wrapping.
93  void renderString(DtGlyphRenderer& renderer, DtPen& pen,
94  TextAlignement alignment, unsigned int lineWidth,
95  const DtUnicode& string, unsigned int pos = 0, int len = -1);
96 
97  // Release any font resources.
98  void releaseResources();
99 
101  class FontPrivate;
102 
103  protected:
104 
105  friend class DtFontManager;
106 
108  DtFont(DtFontManager& fm, const std::string& fontFilePath);
109 
110  protected:
111 
113  FontPrivate* myImpl;
114  };
115 }


Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (www.mak.com)