Skip to content

fix(馃悰): accept booleans in Font.setSubpixel and Font.setEmbolden - #4011

Open
arnovanliere wants to merge 2 commits into
Shopify:mainfrom
arnovanliere:fix/font-boolean-setters
Open

fix(馃悰): accept booleans in Font.setSubpixel and Font.setEmbolden#4011
arnovanliere wants to merge 2 commits into
Shopify:mainfrom
arnovanliere:fix/font-boolean-setters

Conversation

@arnovanliere

Copy link
Copy Markdown

Both are declared as (value: boolean) => void in the TypeScript API, and the CanvasKit backend forwards the boolean straight through. On native they were bound with a double parameter, so JSIConverter<double> called asNumber() on the argument and a real boolean threw:

Exception in HostFunction: Value is true, expected a number

Binding them as bool routes through JSIConverter<bool>, which uses asBool(), matching the two neighbouring boolean setters (setEmbeddedBitmaps and setLinearMetrics) and the declared API.

The double parameters date back to the typed-bindings migration (#3965), which preserved the previous asNumber() behaviour so as not to change semantics in a mechanical refactor. That kept the JS API unusable on native without casting the argument to a number.

Both are declared as `(value: boolean) => void` in the TypeScript API, and
the CanvasKit backend forwards the boolean straight through. On native they
were bound with a `double` parameter, so `JSIConverter<double>` called
`asNumber()` on the argument and a real boolean threw:

    Exception in HostFunction: Value is true, expected a number

Binding them as `bool` routes through `JSIConverter<bool>`, which uses
`asBool()`, matching the two neighbouring boolean setters
(`setEmbeddedBitmaps` and `setLinearMetrics`) and the declared API.

The `double` parameters date back to the typed-bindings migration (Shopify#3965),
which preserved the previous `asNumber()` behaviour so as not to change
semantics in a mechanical refactor. That kept the JS API unusable on native
without casting the argument to a number.
@arnovanliere

Copy link
Copy Markdown
Author

I have signed the CLA!

@wcandillon
wcandillon self-requested a review August 22, 2026 09:13

@wcandillon wcandillon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank You for catching this :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants