"text-offset" responsive to "text-font" by glyph?
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
I'm creating a map with labels requiring the Unicode characters \u0141 and \u0142 (Latin Barred L)
I have a strong preference for a custom font, BellTopo Sans by designer Sarah Bell, and have successfully added that to my fontstack
However, the font does not feature extended characters, and fallback fontstacks place the character out of vertical alignment when using the same text-offset, which is odd...
` "text-font": ["BellTopo Sans Regular", "DIN Pro Regular"],
"text-offset": [0,-0.2]
`

In this image, all characters are rendered in BellTopo Sans except for the ł glyph, which is in the fallback DIN Pro Regular.
Is it possible to apply a different text-offset which is responsive to the text-font of the glyph?
Or is this some other kind of error? The glyph ł rendered in DIN Pro Regular appears to have 0 y-offset from the point. It also seems odd that there would be a half-character vertical offset between two fonts. When they are rendered in text editing software they appear properly vertically aligned...
**Attempted Workaround 1:**
I attempted to write a responsive code for text-offset. The code executes without error, but does not appear to work glyph-by-glyph. The entire label is assigned the text-offset based on its primary typeface.
`"text-offset": ["match", ["get", "text_font"],
"BellTopo Sans Regular", ["literal",[0, 0]],
"DIN Pro Regular", ["literal",[0, -2]],
["literal",[0,0]]
]`
Any suggestions? Thank you!
**Current (Janky) Workaround:**
I am currently 'solving' this by adding "Arial Unicode MS Regular" and adding Combining Diacritical Marks. A normal L glyph followed by an accent diacritical and a thinspace is an acceptable workaround, but not ideal.

**Possible Workaround A:**
The obvious workaround is to simply select a different typeface as the primary typeface. "DIN Pro Regular" is acceptable and contains all the glyphs needed, which avoids this issue. However I'd like to use the custom font and am curious if there is a technical solution for fallback typeface glyph offsets.
**Possible Workaround B:**
I have considered creating a custom .ttf file for the single missing glyph, but that seems like a lot of work and may violate the copyright of the font designer (Sarah Bell)
Contributor guide
Research direction
The issue names no repository file, test, or entry point. Start by reproducing the label with the BellTopo Sans and DIN Pro fallback stack and the reported text-offset; done would require an agreed technical approach for glyph-specific vertical alignment or a documented limitation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100