maplibre-rs icon indicating copy to clipboard operation
maplibre-rs copied to clipboard

Text rendering

Open FabianWildgrube opened this issue 3 years ago • 8 comments

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 🤷 😉

FabianWildgrube avatar Apr 24 '22 15:04 FabianWildgrube

First tests added, see PR https://github.com/maplibre/maplibre-rs/pull/35

FabianWildgrube avatar Apr 24 '22 15:04 FabianWildgrube

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!

nyurik avatar Apr 25 '22 00:04 nyurik

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 👍

FabianWildgrube avatar Apr 25 '22 12:04 FabianWildgrube

New draft PR from my Fork is open: https://github.com/maplibre/maplibre-rs/pull/40

FabianWildgrube avatar Apr 25 '22 12:04 FabianWildgrube

Thanks @FabianWildgrube :)

nyurik avatar Apr 25 '22 13:04 nyurik

@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)

DerKarlos avatar Sep 23 '22 18:09 DerKarlos

@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

maxammann avatar Sep 24 '22 09:09 maxammann