Before you submit this issue, have you checked the following
Affected packages and versions
13.0 - 15.1
Reproduction link
- Use a Linux desktop environment with fractional scaling (Tested on COSMIC DE / Wayland).
- Set OS display scaling to 125%.
- Verify
window.devicePixelRatio in the console (Output: 1.25).
- Open a Univer document or spreadsheet.
- Observation: Text in the canvas area (cell content, headers) appears fuzzy.
- Change scaling to 100% or 200%.
- Observation: Text renders crisply.
125% scale screenshots, one from within the app in development, the other from https://universheetsvite-iewl--5173--365214aa.local-corp.webcontainer.io/
If scale was 100% both screenshots would have been sharp.
Expected behavior
Text rendered inside the Canvas element should appear crisp and sharp, matching the clarity of surrounding DOM elements (e.g., toolbars, buttons), regardless of the OS display scaling factor (e.g., 100%, 125%, 150%). The internal resolution of the canvas backing store should automatically adjust to match the physical pixel density implied by window.devicePixelRatio.
Actual behavior
When devicePixelRatio is a fractional value (specifically 1.25 in this test case), the text content within the canvas appears blurry and fuzzy compared to the UI chrome. The rendering suggests that the canvas backing store is either not being sized to the correct floating-point resolution or is being upscaled via linear interpolation by the WebKit engine, resulting in a loss of sharpness. Integer scaling factors (1.0, 2.0) do not exhibit this blur.
The issue appears to be related to how the Univer engine handles non-integer devicePixelRatio values when initializing the Canvas backing store.
- The
width and height attributes of the <canvas> element might not be multiplied correctly by the DPR, or are being rounded incorrectly.
- If the backing store size does not match
CSS width * DPR, the browser blindly scales the bitmap, causing linear interpolation blur.
- Workarounds attempted (none successful)
- Manual Engine Adjustment: Accessed
IRenderManagerService.engine.dprChange() manually—no visible effect.
- CSS Overrides:
image-rendering: pixelated, crisp-edges, and transform: translateZ(0) had no effect.
- Font Loading: Ensured fonts were preloaded via FontFace API.
System information
- Univer version: 0.15.1
- OS: Linux (Pop!_OS / COSMIC DE)
- Display server: Wayland
- Runtime: WebKitGTK (via Tauri 2.x desktop app)
This likely affects any high-DPI setup where the scaling factor is not an integer (Windows at 150%, macOS with non-integer scaled resolutions).
Before you submit this issue, have you checked the following
Affected packages and versions
13.0 - 15.1
Reproduction link
window.devicePixelRatioin the console (Output:1.25).125% scale screenshots, one from within the app in development, the other from https://universheetsvite-iewl--5173--365214aa.local-corp.webcontainer.io/
If scale was 100% both screenshots would have been sharp.
Expected behavior
Text rendered inside the Canvas element should appear crisp and sharp, matching the clarity of surrounding DOM elements (e.g., toolbars, buttons), regardless of the OS display scaling factor (e.g., 100%, 125%, 150%). The internal resolution of the canvas backing store should automatically adjust to match the physical pixel density implied by window.devicePixelRatio.
Actual behavior
When devicePixelRatio is a fractional value (specifically 1.25 in this test case), the text content within the canvas appears blurry and fuzzy compared to the UI chrome. The rendering suggests that the canvas backing store is either not being sized to the correct floating-point resolution or is being upscaled via linear interpolation by the WebKit engine, resulting in a loss of sharpness. Integer scaling factors (1.0, 2.0) do not exhibit this blur.
The issue appears to be related to how the Univer engine handles non-integer
devicePixelRatiovalues when initializing the Canvas backing store.widthandheightattributes of the<canvas>element might not be multiplied correctly by the DPR, or are being rounded incorrectly.CSS width * DPR, the browser blindly scales the bitmap, causing linear interpolation blur.IRenderManagerService.engine.dprChange()manually—no visible effect.image-rendering: pixelated,crisp-edges, andtransform: translateZ(0)had no effect.System information
This likely affects any high-DPI setup where the scaling factor is not an integer (Windows at 150%, macOS with non-integer scaled resolutions).