Fixed font size units

pull/194/head
M66B 4 years ago
parent 526f6b66ff
commit 5ce29f16d7

@ -1375,9 +1375,11 @@ public class HtmlHelper {
if (value.endsWith("pc")) // 6 pc = 72 pt
return Float.parseFloat(value.substring(0, value.length() - 2).trim()) / 12 / DEFAULT_FONT_SIZE_PT;
if (value.endsWith("cm")) // 1 inch = 2.54 cm
return Float.parseFloat(value.substring(0, value.length() - 2).trim()) / 2.54f / 72 / DEFAULT_FONT_SIZE_PT;
return Float.parseFloat(value.substring(0, value.length() - 2).trim()) / 2.54f * 72 / DEFAULT_FONT_SIZE_PT;
if (value.endsWith("mm")) // 1 inch = 25.4 mm
return Float.parseFloat(value.substring(0, value.length() - 2).trim()) / 25.4f * 72 / DEFAULT_FONT_SIZE_PT;
if (value.endsWith("in")) // 1 inch = 72pt
return Float.parseFloat(value.substring(0, value.length() - 2).trim()) / 72 / DEFAULT_FONT_SIZE_PT;
return Float.parseFloat(value.substring(0, value.length() - 2).trim()) * 72 / DEFAULT_FONT_SIZE_PT;
return Float.parseFloat(value.trim()) / DEFAULT_FONT_SIZE;
} catch (NumberFormatException ex) {
Log.i(ex);

Loading…
Cancel
Save