The first letter of each word on new line is cut off for us denealian cursive font.
see the picture this one is with padding.If I am not using any padding ,it will be like in pic 2
This is my code
<com.font.anything.writinghelper
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textColor="#000000"
android:padding="20dip"
android:textSize="60sp"
android:text="japanese google donkey elephant ostrich"
/>
Here writing helper is a class extending textview just to underline the text
protected void onDraw(Canvas canvas) {
// TODO Auto-generated method stub
Rect r = mRect;
int padding =55;
Paint paint = mPaint;
int count = getLineCount();
for (int i = 0; i < count; i++) {
int baseline = getLineBounds(i, r);
canvas.drawLine(r.left - padding, baseline, r.right + padding,
baseline, paint);
}
super.onDraw(canvas);
}
Can anyone help.?
Edit
Requested screenshot
Is There a way to put some extra space towards left side of the TextView ?
The zoom percentage that the document is set to may cause characters to have the top or bottom portion of the screen font cut off. You can adjust the zoom percentage from 75 percent to 100 percent in most cases to correct this visually.
This can happen when you use a font designed by an amateur, or when the line spacing is set below about Multiple 0.75 or when line spacing is set to Exact and the measurement is less that the size of the text. Posting a screen shot of your paragraph settings would also help.
Finally I made a work around for this..It's a font issue and I am not sure it can be fixed by any other way.So what I have done is ,first get the TextView Layout and get the end and start of each line and hence obtain string in each line.Now append space in front of each line .Here is the entire code.May help someone else.
ArrayList<String> lines = new ArrayList<String>();
ArrayList<String> newLines = new ArrayList<String>();
String line="";
String text = getText().toString();
Layout layout = getLayout();
int start=0;
int end;
for (int i=0; i<count; i++) {
end = layout.getLineEnd(i);
lines.add(text.substring(start,end));
line = lines.get(i);
start = end;
String nwText = "";
nwText = " "+ line+" ";
newLines.add(nwText);
}
Paint mPaint = getPaint();
int i = 0;
// String[] textLines = Results.split("\\n+");
//float textsize = getTextSize();
for (String textLine : newLines)
{
// mPaint.setTextSize(textsize);
int baseline = getLineBounds(i, r);
canvas.drawText(textLine, 0, baseline, mPaint);
i++;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With