mirror of https://github.com/axmolengine/axmol.git
[Linux] fixed horizontal font alignment
kAlignTop and kAlignBottom should center text horizontally
This commit is contained in:
parent
e02bc8ad30
commit
9b8f3ca01e
|
@ -194,11 +194,11 @@ public:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eAlignMask == CCImage::kAlignCenter) {
|
if (eAlignMask == CCImage::kAlignCenter || eAlignMask == CCImage::kAlignTop || eAlignMask == CCImage::kAlignBottom) {
|
||||||
iRet = (iMaxLineWidth - vLines[iLineIndex].iLineWidth) / 2
|
iRet = (iMaxLineWidth - vLines[iLineIndex].iLineWidth) / 2
|
||||||
- SHIFT6(face->glyph->metrics.horiBearingX );
|
- SHIFT6(face->glyph->metrics.horiBearingX );
|
||||||
|
|
||||||
} else if (eAlignMask == CCImage::kAlignRight) {
|
} else if (eAlignMask == CCImage::kAlignRight || eAlignMask == CCImage::kAlignTopRight || eAlignMask == CCImage::kAlignBottomRight) {
|
||||||
iRet = (iMaxLineWidth - vLines[iLineIndex].iLineWidth)
|
iRet = (iMaxLineWidth - vLines[iLineIndex].iLineWidth)
|
||||||
- SHIFT6(face->glyph->metrics.horiBearingX );
|
- SHIFT6(face->glyph->metrics.horiBearingX );
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue