mirror of https://github.com/M66B/FairEmail.git
Fixed very small/large fonts
This commit is contained in:
parent
082eb6f262
commit
dad15fe4f6
|
@ -405,8 +405,22 @@ public class HtmlHelper {
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/CSS/font-size
|
// https://developer.mozilla.org/en-US/docs/Web/CSS/font-size
|
||||||
Element parent = element.parent();
|
Element parent = element.parent();
|
||||||
if (parent != null) {
|
if (parent != null) {
|
||||||
|
boolean set = false;
|
||||||
|
boolean small = false;
|
||||||
|
boolean big = false;
|
||||||
Integer current = null;
|
Integer current = null;
|
||||||
while (parent != null) {
|
while (parent != null) {
|
||||||
|
if (!set) {
|
||||||
|
if ("small".equals(parent.tagName())) {
|
||||||
|
set = true;
|
||||||
|
small = true;
|
||||||
|
}
|
||||||
|
if ("big".equals(parent.tagName())) {
|
||||||
|
set = true;
|
||||||
|
big = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String xFontSize = parent.attr("x-font-size");
|
String xFontSize = parent.attr("x-font-size");
|
||||||
if (!TextUtils.isEmpty(xFontSize)) {
|
if (!TextUtils.isEmpty(xFontSize)) {
|
||||||
current = Integer.parseInt(xFontSize);
|
current = Integer.parseInt(xFontSize);
|
||||||
|
@ -417,7 +431,7 @@ public class HtmlHelper {
|
||||||
|
|
||||||
Float fsize = getFontSize(value, current);
|
Float fsize = getFontSize(value, current);
|
||||||
if (fsize != null && fsize != 0 &&
|
if (fsize != null && fsize != 0 &&
|
||||||
(fsize <= 0.8f || fsize >= 1.25)) {
|
((!small && fsize <= 0.8f) || (!big && fsize >= 1.25))) {
|
||||||
Element e = new Element(fsize < 1 ? "small" : "big");
|
Element e = new Element(fsize < 1 ? "small" : "big");
|
||||||
e.attr("x-font-size", Integer.toString(Math.round(16 * fsize)));
|
e.attr("x-font-size", Integer.toString(Math.round(16 * fsize)));
|
||||||
element.replaceWith(e);
|
element.replaceWith(e);
|
||||||
|
|
Loading…
Reference in New Issue