loganzartman / canvas-styled-text Goto Github PK
View Code? Open in Web Editor NEWfillText but with line breaks and multiple styles at once!
Home Page: https://loganzartman.github.io/canvas-styled-text/
fillText but with line breaks and multiple styles at once!
Home Page: https://loganzartman.github.io/canvas-styled-text/
Currently, if you want to center- or bottom-align multiline text, you have to do it manually, because baseline
determines the vertical alignment with respect to the first line of text only. I could add a separate verticalAlign
, but it's unclear how that would interact with baseline
. For example, a combination of baseline='hanging'
and verticalAlign='middle'
seems nonsensical (hanging
with respect to what? what if there are exactly two lines?). I think it would be reasonable to have baseline
align the entire block of multiline text, with the baseline corresponding to:
top
and hanging
,bottom
, alphabetic
, and ideographic
,middle
This would of course be a major version bump because it changes the semantics of baseline
for multiline text, but I'm not sure it's worth trying to define how baseline
and a hypothetical verticalAlign
would interact.
I think this would be awesome and very useful. However, I don't want a buggy, half-working version that only works on latin characters. I'm very interested in using Intl.Segmenter to generate the breakpoints, but it's not yet supported in Firefox (seems like it's tangled up in some efforts to avoid duplicating the functionality in the codebase). It might be worth doing this anyway, given that it's been accepted into the ES spec.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.