add lineHeight

This commit is contained in:
jrkb 2023-05-02 20:37:32 +02:00
parent a70ece33f1
commit fd888cf60c

View file

@ -1143,7 +1143,8 @@ class Font {
std::vector <BoundingBox> & boundingBoxes,
float & advanceY,
const bool vFlip = false,
const float fontSize_px = 42){
const float fontSize_px = 42,
const float lineHeightMultiplier = 1){
float advanceX = 0;
@ -1168,7 +1169,7 @@ class Font {
if(charcode == '\n'){
advanceX = 0;
advanceY += getLineHeight(fontSize_px);
advanceY += getLineHeight(fontSize_px) * lineHeightMultiplier;
if(!vFlip){
advanceY *= -1;
}
@ -1188,7 +1189,6 @@ class Font {
FT_Error error = FT_Get_Kerning(face, previous, glyph.index, kerningMode, &kerning);
if(!error){
advanceX += (((float)kerning.x * letterFontSize_px)) / emSize * worldSize;
cout << "WHAT IS THIS EVEN HAPPYNG";
}
}
@ -1243,7 +1243,7 @@ class Font {
boundingBox.p1 = glm::vec4(maxX, minY, 0, 1);
boundingBox.p2 = glm::vec4(maxX, maxY, 0, 1);
boundingBox.p3 = glm::vec4(minX, maxY, 0, 1);
advanceY += getLineHeight(fontSize_px);
advanceY += getLineHeight(fontSize_px) * lineHeightMultiplier;
if(!vFlip){
advanceY *= -1;
}