Prior to the newest release of the ESRI JavaScript API 4.10, I have been able to include the ESRI Weather font to my page through CSS via the following code:
Hi Chad Kahler, at 4.10 we improved performance by drawing all layers in a 2D MapView in WebGL, this requires all fonts to be hosted in pbf file format.
Release notes for 4.10 | ArcGIS API for JavaScript 4.10
If you want to host your own fonts, they need to be converted into pbf and hosted (by setting the esriConfig.fontsURL property to point to your own server).
Labeling | ArcGIS API for JavaScript 4.10
Hope this helps.
-Noah
Thanks for the response! I guess my primary obstacle is trying to figure how to convert a local font file to pbf format.
Also, after trying the esriConfig.fontsURL property, it appears that it is all or nothing? You cannot host one font locally and then load the rest from the ESRI API...is that correct?
Thanks for your assistance!
Chad
Hi Robert,
Thanks for the assistance, but I thought the fonts had to be converted to PBF format...not PFB? Are they the same thing? I have to admit...I am not very familiar with font formats.
Thanks,
Chad
You need to convert desired font to .pbf format, not .pfb. We faced the same problem (wanted custom font in esri map, currently using 4.19 JS API) and we managed to convert our font to .pbf format using Mapbox.
https://docs.mapbox.com/api/maps/fonts/
Hope this helps to resolve the problem.
For anyone else looking to use a custom font I really struggled with this so documenting here. There doesn't appear to be a documented way on how to create a PBF font for Esri.
A tip I got was the easiest way is to create a vector tile package with the font in in. Then rename the VTPK to .zip unzip and the font will be under resources\fonts\
Chad Kahler were you able to give reference to a local font family?
I am trying to have a completely offline application. Just need the default fonts but on local.
Noah Sager is there any way to maintain the some of the default font family provided by ESRI on my local and then provide the esriConfig.fontsURL?
I was able to get it to work by hosting the ESRI Weather font (in its various font formats) locally and then include via CSS. The main reason I have been looking to have it included within the ESRI JavaScript API is because our work computers prevent browsers from loading local font files.
I think the inclusion of the ESRI Weather font within the API is under
consideration for future releases.
On Fri, Apr 26, 2019 at 8:01 AM Archana Venkataraman <geonet@esri.com>