Skip to content

textmode.js / Textmodifier / pixelDensity

Method: pixelDensity() ​

Call Signature ​

ts
pixelDensity(): number;

Get the current pixel density for HiDPI rendering.

Returns ​

number

Current pixel density.

Example ​

Call Signature ​

ts
pixelDensity(density): void;

Set the pixel density for HiDPI rendering.

This resizes the canvas backing store while keeping the CSS display size unchanged.

Parameters ​

ParameterTypeDescription
densitynumberNew pixel density (> 0).

Returns ​

void

Example ​