50 lines
1.1 KiB
C++
50 lines
1.1 KiB
C++
// Copyright (c) 2022 Dominic Masters
|
|
//
|
|
// This software is released under the MIT License.
|
|
// https://opensource.org/licenses/MIT
|
|
|
|
#include "FontMeasure.hpp"
|
|
|
|
using namespace Dawn;
|
|
|
|
float_t FontMeasure::getWidth() {
|
|
return this->width;
|
|
}
|
|
|
|
float_t FontMeasure::getHeight() {
|
|
return this->height;
|
|
}
|
|
|
|
int32_t FontMeasure::getQuadCount() {
|
|
return this->realLength;
|
|
}
|
|
|
|
float_t FontMeasure::getHeightOfLineCount(size_t lineCount) {
|
|
assertTrue(lineCount > 0);
|
|
return this->lineHeight * lineCount;
|
|
}
|
|
|
|
size_t FontMeasure::getLineCount() {
|
|
return this->lines.size();
|
|
}
|
|
|
|
int32_t FontMeasure::getQuadsOnLine(size_t line) {
|
|
assertTrue(line >= 0);
|
|
assertTrue(line < this->lines.size());
|
|
return this->lines[line].length;
|
|
}
|
|
|
|
int32_t FontMeasure::getQuadIndexOnLine(size_t line) {
|
|
assertTrue(line >= 0);
|
|
assertTrue(line < this->lines.size());
|
|
return this->lines[line].start;
|
|
}
|
|
|
|
void FontMeasure::addLine(int32_t start, int32_t len) {
|
|
assertTrue(start >= 0);
|
|
assertTrue(len >= 0);
|
|
struct FontLineMeasure info;
|
|
info.start = start;
|
|
info.length = len;
|
|
this->lines.push_back(info);
|
|
} |