maplibre-rs
maplibre-rs copied to clipboard
Text rendering
We need to add support for rendering arbitrary text (labels, street names, etc.). An ideal solution would have the following properties:
- Supports all languages (obvious -> we show a map of the entire world)
- Renders completely on the GPU as part of the map (otherwise we defeat the purpose of this project: truly cross-platform maps)
- Renders nicely at arbitrary font sizes
- Renders correctly with regards to arbitrary 3-d transformations
- Supports styling (i.e. color, different fonts, etc.)
This poses numerous challenges and likely no solution exists that fulfils all of these criteria. But since this is a clean-slate project we might as well try 🤷 😉
First tests added, see PR https://github.com/maplibre/maplibre-rs/pull/35
Hi @FabianWildgrube, thx for working on this! One minor thing -- please don't create new branches in the maplibre/maplibre-rs -- it is better to create new branches in your own FabianWildgrube/maplibre-rs repo, and create PRs against the main one. Thx!
Oh I see. Sorry about that! I'll close the PR and delete the branch here and open a new PR from my fork instead 👍
New draft PR from my Fork is open: https://github.com/maplibre/maplibre-rs/pull/40
Thanks @FabianWildgrube :)
@maxammann In your Publication [maplibre-rs: toward portable map renderers], the table includes this Rust project: https://github.com/dfyz/osm-renderer It solves text rendering, but not in the GPU, as far as I see. (It renders nice, may be, some solutions could help maplibre-rs)
@maxammann In your Publication [maplibre-rs: toward portable map renderers], the table includes this Rust project: https://github.com/dfyz/osm-renderer It solves text rendering, but not in the GPU, as far as I see. (It renders nice, may be, some solutions could help maplibre-rs)
Definitely interesting project, indeed! The challenge of text rendering is quite different though when rasterizing on the CPU instead of the GPU. The other interesting challenge is text rendering is text shaping (text rendering = glyph rendering + text shaping).
It seems like a naive text shaping is used though: https://github.com/dfyz/osm-renderer/blob/bf95b10885ef09d99b251e243fa2d17b0c693e96/src/draw/font/text_placer.rs