VR-Forces 4.3.1 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DtTextLayout.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 
14 #include <vrvUtil/DtUnicode.h>
15 
16 struct hb_buffer_t;
17 struct hb_font_t;
18 struct hb_glyph_position_t;
19 struct hb_glyph_info_t;
20 
21 namespace makVrv
22 {
23  class DtFreeTypeFace;
24 
28  {
29  public:
31  {
32  public:
35 
37  virtual ~HarfBuzzShaper();
38 
40  void setFont(DtFontSP f);
41 
43  void layoutText(const DtUnicode& string);
44 
46  hb_glyph_position_t *getGlyphPositions(unsigned int* glyph_count) const;
47 
49  hb_glyph_info_t* getGlyphInfos(unsigned int* glyph_count) const;
50 
51  protected:
52  hb_font_t* myHarfBuzzFont;
53  hb_buffer_t *myHarfBuzzBuffer;
54  };
55 
56  public:
58  DtTextLayout();
59 
61  virtual ~DtTextLayout();
62 
64  virtual void renderText(DtTexturedGlyphRenderer*, DtTextProxy*);
65 
67  virtual DtUnicode bidiFix(const DtUnicode&) const;
68 
70  virtual Dt2dPoint calculateGlyphSize(DtFontSP font, const DtPen& pen,
71  const DtUnicode& string, unsigned int pos = 0, int len = -1);
72 
74  virtual DtBoundingBox calculateBoundingBox(DtFontSP font, const DtPen& pen,
75  const DtUnicode& string, unsigned int pos = 0, int len = -1);
76 
77  virtual void layoutRightToLeft(const DtTextProxy*);
78  virtual void layoutLeftToRight(const DtTextProxy*);
79 
80  protected:
82  virtual bool renderCharacter(DtGlyphRenderer& renderer,
83  DtPen& pen, DtFontSP font, const unsigned int& character);
84 
86  virtual void renderLayout(DtTexturedGlyphRenderer*, DtTextProxy*);
87 
88  protected:
90 
93  std::vector<std::string> myFontFilePaths;
94  unsigned int myPointSize;
97 
100  {
101  CharacterInformation() : advance(0.0f), offset(0.0f), glyphIndex(0), changeColor(false), glyphDefined(true) {};
103  advance(orig.advance), offset(orig.offset), glyphIndex(orig.glyphIndex), changeColor(orig.changeColor),
104  glyphDefined(orig.glyphDefined) { memcpy(color, orig.color, sizeof(color)); };
105 
106  Dt2dPoint advance;
108  float color[4];
110  unsigned short glyphIndex;
112  };
113 
117  {
118  LineInformation() : margin(0.0f), alignment(0) {}
120  margin(orig.margin), alignment(orig.alignment), characters(orig.characters) {};
121 
122  float margin;
123  unsigned int alignment;
124  std::vector<CharacterInformation> characters;
125  };
126 
127  typedef std::vector<LineInformation> Lines;
129 
130  double myLineLength;
132  };
133 }

Document ID: Generated on Wed Jul 29 00:55:00 EDT 2015 from SVN revision 155257
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)