tldraw/packages
Mime Čuvalo c66da1013e
text labels: address some rendering inconsistencies with the content vs. textarea (#3830)
original bug was this:


https://github.com/tldraw/tldraw/assets/469604/1bb3c401-4221-4981-b4d9-7325ea27944c

it seemed to be related to how the Draw font specifically was kerning or
something (maybe ligatures??), we don't really know. it seems to be only
Chrome specific.

See video:


https://github.com/tldraw/tldraw/assets/469604/1a54ba78-ebd5-4ddf-9351-3ecc44a8702a

Also, there's a line height issue when resizing vertically:


https://github.com/tldraw/tldraw/assets/469604/b7b3ac16-70a6-476c-8f23-e619725799b6

So, to address these various things:
- for the overflow bug (and related Draw font issue), we do `Math.ceil`
to help with this fuzziness. I _think_ this will help but I'm not 100%
certain this will help in all cases.
- for the line height issue, we do `Math.floor` to avoid this subpixel
wonkiness
- for good measure, I made sure that the content & textarea rendering
has matching CSS styles (things like `font-feature-settings`, etc.) the
content now matches what the `textarea` has be default in Chrome's user
agent styling.

fuuuuuuun 🥳 

### Change Type

<!--  Please select a 'Scope' label ️ -->

- [x] `sdk` — Changes the tldraw SDK
- [ ] `dotcom` — Changes the tldraw.com web app
- [ ] `docs` — Changes to the documentation, examples, or templates.
- [ ] `vs code` — Changes to the vscode plugin
- [ ] `internal` — Does not affect user-facing stuff

<!--  Please select a 'Type' label ️ -->

- [x] `bugfix` — Bug fix
- [ ] `feature` — New feature
- [ ] `improvement` — Improving existing features
- [ ] `chore` — Updating dependencies, other boring stuff
- [ ] `galaxy brain` — Architectural changes
- [ ] `tests` — Changes to any test code
- [ ] `tools` — Changes to infrastructure, CI, internal scripts,
debugging tools, etc.
- [ ] `dunno` — I don't know


### Release Notes

- Text labels: fix some inconsistencies with rendering.
2024-06-03 08:28:41 +00:00
..
assets Add heart geo shape (#3787) 2024-05-24 13:04:28 +00:00
dotcom-shared Force interface instead of type for better docs (#3815) 2024-05-22 15:55:49 +00:00
editor text labels: address some rendering inconsistencies with the content vs. textarea (#3830) 2024-06-03 08:28:41 +00:00
namespaced-tldraw Don't check api.json files into git (#3565) 2024-04-24 15:58:26 +00:00
state Force interface instead of type for better docs (#3815) 2024-05-22 15:55:49 +00:00
store Force interface instead of type for better docs (#3815) 2024-05-22 15:55:49 +00:00
tldraw text labels: address some rendering inconsistencies with the content vs. textarea (#3830) 2024-06-03 08:28:41 +00:00
tlschema Add heart geo shape (#3787) 2024-05-24 13:04:28 +00:00
tlsync Force interface instead of type for better docs (#3815) 2024-05-22 15:55:49 +00:00
utils Force interface instead of type for better docs (#3815) 2024-05-22 15:55:49 +00:00
validate Force interface instead of type for better docs (#3815) 2024-05-22 15:55:49 +00:00