diff --git a/app/src/main/java/eu/faircode/email/HtmlEx.java b/app/src/main/java/eu/faircode/email/HtmlEx.java
index f34bfbc734..53fd642cbd 100644
--- a/app/src/main/java/eu/faircode/email/HtmlEx.java
+++ b/app/src/main/java/eu/faircode/email/HtmlEx.java
@@ -420,26 +420,6 @@ public class HtmlEx {
out.append(((URLSpan) style[j]).getURL());
out.append("\">");
}
- if (style[j] instanceof ImageSpan) {
- out.append(" 0)
- out.append(" width=\"").append(w).append("\"");
- int h = img.getHeight();
- if (h > 0)
- out.append(" height=\"").append(h).append("\"");
- }
-
- out.append(">");
-
- // Don't output the dummy character underlying the image.
- i = next;
- }
if (style[j] instanceof AbsoluteSizeSpan) {
AbsoluteSizeSpan s = ((AbsoluteSizeSpan) style[j]);
float sizeDip = s.getSize();
@@ -475,6 +455,29 @@ public class HtmlEx {
}
}
+ for (int j = 0; j < style.length; j++) {
+ if (style[j] instanceof ImageSpan) {
+ out.append(" 0)
+ out.append(" width=\"").append(w).append("\"");
+ int h = img.getHeight();
+ if (h > 0)
+ out.append(" height=\"").append(h).append("\"");
+ }
+
+ out.append(">");
+
+ // Don't output the dummy character underlying the image.
+ i = next;
+ }
+ }
+
withinStyle(out, text, i, next);
for (int j = style.length - 1; j >= 0; j--) {