How to set LocalIdeographFontFamily in react native mapbox

Viewed 517
1 Answers

Find a place where you are setting up your MapBox object and use these params:

mapboxgl.accessToken = 'pk.eyJ1IjoiZGFsYW5jZXIiLCJhIjoiY2o0ZWM2M2JnMTY1NTJ5bzM3cTV6eHZmNyJ9.jgmzsIBDiB5gB57zFl9p0Q';

var map = new mapboxgl.Map({
  container: 'map',
  style: 'mapbox://styles/mapbox/streets-v11',
  center: [120.3049, 31.4751],
  zoom: 12,
  localIdeographFontFamily: "'Noto Sans', 'Noto Sans CJK SC', sans-serif" // your boy
});

As far as I understand, you should really worry about this warning if you are looking to support a customers in China, Japan or any other Asian country (not sure about Arabic).

localIdeographFontFamily was created because the fonts that contains kanji (Japanese letters) or anything similar, weights a lot, thus increasing map loading time.

You can actually read a thing or two on why, if you have some free time, riiiiggghttt here - https://docs.mapbox.com/mapbox-gl-js/example/local-ideographs/

Related