mapbox / mapbox/mapbox-gl-js

How to preserve the leading/tailing spaces in text?

Open
#8,346 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs discussion :speech_balloon:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

mapbox-gl-js version: v0.42.2

Question

The leading/tailing spaces look not rendered on the map.
In my test, there are some text like " 15 " was rendered as "15", with anchor at left, the text is kind of offset left a bit, and if the text has rotation, the offset is in another rotated direction as well.
So, the question is, is there any way to render the leading/trailing spaces in a text in MapBox GL JS?

I did some search, didn't find a way to render the leading spaces to make the text location better.

Any suggestion would be much appreciated!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported rendering of " 15 " in Mapbox GL JS v0.42.2 with a left anchor and text rotation. Trace the existing text-rendering behavior to determine whether leading and trailing spaces can be preserved; done means establishing supported behavior or a clearly documented limitation.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
computer-graphics, frontend, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.