VN Textbox updated

This commit is contained in:
2022-11-02 00:42:16 -07:00
parent f5e8dd9a8e
commit db90bd1476
8 changed files with 147 additions and 42 deletions

View File

@ -19,6 +19,10 @@ int32_t FontMeasure::getQuadCount() {
return this->realLength;
}
float_t FontMeasure::getHeightOfLineCount(int32_t lineCount) {
return this->lineHeight * lineCount;
}
size_t FontMeasure::getLineCount() {
return this->lines.size();
}

View File

@ -28,6 +28,9 @@ namespace Dawn {
/** Dimensions of the string */
float_t width, height;
/** Height of a single line */
float_t lineHeight;
/**
* Internal method that adds a line to the text buffer process.
*
@ -40,6 +43,7 @@ namespace Dawn {
float_t getHeight();
int32_t getQuadsOnLine(int32_t line);
int32_t getQuadIndexOnLine(int32_t line);
float_t getHeightOfLineCount(int32_t lineCount);
size_t getLineCount();
int32_t getQuadCount();
};

View File

@ -49,10 +49,10 @@ void TrueTypeFont::buffer(
info->length = 0;
info->realLength = 0;
info->lines.clear();
info->lines[0].start = 0;
info->lines[0].length = 0;
info->height = 0;
info->width = 0;
info->height = 0.0f;
info->lineHeight = 0.0f;
mesh.createBuffers(0, 0);
return;
}
@ -72,6 +72,7 @@ void TrueTypeFont::buffer(
info->length = 0;
info->realLength = 0;
info->lines.clear();
info->lineHeight = this->getLineHeight(fontSize) * scale;
// Prepare the line counters
info->addLine(0, 0);