1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-26 17:57:16 +00:00

Fixed font size units

This commit is contained in:
M66B 2021-02-25 13:32:33 +01:00
parent 526f6b66ff
commit 5ce29f16d7

View file

@ -1375,9 +1375,11 @@ public class HtmlHelper {
if (value.endsWith("pc")) // 6 pc = 72 pt if (value.endsWith("pc")) // 6 pc = 72 pt
return Float.parseFloat(value.substring(0, value.length() - 2).trim()) / 12 / DEFAULT_FONT_SIZE_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 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 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; return Float.parseFloat(value.trim()) / DEFAULT_FONT_SIZE;
} catch (NumberFormatException ex) { } catch (NumberFormatException ex) {
Log.i(ex); Log.i(ex);