use of jp.sblo.pandora.jota.text.style.LeadingMarginSpan in project Jota-Text-Editor-old by jiro-aqua.
the class Layout method getParagraphLeft.
/**
* Get the left edge of the specified paragraph, inset by left margins.
*/
public final int getParagraphLeft(int line) {
int dir = getParagraphDirection(line);
int left = 0;
boolean par = false;
int off = getLineStart(line);
if (off == 0 || mText.charAt(off - 1) == '\n')
par = true;
if (dir == DIR_LEFT_TO_RIGHT) {
if (mSpannedText) {
Spanned sp = (Spanned) mText;
LeadingMarginSpan[] spans = sp.getSpans(getLineStart(line), getLineEnd(line), LeadingMarginSpan.class);
for (int i = 0; i < spans.length; i++) {
boolean margin = par;
LeadingMarginSpan span = spans[i];
if (span instanceof LeadingMarginSpan.LeadingMarginSpan2) {
int count = ((LeadingMarginSpan.LeadingMarginSpan2) span).getLeadingMarginLineCount();
margin = count >= line;
}
left += span.getLeadingMargin(margin);
}
}
}
return left;
}
use of jp.sblo.pandora.jota.text.style.LeadingMarginSpan in project Jota-Text-Editor-old by jiro-aqua.
the class Layout method getParagraphRight.
/**
* Get the right edge of the specified paragraph, inset by right margins.
*/
public final int getParagraphRight(int line) {
int dir = getParagraphDirection(line);
int right = mWidth;
boolean par = false;
int off = getLineStart(line);
if (off == 0 || mText.charAt(off - 1) == '\n')
par = true;
if (dir == DIR_RIGHT_TO_LEFT) {
if (mSpannedText) {
Spanned sp = (Spanned) mText;
LeadingMarginSpan[] spans = sp.getSpans(getLineStart(line), getLineEnd(line), LeadingMarginSpan.class);
for (int i = 0; i < spans.length; i++) {
right -= spans[i].getLeadingMargin(par);
}
}
}
return right;
}
Aggregations