character size cannot be non-whole number
Author: RichardTjokroutomoCreated Sep 2, 2026Updated Sep 30, 2026
LabelsC-has-manual-testcase
Describe the bug: In Servo, non-whole number character width gets rounded off to the nearest whole number.
For example, if a character's width is supposed to be 13.5px, it will be rounded off to 14px by Servo.
To Reproduce:
<html>
<body>
<p>character width: <span id="width"></span>px</p>
</body>
<script>
const widthText = document.getElementById("width");
const canvas = document.createElement("canvas");
const ctx = canvas.getContext("2d");
ctx.font = "13.5px 'Noto Sans'";
widthText.textContent = ctx.measureText("汉").width;
</script>
</html>On Servo:
On Chrome:
Platform: Tested on HarmonyOS
Source: servo/servo