AliFlux / VectorTileRenderer

A comprehensive Vector Map Tile Renderer for .Net/C#
MIT License
183 stars 51 forks source link

Solved issue with labels #25

Open ststeiger opened 3 years ago

ststeiger commented 3 years ago

I've found a solution to the issues with labels with Arabic/Berber (Tifinagh) writing-systems (scripts).
Incidentially, it also works with Asian and other scripts. Problem is, Skia DrawText doesn't handle multi-script text-lines very well. So you need to tell Skia which font to use (and either clip the additional scripts or for-loop the DawText for each ScriptRun).

I've added google noto-fonts, and have written a font-manager, here: https://github.com/ststeiger/VectorTileRenderer/tree/master/VectorTileRenderer2/FontManager https://github.com/ststeiger/VectorTileRenderer/blob/master/VectorTileRenderer2/FontManager/FontManager.cs#L180

Then you need to make a few changes in SkiaCanvas.DrawText https://github.com/ststeiger/VectorTileRenderer/blob/master/VectorTileRenderer2/SkiaCanvas.cs#L438

It's not perfect just yet, but it preliminary works.

AliFlux commented 3 years ago

Hi.

That's an interesting solution. Can you make it more generic and test it thoroughly? I can incorporate your contribution into this repo