1
votes

I'm using Mapbox iOS SDK 6.2.0-beta.2 and it doesn't load the custom fonts we serve on our tile server. In order to expedite our iOS 14 preparation I'm trying to make Mapbox use locally available fonts, but I can't find a good example. The docs are a bit vague to me. Can you help me make Mapbox use local fonts instead of the fonts specified in the style JSON?

1

1 Answers

0
votes

According to Mapbox docs on Customizing Fonts:

If the symbol layer does not specify an available font that contains the required glyphs, then the map tries to find a matching font in the MGLIdeographicFontFamilyName Info.plist key.

From Mapbox references on MGLIdeographicFontFamilyName:

This key specifies a fallback for all style layers in all map views and map snapshots.

This key can either be set to a single string or an array of strings, which the map tries to apply in order from most preferred to least preferred. Each string can be a family name (for example, “PingFang TC”), display name (“PingFang TC Ultralight”), or PostScript name (“PingFangTC-Ultralight”).

So if you need to use a locally bundled font for your map style, put a string (or array of strings in order of preference) of your locally embedded font name, family or PostScript name in MGLIdeographicFontFamilyName in your project's Info.plist file.