-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Type 2.0 #7356
Merged
Merged
Type 2.0 #7356
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
add p5v1 missing images to `manual-test-exmples/type`
Type 2.0 visual - remove `type.v1.js`
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.
PR for typography module 2.0
There are a number of new functions added to the p5 prototype that should be discussed:
textBounds
: tight bounds, now supported for all fonts, not just those with paths as in v1fontBounds
: gives the (loose) bounds for the font, regardless of characters usedfontWidth
: gives the (loose) width of a string of given length in the font, regardless of the characterstextProperty
: allows set/get for one of about 20 font-related propertiestextProperties
: allows batch set/get for one or more of about 20 font-related propertiestextToPoints
: a correct version via typr.js (need to support for path sampling)textToPaths
: returns a more complex object to allow rendering of pathstextDirection
: exposing this directly for wider accesstextWeight
: specifies weight via num (100-900) or keyword, requires support in font (useful with variable fonts)fontAscent
: gives the ascent for the font itself (the max of any glyph)fontDescent
: gives the descent for the font itself (the max of any glyph)Issues/Questions/Notes:
@font-face { font-family: 'Diwani'; font-weight: 400; font-stretch: normal; src: url('https://fonts.gstatic.com/s/notonaskharabic/v17/RrQ5bpV-9Dd1b1OAGA6M9PkyDuVBePeKNaxcsss0Y7bwvc5Urqc3.ttf') format('truetype'); font-style: normal; }
loadFont
... but there are many complications here, including the fact that many individual fonts could be loaded over the network.textFont()
with the string as first argument (which must include family and size, as per HTML5 spec for font shorthand)p5.Font.textToPaths()
now returns an array of path commands in the format: [ ['M', x1, y1], ['Q', x1, y1, x2, y2,] ... ],