mwg API
    Preparing search index...

    Function sharpenText

    • Re-rasterises every Text under root at devicePixelRatio times its own on-screen scale, rounded to a whole number. Pixi draws text at the renderer's resolution and knows nothing of a parent's zoom, so text inside a scaled container is otherwise 1x text magnified, and blurry. Call it after a layout or zoom change, not every frame; a text already at the right resolution is left untouched.

      Parameters

      • root: Container
      • devicePixelRatio: number

      Returns void

      import { Container } from 'pixi.js';
      import { sharpenText } from '@datamoc/mwg/two-d/ui';

      const panel = new Container();
      panel.scale.set(3);
      sharpenText(panel, 2); // every Text inside now rasterises at 6x