Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: available Font Family Regression #2731

Merged
merged 2 commits into from
Apr 29, 2024

Conversation

bdkopen
Copy link
Contributor

@bdkopen bdkopen commented Apr 27, 2024

Changes in #2640 caused a regression by not providing proper support for font families made available within the library. This has caused any font families that are built-in to the library to default to Helvetica.

Changes

  • Properly handles run.attributes.font as an array so any strings properlygetOrCreateFont their associated fonts.
  • Update the test page to include fonts made available within the library.

Related

Issue: #2730

Example

Before the change:
image

After the change:
image

Copy link

changeset-bot bot commented Apr 27, 2024

⚠️ No Changeset found

Latest commit: e2afe2c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@bdkopen
Copy link
Contributor Author

bdkopen commented Apr 27, 2024

@diegomura tagging to notify that this fixes a recent regression. Please let me know if you need anything else with this. Thanks!

Copy link
Owner

@diegomura diegomura left a comment

Choose a reason for hiding this comment

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

utACK

@diegomura diegomura changed the title Fix Available Font Family Regression fix: available Font Family Regression Apr 29, 2024
@diegomura diegomura merged commit ee126d6 into diegomura:master Apr 29, 2024
@bdkopen bdkopen deleted the fix-support-for-default-fonts branch April 29, 2024 12:44
@coren-frankel
Copy link
Contributor

My project has v3.4.4 and I just dug through my node modules to find that these changes aren't in the latest release. Please halp!

@bdkopen
Copy link
Contributor Author

bdkopen commented Jun 28, 2024

My project has v3.4.4 and I just dug through my node modules to find that these changes aren't in the latest release. Please halp!

@coren-frankel these changes are merged, but they won't be available until @diegomura releases the next version.

@EvHaus
Copy link

EvHaus commented Jul 7, 2024

FYI -- this change causes the following failure for me if font-family is a string, rather than array:

run.attributes.font.map is not a function. (In 'run.attributes.font.map((font) => typeof font === "string" ? getOrCreateFont(font) : font)', 'run.attributes.font.map' is undefined)

The fix that worked for me is:

const defaultFont = (Array.isArray(run.attributes.font) ? run.attributes.font : [run.attributes.font]).map((font) =>
          typeof font === 'string' ? getOrCreateFont(font) : font,
);

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.

4 participants