add lineHeight
This commit is contained in:
parent
a70ece33f1
commit
fd888cf60c
1 changed files with 4 additions and 4 deletions
|
@ -1143,7 +1143,8 @@ class Font {
|
||||||
std::vector <BoundingBox> & boundingBoxes,
|
std::vector <BoundingBox> & boundingBoxes,
|
||||||
float & advanceY,
|
float & advanceY,
|
||||||
const bool vFlip = false,
|
const bool vFlip = false,
|
||||||
const float fontSize_px = 42){
|
const float fontSize_px = 42,
|
||||||
|
const float lineHeightMultiplier = 1){
|
||||||
|
|
||||||
float advanceX = 0;
|
float advanceX = 0;
|
||||||
|
|
||||||
|
@ -1168,7 +1169,7 @@ class Font {
|
||||||
|
|
||||||
if(charcode == '\n'){
|
if(charcode == '\n'){
|
||||||
advanceX = 0;
|
advanceX = 0;
|
||||||
advanceY += getLineHeight(fontSize_px);
|
advanceY += getLineHeight(fontSize_px) * lineHeightMultiplier;
|
||||||
if(!vFlip){
|
if(!vFlip){
|
||||||
advanceY *= -1;
|
advanceY *= -1;
|
||||||
}
|
}
|
||||||
|
@ -1188,7 +1189,6 @@ class Font {
|
||||||
FT_Error error = FT_Get_Kerning(face, previous, glyph.index, kerningMode, &kerning);
|
FT_Error error = FT_Get_Kerning(face, previous, glyph.index, kerningMode, &kerning);
|
||||||
if(!error){
|
if(!error){
|
||||||
advanceX += (((float)kerning.x * letterFontSize_px)) / emSize * worldSize;
|
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.p1 = glm::vec4(maxX, minY, 0, 1);
|
||||||
boundingBox.p2 = glm::vec4(maxX, maxY, 0, 1);
|
boundingBox.p2 = glm::vec4(maxX, maxY, 0, 1);
|
||||||
boundingBox.p3 = glm::vec4(minX, maxY, 0, 1);
|
boundingBox.p3 = glm::vec4(minX, maxY, 0, 1);
|
||||||
advanceY += getLineHeight(fontSize_px);
|
advanceY += getLineHeight(fontSize_px) * lineHeightMultiplier;
|
||||||
if(!vFlip){
|
if(!vFlip){
|
||||||
advanceY *= -1;
|
advanceY *= -1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue