Overte C++ Documentation
Glyph.h
1 //
2 // Created by Bradley Austin Davis on 2015/07/16
3 // Copyright 2013 High Fidelity, Inc.
4 //
5 // Distributed under the Apache License, Version 2.0.
6 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
7 //
8 
9 #pragma once
10 #ifndef hifi_Glyph_h
11 #define hifi_Glyph_h
12 
13 #include <stdint.h>
14 
15 #include <QChar>
16 #include <QRect>
17 #include <QIODevice>
18 
19 #include <GLMHelpers.h>
20 
21 // stores the font metrics for a single character
22 struct Glyph {
23  QChar c;
24  vec2 texOffset;
25  vec2 texSize;
26  vec2 size;
27  vec2 offset;
28  float d; // xadvance - adjusts character positioning
29  size_t indexOffset;
30 
31  // We adjust bounds because offset is the bottom left corner of the font but the top left corner of a QRect
32  QRectF bounds() const;
33  QRectF textureBounds() const;
34 
35  void read(QIODevice& in);
36 };
37 
38 #endif