Quote in right direction

This commit is contained in:
M66B
2021-07-07 20:07:11 +02:00
parent e0216a142d
commit 1de051615b
4 changed files with 20 additions and 4 deletions

View File

@@ -126,7 +126,6 @@ public class HtmlHelper {
static final float FONT_SMALL = 0.8f;
static final float FONT_LARGE = 1.25f;
static final String QUOTE_STYLE = "border-left:3px solid #ccc; padding-left:3px;";
private static final int DEFAULT_FONT_SIZE = 16; // pixels
private static final int DEFAULT_FONT_SIZE_PT = 12; // points
@@ -2013,6 +2012,22 @@ public class HtmlHelper {
return d.text();
}
static String getQuoteStyle(Element e) {
CharSequence text = e.text();
return getQuoteStyle(text, 0, text.length());
}
static String getQuoteStyle(CharSequence quoted, int start, int end) {
try {
if (TextDirectionHeuristics.FIRSTSTRONG_LTR.isRtl(quoted, start, end))
return "border-right:3px solid #ccc; padding-left:3px;";
} catch (Throwable ex) {
Log.e(ex);
}
return "border-left:3px solid #ccc; padding-left:3px;";
}
static boolean hasBorder(Element e) {
return "true".equals(e.attr("x-border"));
}