|
@@ -409,7 +409,7 @@ class Text extends Drawable {
|
|
|
|
|
|
function initGlyphs( text : String, rebuild = true ) : Void {
|
|
function initGlyphs( text : String, rebuild = true ) : Void {
|
|
if( rebuild ) glyphs.clear();
|
|
if( rebuild ) glyphs.clear();
|
|
- var x = 0., y = 0., xMax = 0., xMin = 0., yMin = 0., prevChar = -1, linei = 0;
|
|
|
|
|
|
+ var x = 0., y = 0., xMax = 0., xMin = 0., yMin = 0., yMax = 0., prevChar = -1, linei = 0;
|
|
var align = textAlign;
|
|
var align = textAlign;
|
|
var lines = new Array<Float>();
|
|
var lines = new Array<Float>();
|
|
var dl = font.lineHeight + lineSpacing;
|
|
var dl = font.lineHeight + lineSpacing;
|
|
@@ -454,6 +454,8 @@ class Text extends Drawable {
|
|
if( e != null ) {
|
|
if( e != null ) {
|
|
if( rebuild ) glyphs.add(x + offs, y, e.t);
|
|
if( rebuild ) glyphs.add(x + offs, y, e.t);
|
|
if( y == 0 && e.t.dy < yMin ) yMin = e.t.dy;
|
|
if( y == 0 && e.t.dy < yMin ) yMin = e.t.dy;
|
|
|
|
+ var ty = y + e.t.dy + e.t.height;
|
|
|
|
+ if( ty > yMax ) yMax = ty;
|
|
x += esize + letterSpacing;
|
|
x += esize + letterSpacing;
|
|
}
|
|
}
|
|
prevChar = cc;
|
|
prevChar = cc;
|
|
@@ -464,7 +466,7 @@ class Text extends Drawable {
|
|
calcXMin = xMin;
|
|
calcXMin = xMin;
|
|
calcYMin = yMin;
|
|
calcYMin = yMin;
|
|
calcWidth = xMax - xMin;
|
|
calcWidth = xMax - xMin;
|
|
- calcHeight = y + font.lineHeight;
|
|
|
|
|
|
+ calcHeight = yMax - yMin;
|
|
calcSizeHeight = y + (font.baseLine > 0 ? font.baseLine : font.lineHeight);
|
|
calcSizeHeight = y + (font.baseLine > 0 ? font.baseLine : font.lineHeight);
|
|
calcDone = true;
|
|
calcDone = true;
|
|
if ( rebuild ) needsRebuild = false;
|
|
if ( rebuild ) needsRebuild = false;
|
|
@@ -477,7 +479,7 @@ class Text extends Drawable {
|
|
|
|
|
|
function get_textHeight() {
|
|
function get_textHeight() {
|
|
updateSize();
|
|
updateSize();
|
|
- return calcHeight;
|
|
|
|
|
|
+ return font.baseLine == 0 ? calcSizeHeight : calcSizeHeight - font.baseLine + font.lineHeight;
|
|
}
|
|
}
|
|
|
|
|
|
function get_textWidth() {
|
|
function get_textWidth() {
|
|
@@ -526,7 +528,7 @@ class Text extends Drawable {
|
|
x = calcXMin;
|
|
x = calcXMin;
|
|
y = calcYMin;
|
|
y = calcYMin;
|
|
w = calcWidth;
|
|
w = calcWidth;
|
|
- h = calcHeight - calcYMin;
|
|
|
|
|
|
+ h = calcHeight;
|
|
}
|
|
}
|
|
addBounds(relativeTo, out, x, y, w, h);
|
|
addBounds(relativeTo, out, x, y, w, h);
|
|
}
|
|
}
|