Skip to content

[Bug] Surrogate pair handled incorrectly #3422

Description

@exoego

Describe the bug

Surrogate pairs render brokenly, because fontSubstitution walks the string one UTF-16 code unit at a time and queries the high and low surrogate halves against hasGlyphForCodePoint separately, so the combined code point is never looked up in the font stack.

Affected characters

To Reproduce
playgorund

Expected behavior
fontSubstitution should combine each surrogate pair into its single code point before consulting the font stack, so a font that supports surrogate pair (e.g. Noto Sans JP for U+20BB7) is picked and the glyph renders correctly.

Desktop (please complete the following information):

  • OS: Linux
  • Browser: Node.js
  • React-pdf version: v4.5.1

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