Skip to content

Using fitty synchronously #97

@miguelcobain

Description

@miguelcobain

Problem: we have text with font-size from fitty. When the user tries to print the page, the page size changes, but fitty does not update.

I tried calling fit() on the beforeprint event, but that didn't help. The font-size still didn't update.
I then understood that fitty does its calculations and updates asynchronously in a requestAnimationFrame call. For the layout changes to be effective in the print layout, they need to be done synchronously inside the beforeprint event handler.

Proposed solutions:

  1. provide a way to make the calculations and updates synchronously fitSync() method?
  2. provide an observePrint option, much like the existing observeWindow, that listens to the beforeprint event and recalculates synchronously

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions