Use relative percentage font sizes

pull/214/head
M66B 2 years ago
parent f37c563f75
commit e6574ce6a8

@ -434,11 +434,15 @@ public class HtmlEx {
if (style[j] instanceof RelativeSizeSpan) { if (style[j] instanceof RelativeSizeSpan) {
float sizeEm = ((RelativeSizeSpan) style[j]).getSizeChange(); float sizeEm = ((RelativeSizeSpan) style[j]).getSizeChange();
if (sizeEm < 1) if (sizeEm < 1)
out.append(String.format("<span style=\"font-size:%s;\">", out.append(String.format("<span style=\"font-size:%s%%;\">",
sizeEm < HtmlHelper.FONT_SMALL ? "x-small" : "small")); Math.round(100f * (sizeEm < HtmlHelper.FONT_SMALL
? HtmlHelper.FONT_XSMALL
: HtmlHelper.FONT_SMALL))));
else if (sizeEm > 1) else if (sizeEm > 1)
out.append(String.format("<span style=\"font-size:%s;\">", out.append(String.format("<span style=\"font-size:%s%%;\">",
sizeEm > HtmlHelper.FONT_LARGE ? "x-large" : "large")); Math.round(100f * (sizeEm > HtmlHelper.FONT_LARGE
? HtmlHelper.FONT_XLARGE
: HtmlHelper.FONT_LARGE))));
} }
if (style[j] instanceof ForegroundColorSpan) { if (style[j] instanceof ForegroundColorSpan) {
int color = ((ForegroundColorSpan) style[j]).getForegroundColor(); int color = ((ForegroundColorSpan) style[j]).getForegroundColor();

Loading…
Cancel
Save