maplibre / maplibre-rs

Experimental Maps for Web, Mobile and Desktop
Apache License 2.0
1.35k stars 79 forks source link

Text rendering #36

Open FabianWildgrube opened 2 years ago

FabianWildgrube commented 2 years ago

We need to add support for rendering arbitrary text (labels, street names, etc.). An ideal solution would have the following properties:

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 commented 2 years ago

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

nyurik commented 2 years ago

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!

FabianWildgrube commented 2 years ago

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 commented 2 years ago

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

nyurik commented 2 years ago

Thanks @FabianWildgrube :)

DerKarlos commented 2 years ago

@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 commented 2 years ago

@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 commented 3 months ago

Here is some comparision between libraries used in bevy: https://hackmd.io/-0nNajS9QaGNu9FWg41ziA