qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.59k stars 3.01k forks source link

Vector tile glyph support #46588

Open blacha opened 2 years ago

blacha commented 2 years ago

Feature description

When importing vector tiles that have custom fonts, the fonts are not imported from the glyphs

Additional context

When importing vector tiles a warning is given if a font is missing on the base system rather than importing the font from the supplied glyph url

Housenumber: Referenced font Roboto Bold Italic is not available on system

Example stylejson: https://basemaps.linz.govt.nz/v1/tiles/topographic/EPSG:3857/style/topographic.json?api=d01fn790hgwf9w552d462epyste

which has glyphs of "https://orangemug.github.io/font-glyphs/glyphs/{fontstack}/{range}.pbf"

which has the following glyphs https://github.com/orangemug/font-glyphs/tree/gh-pages/glyphs

which include "Roboto Bold Italic" https://github.com/orangemug/font-glyphs/tree/gh-pages/glyphs/Roboto%20Bold%20Italic

nyalldawson commented 2 years ago

This is a very tricky one -- Qt itself has no way to render pbf fonts, so we'd need to write our own renderer for these.

blacha commented 2 years ago

I have been doing some research on this recently as we have been looking to generate some PBF fonts for some of our (Land Information New Zealand) cartographic fonts.

The PBF files here have been generated by mapbox's fontnik which encodes the glyphs as https://en.wikipedia.org/wiki/Signed_distance_function

related background: https://blog.mapbox.com/drawing-text-with-signed-distance-fields-in-mapbox-gl-b0933af6f817

I do not know much (anything :D) about QT but a quick google around distance field rendering in QT, gave me https://doc.qt.io/qt-5/qtdistancefieldgenerator-index.html I wonder if this is related.

nyalldawson commented 2 years ago

https://doc.qt.io/qt-5/qtdistancefieldgenerator-index.html I wonder if this is related.

That's a different beast. For a start it's using some other format (not pbf), and it's also for QML based rendering only (which QGIS doesn't use -- it uses QPainter)