overte/libraries/render-utils/src/text/Glyph.cpp
2015-07-16 15:56:01 -07:00

22 lines
569 B
C++

#include "Glyph.h"
#include <StreamHelpers.h>
// We adjust bounds because offset is the bottom left corner of the font but the top left corner of a QRect
QRectF Glyph::bounds() const {
return glmToRect(offset, size).translated(0.0f, -size.y);
}
QRectF Glyph::textureBounds() const {
return glmToRect(texOffset, texSize);
}
void Glyph::read(QIODevice& in) {
uint16_t charcode;
readStream(in, charcode);
c = charcode;
readStream(in, texOffset);
readStream(in, size);
readStream(in, offset);
readStream(in, d);
texSize = size;
}