Improved font size eval

This commit is contained in:
M66B 2021-04-20 20:17:00 +02:00
parent 2eb90bc2c3
commit ed802c800f
1 changed files with 14 additions and 15 deletions

View File

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