customdrawn-android: Improves the drawing of the bottom part of letters like g

git-svn-id: trunk@34152 -
This commit is contained in:
sekelsenmat 2011-12-13 10:22:29 +00:00
parent f45d3703b2
commit 50dc7cf2e8
2 changed files with 3 additions and 3 deletions

View File

@ -87,7 +87,7 @@ public class LCLActivity extends Activity
// Don't use just localbounds.height() from the source text // Don't use just localbounds.height() from the source text
// because it will calculate the minimum necessary height, // because it will calculate the minimum necessary height,
// but we can't easily use that to draw text because it draws relative to the baseline // but we can't easily use that to draw text because it draws relative to the baseline
localpaint.getTextBounds("Íq", 0, 2, localbounds); localpaint.getTextBounds("Íqg", 0, 3, localbounds);
lclheight = localbounds.height(); lclheight = localbounds.height();
// Also get some measures // Also get some measures
lcltextascent = (int) localpaint.getFontMetrics().ascent; lcltextascent = (int) localpaint.getFontMetrics().ascent;
@ -110,7 +110,7 @@ public class LCLActivity extends Activity
localcanvas.drawColor(Color.TRANSPARENT); // TRANSPARENT localcanvas.drawColor(Color.TRANSPARENT); // TRANSPARENT
// The Y coordinate is the lower baseline of letters like "abc" // The Y coordinate is the lower baseline of letters like "abc"
// see http://code.google.com/p/android/issues/detail?id=393 // see http://code.google.com/p/android/issues/detail?id=393
localcanvas.drawText(lcltext, 0, lclheight - lcltextdescent, localpaint); localcanvas.drawText(lcltext, 0, lclheight - lcltextbottom, localpaint);
} }
// LCLType definitions // LCLType definitions

View File

@ -4215,7 +4215,7 @@ begin
lAverageCharWidth := javaEnvRef^^.GetIntField(javaEnvRef, javaActivityObject, javaField_lclwidth); lAverageCharWidth := javaEnvRef^^.GetIntField(javaEnvRef, javaActivityObject, javaField_lclwidth);
// Prepare the input for getting the max height of a text and other metrics // Prepare the input for getting the max height of a text and other metrics
lJavaString :=javaEnvRef^^.NewStringUTF(javaEnvRef, PChar(ą')); lJavaString :=javaEnvRef^^.NewStringUTF(javaEnvRef, PChar(g'));
javaEnvRef^^.SetObjectField(javaEnvRef, javaActivityObject, JavaField_lcltext, lJavaString); javaEnvRef^^.SetObjectField(javaEnvRef, javaActivityObject, JavaField_lcltext, lJavaString);
javaEnvRef^^.SetIntField(javaEnvRef, javaActivityObject, javaField_lcltextsize, DefaultFontAndroidSize); javaEnvRef^^.SetIntField(javaEnvRef, javaActivityObject, javaField_lcltextsize, DefaultFontAndroidSize);