VR-Forces 4.6.1 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties 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(const 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(const DtFontSP& font, const DtPen& pen,
71  const DtUnicode& string, unsigned int pos = 0, int len = -1);
72 
74  virtual DtBoundingBox calculateBoundingBox(const DtFontSP& font, const DtPen& pen,
75  const DtUnicode& string, unsigned int pos = 0, int len = -1);
76 
77  virtual bool isShaped(void) const{ return true; }
78 
79  virtual void layoutRightToLeft(const DtTextProxy*);
80  virtual void layoutLeftToRight(const DtTextProxy*);
81 
82  protected:
84  virtual bool renderCharacter(DtGlyphRenderer& renderer,
85  DtPen& pen, const DtFontSP& font, const unsigned int& character);
86 
88  virtual void renderLayout(DtTexturedGlyphRenderer*, DtTextProxy*);
89 
90  protected:
92 
95  std::vector<std::string> myFontFilePaths;
96  unsigned int myPointSize;
99 
102  {
103  CharacterInformation() : advance(0.0f), offset(0.0f), glyphIndex(0), changeColor(false), glyphDefined(true)
104  {
105  color[0] = color[1] = color[2] = color[3] = 1.0;
106  };
108  advance(orig.advance), offset(orig.offset), glyphIndex(orig.glyphIndex), changeColor(orig.changeColor),
109  glyphDefined(orig.glyphDefined) { memcpy(color, orig.color, sizeof(color)); };
110 
111  float color[4];
114  unsigned short glyphIndex;
117  };
118 
122  {
123  LineInformation() : margin(0.0f), alignment(0) {}
125  margin(orig.margin), alignment(orig.alignment), characters(orig.characters) {};
126 
127  float margin;
128  unsigned int alignment;
129  std::vector<CharacterInformation> characters;
130  };
131 
132  typedef std::vector<LineInformation> Lines;
134 
135  double myLineLength;
137  };
138 }

Document ID: Generated on Wed Jul 25 16:57:45 EDT 2018 from SVN revision 190790
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)