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);
size = "smaller"; if (size.startsWith("-")) {
else if (size.startsWith("+")) if (s < 0)
size = "larger"; size = "smaller";
else { } else if (size.startsWith("+")) {
int s = Integer.parseInt(size); if (s > 0)
if (s < 3) size = "larger";
size = "small"; } else if (s >= 1 && s < 3)
else if (s > 3) size = "small";
size = "large"; else if (s > 3 && s <= 7)
else size = "large";
size = "medium"; else
} 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