How to create point symbols from a font

662
2
Jump to solution
09-27-2023 07:02 AM
MTrcek
by
New Contributor II

Our app loads point geometries from an outside source into a FeatureCollectionLayer which uses a UniqueValueRenderer.

We used an ArcGIS Pro map to define the layer's symbology, exported the definition to JSON using a python script and then used it in the Android app using the Symbol.fromJson(String json) function.

This worked perfectly fine when the layer's symbols were circles and squares ("type":"CIMVectorMarker" in the JSON), but after switching it to symbols from a custom font ("type":"CIMCharacterMarker" in the JSON), the Android map simply rendered letters and symbols from a default font instead.

I'm able to include the .ttf file in the Android app and load it into an android.graphics.Typeface object. I've tested it on TextViews and it works as expected. But I don't know how and where I would register the font so that the map is able to render it as well. Is that even possible?

If it isn't possible, I'm interested in any other way to carry a (character-based) symbology definition from an ArcGIS Pro map to an Android SDK FeatureCollectionLayer. We're not looking into solutions that replace the FeatureCollectionLayer with a different kind of layer, but if there's a way to define the symbology definition in, say, an MMPK layer, load that in the Android app and copy it into our FeatureCollectionLayer, that could work.

0 Kudos
1 Solution

Accepted Solutions
GuntherHeppner
Esri Contributor

@MTrcek - thanks for sharing this. If the font is not installed on the Android system, the map will not pick it up. We haven't tested this workflow, so its currently unclear if there is a way to install your custom font on the Android system to be used by the map.

An alternative could be to add the symbols to a Mobile Style file.  When you add CharacterMarkers to mobile style files the markers get vectorized into CIMVectorMarkers, so your custom font won't be required.

View solution in original post

0 Kudos
2 Replies
GuntherHeppner
Esri Contributor

@MTrcek - thanks for sharing this. If the font is not installed on the Android system, the map will not pick it up. We haven't tested this workflow, so its currently unclear if there is a way to install your custom font on the Android system to be used by the map.

An alternative could be to add the symbols to a Mobile Style file.  When you add CharacterMarkers to mobile style files the markers get vectorized into CIMVectorMarkers, so your custom font won't be required.

0 Kudos
MTrcek
by
New Contributor II

@GuntherHeppner  -  We've since managed to make a satisfactory map without fonts, but it's still a low priority feature we'd like to have and using Mobile Style files does work. Thank you for your help!