Overte C++ Documentation
TextRenderer3D.h
1 //
2 // TextRenderer3D.h
3 // interface/src/ui
4 //
5 // Created by Andrzej Kapolka on 4/26/13.
6 // Copyright 2013 High Fidelity, Inc.
7 //
8 // Distributed under the Apache License, Version 2.0.
9 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
10 //
11 
12 #ifndef hifi_TextRenderer3D_h
13 #define hifi_TextRenderer3D_h
14 
15 #include <memory>
16 #include <glm/glm.hpp>
17 
18 #include "text/Font.h"
19 #include "TextEffect.h"
20 #include "TextAlignment.h"
21 #include "FontFamilies.h"
22 
23 class TextRenderer3D {
24 public:
25  static TextRenderer3D* getInstance(const char* family);
26 
27  glm::vec2 computeExtent(const QString& str) const;
28  float getFontSize() const; // Pixel size
29 
30  void draw(gpu::Batch& batch, float x, float y, const glm::vec2& bounds,
31  const QString& str, const glm::vec4& color, bool unlit, bool forward);
32  void draw(gpu::Batch& batch, float x, float y, const glm::vec2& bounds, float scale,
33  const QString& str, const QString& font, const glm::vec4& color, const glm::vec3& effectColor,
34  float effectThickness, TextEffect effect, TextAlignment alignment, bool unlit, bool forward);
35 
36 private:
37  TextRenderer3D(const char* family);
38 
39  QString _family;
40 
41  std::shared_ptr<Font> _font;
42  Font::DrawInfo _drawInfo;
43 
44 };
45 
46 #endif // hifi_TextRenderer3D_h