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

d2js: add support for custom fonts #2384

Merged
merged 3 commits into from
Feb 27, 2025
Merged

Conversation

x-delfino
Copy link
Contributor

@x-delfino x-delfino commented Feb 25, 2025

Adds support for custom fonts in d2js by passing a byte array of the ttf file

const result = await d2.compile(input, {
  fontBold: [0, 1, 0, 0], // ... contents of .ttf file
});
const svg = await d2.render(result.diagram, result.renderOptions);

example screenshot of custom font:

Screenshot

Copy link
Collaborator

@alixander alixander left a comment

Choose a reason for hiding this comment

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

Awesome, thanks again -- just a minor comment

@x-delfino x-delfino requested a review from alixander February 27, 2025 18:45
Copy link
Collaborator

@alixander alixander left a comment

Choose a reason for hiding this comment

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

lgtm!

@alixander alixander merged commit 11dc4eb into terrastruct:master Feb 27, 2025
3 checks passed
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