add letterSpacing
This commit is contained in:
parent
e17c0e4038
commit
a70ece33f1
1 changed files with 7 additions and 2 deletions
|
@ -152,6 +152,7 @@ struct GlyphAppearance {
|
|||
uint32_t charcode;
|
||||
std::array <float, 4> color;
|
||||
float fontSize_px;
|
||||
float letterSpacing;
|
||||
};
|
||||
}
|
||||
// create hash for GlyphIdentity, so we can use it in our unordered_map as key
|
||||
|
@ -1157,7 +1158,7 @@ class Font {
|
|||
if(glyphIdentity.charcode == '\0'){
|
||||
break;
|
||||
}
|
||||
float letterFontSize_px = glyphAppearance.fontSize_px; // can be individual
|
||||
float letterFontSize_px = glyphAppearance.fontSize_px;
|
||||
const uint32_t & charcode = glyphIdentity.charcode;
|
||||
|
||||
if(charcode == '\r'){
|
||||
|
@ -1186,10 +1187,14 @@ class Font {
|
|||
FT_Vector kerning;
|
||||
FT_Error error = FT_Get_Kerning(face, previous, glyph.index, kerningMode, &kerning);
|
||||
if(!error){
|
||||
advanceX += ((float)kerning.x * letterFontSize_px) / emSize * worldSize;
|
||||
advanceX += (((float)kerning.x * letterFontSize_px)) / emSize * worldSize;
|
||||
cout << "WHAT IS THIS EVEN HAPPYNG";
|
||||
}
|
||||
}
|
||||
|
||||
float letterSpacing = advanceX == 0 ? 0 : glyphAppearance.letterSpacing;
|
||||
advanceX += (letterSpacing * letterFontSize_px) * worldSize;
|
||||
|
||||
// Do not emit quad for empty glyphs (whitespace).
|
||||
if(glyph.curveCount){
|
||||
FT_Pos d = (FT_Pos)(emSize * dilation);
|
||||
|
|
Loading…
Reference in a new issue