Compose font size improvements

pull/187/head
M66B 4 years ago
parent f2b420de0a
commit 18d64c5f3a

@ -571,6 +571,12 @@ public class HtmlHelper {
Float fsize = getFontSize(value, current); Float fsize = getFontSize(value, current);
if (fsize != null && fsize != 0) { if (fsize != null && fsize != 0) {
if (!view) {
if (fsize < 1)
fsize = FONT_SMALL;
else if (fsize > 1)
fsize = FONT_LARGE;
}
element.attr("x-font-size", Float.toString(fsize)); element.attr("x-font-size", Float.toString(fsize));
element.attr("x-font-size-rel", Float.toString(fsize / current)); element.attr("x-font-size-rel", Float.toString(fsize / current));
} }
@ -2059,6 +2065,7 @@ public class HtmlHelper {
String xFontSize = element.attr("x-font-size-rel"); String xFontSize = element.attr("x-font-size-rel");
if (!TextUtils.isEmpty(xFontSize)) { if (!TextUtils.isEmpty(xFontSize)) {
Float fsize = Float.parseFloat(xFontSize); Float fsize = Float.parseFloat(xFontSize);
if (fsize != 1.0f)
setSpan(ssb, new RelativeSizeSpan(fsize), start, ssb.length()); setSpan(ssb, new RelativeSizeSpan(fsize), start, ssb.length());
} }
@ -2342,7 +2349,10 @@ public class HtmlHelper {
try { try {
String hsize = style.substring(colon + 1, semi).replace(',', '.'); String hsize = style.substring(colon + 1, semi).replace(',', '.');
float size = Float.parseFloat(hsize); float size = Float.parseFloat(hsize);
element.tagName(size < 1.0f ? "small" : "big"); if (size < 1.0f)
element.tagName("small");
else if (size > 1.0f)
element.tagName("big");
element.attributes().remove("style"); element.attributes().remove("style");
} catch (NumberFormatException ex) { } catch (NumberFormatException ex) {
Log.e(ex); Log.e(ex);

Loading…
Cancel
Save