From 82cc2fc6205b7eac20e9383291bb890de27bee3f Mon Sep 17 00:00:00 2001 From: M66B Date: Mon, 6 Sep 2021 12:16:59 +0200 Subject: [PATCH] Fixed line distance / font size --- .../java/eu/faircode/email/HtmlHelper.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/app/src/main/java/eu/faircode/email/HtmlHelper.java b/app/src/main/java/eu/faircode/email/HtmlHelper.java index d9ebb52ded..e466a82da5 100644 --- a/app/src/main/java/eu/faircode/email/HtmlHelper.java +++ b/app/src/main/java/eu/faircode/email/HtmlHelper.java @@ -2760,6 +2760,26 @@ public class HtmlHelper { break; case "br": ssb.append('\n'); + + int l = ssb.length() - 1; + List spans = new ArrayList<>(); + spans.addAll(Arrays.asList(ssb.getSpans(l, l, AbsoluteSizeSpan.class))); + spans.addAll(Arrays.asList(ssb.getSpans(l, l, RelativeSizeSpan.class))); + for (Object span : spans) { + int s = ssb.getSpanStart(span); + int e = ssb.getSpanEnd(span); + int f = ssb.getSpanFlags(span); + if (e == l) { + ssb.removeSpan(span); + if (span instanceof AbsoluteSizeSpan) { + int size = ((AbsoluteSizeSpan) span).getSize(); + setSpan(ssb, new AbsoluteSizeSpan(size), s, e + 1, f); + } else if (span instanceof RelativeSizeSpan) { + float size = ((RelativeSizeSpan) span).getSizeChange(); + setSpan(ssb, new RelativeSizeSpan(size), s, e + 1, f); + } + } + } break; case "body": // Do nothing