-
Notifications
You must be signed in to change notification settings - Fork 3
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
Embed text as paths #20
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node-fetch remains pinned at ^2 because ^3 only provides ES modules which are painful to use with jest right now.
Our chrome API mock now supports sendMessage(), by calling listeners registered on chrome.runtime.onMessage.
This service can generate SVG paths from strings of text, with custom fonts. We'll use it to remove the need to embed reference/embed web fonts in our generated SVG files. It's implemented as a separate service in order to maintain a clear boundary between this portion of the codebase and the rest. The reason for that is that we use opentype.js for text to path rendering, and this library is massive (—0.5MB of js) and I want the code to remain auditable. Bundling so much code into the main part of the app goes against that goal.
Like @preact/signals's computed(), but for async compute functions.
We need to be able to use async functions to generate avatar SVG so that we can async-fetch text-to-path results when rendering the NFT card avatar.
We now generate SVG <path>s to represent text that previously used web fonts. This removes all external dependencies, so SVG docs are entirely stand-alone. It also allows them to be rendered correctly by programs not capable of rendering web fonts in SVG (e.g. Inkscape). A further benefit is that Firefox can render these SVG docs to a canvas, without the need to embed the fonts as data: URIs (FF doesn't allow external references in SVG files rendered to a canvas). We keep an invisible <text> element at the same position as the visible <path> text, so the text is still present in the SVG file for metadata & copying to clipboard purposes.
This was referenced Jan 14, 2023
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We now generate SVG s to represent text that previously used web
fonts. This removes all external dependencies, so SVG docs are entirely
stand-alone. It also allows them to be rendered correctly by programs
not capable of rendering web fonts in SVG (e.g. Inkscape).
A further benefit is that Firefox can render these SVG docs to a canvas,
without the need to embed the fonts as data: URIs (FF doesn't allow
external references in SVG files rendered to a canvas).
We keep an invisible element at the same position as the visible
text, so the text is still present in the SVG file for metadata
& copying to clipboard purposes.
This implements #1 .