Improved font size eval

pull/198/head
M66B 4 years ago
parent 2eb90bc2c3
commit ed802c800f

@ -475,26 +475,25 @@ public class HtmlHelper {
if (!TextUtils.isEmpty(color)) if (!TextUtils.isEmpty(color))
sb.append("color:").append(color).append(";"); sb.append("color:").append(color).append(";");
if (!TextUtils.isEmpty(size)) { if (!TextUtils.isEmpty(size))
try { try {
if (size.startsWith("-")) int s = Integer.parseInt(size);
if (size.startsWith("-")) {
if (s < 0)
size = "smaller"; size = "smaller";
else if (size.startsWith("+")) } else if (size.startsWith("+")) {
if (s > 0)
size = "larger"; size = "larger";
else { } else if (s >= 1 && s < 3)
int s = Integer.parseInt(size);
if (s < 3)
size = "small"; size = "small";
else if (s > 3) else if (s > 3 && s <= 7)
size = "large"; size = "large";
else else
size = "medium"; size = "medium";
}
sb.append("font-size:").append(size).append(";"); sb.append("font-size:").append(size).append(";");
} catch (NumberFormatException ex) { } catch (NumberFormatException ex) {
Log.i(ex); Log.i(ex);
} }
}
if (!TextUtils.isEmpty(face)) { if (!TextUtils.isEmpty(face)) {
sb.append("font-family:"); sb.append("font-family:");

Loading…
Cancel
Save