How to use bundled fonts in Mapbox iOS SDK? - ios

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?

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.

Related

Custom fonts FMX ios not working Delphi 11

With this Embarcadero tutorial on custom fonts we were enabled to use custom fonts on iOS and Android:
https://docwiki.embarcadero.com/RADStudio/Rio/en/Creating_an_iOS_App#Using_Custom_Fonts_in_iOS_Apps
With new projects we cannot get it to work anymore in iOS, since Delphi 11 (or maybe 10.4). It’s only working on Android.
Does anyone know why the fonts are not picked up/ embedded on iOS?
I have created a sample application showcasing the use of a custom font on an iOS application. Please, the code is available here. It is important to bring up here the need to add the custom font file to the project deployment list:
The mentioned sample application contains a combo box to list all the font family names that are available as value for the TFont.Family property. I have added the SCRIPTBL.ttf font file to the application and it causes the Script MT Bold item to be added to the mentioned combo box.

Map localization in Carto Mobile SDK

Does anybody know whether it is available to localize captions of the map objects using Carto Mobile SDK? And if it is possible, how can I obtain it?
For example, I would like to see "Kazakhstan" instead of "Казахстан", however caption above the objects depends on country language where object is located. I want make it localized into, let me say, English.
Click the link to see screenshot.
Just in case it is useful and can help: I am using Xamarin.iOS platform. Version of Carto Mobile SDK - 4.0.2.
Thank you in advance.
CartoVectorTileLayer (both CartoOnlineVectorTileLayer and CartoOfflineVectorTileLayer are subclasses of it) has method setLanguage(String) for it, so e.g.:
layer.setLanguage("en");
will give you English language maps.
In SDK 4.0.2 SDK and nutiteq.osm tile source you can use following languages: local/default (will give Казахстан in your case), en, es, de, fr, it, ru, zh (Chinese), tr (Turkish) and et (Estonian) as language
From CARTO SDK 4.1.0 and new carto.streets source you can use any OSM language. I would suggest to configure map based on device language settings, with something like:
// Android
layer.setLanguage(Locale.getDefault().getLanguage());
// iOs / Xamarin
layer.Language = Foundation.NSLocale.PreferredLanguages[0].Substring(0, 2);
What if specific name is not available in given language? Then the MapView will fallback to 'local' language by default, the map will not be empty. But if the 'local' language is still unreadable, so I'd prefer latin alphabet names? In SDK 4.1.0 you can configure primary and secondary fallback languages, e.g. you set primary language to 'de' for Germans, then to avoid strange alphabets (say Hebrew, Greek, most of Asia) set 'en' as primary fallback; then local is used only if both your primary and English names are missing.

How to use custom fonts in a property list file?

I use a third-party SDK in my iOS app which requires me to define the fonts I wish to use in a pre-defined .plist file. I have been using Lato-Regular all throughout the app but it seems I cannot use the same in a property list file for some reason. Is there any to achieve this?
P.S. I have checked and rechecked for the name of the font so that's not the problem.

How to Use a Custom Font in Xamarin Cross Platform

My App will be used on iOS, I have Windows and Android versions, but I am not too concerned with getting the custom font to work for those platforms. Mainly IOS.
I know how to add the .ttf file to my Resources folder, and set it to Copy Always, I also update the IOS file info.plist and add a string array with name 'Fonts provided by application' and value 'Cardinal.ttf'
What I am not clear on is how to call the Font Family in my Cross Platform code. I know I do something like
labelName.Font = UI.Font( "Cardinal" )
However this will not work in Cross Platform because the UI namespace is not available.
Any help here?
Something with Device.OnPlatform( ...
Thanks to #Gusman above! You simply specify the FontFamily as a string with the value of the Font name. As long as you added the ttf file to resources and updated the info.plist file correctly, it will load the Font on App startup and the call to
FontFamily="Cardinal"
will work fine. Cheers!!!

Handling Cusom Key Board Types in ios [duplicate]

This question already has answers here:
How to add custom fonts to an iPhone app?
(2 answers)
Closed 8 years ago.
Here in (http://iosfonts.com/) this site, number of fonts are listed that iOS devices supports. For an Indian language, Tamil, there is a font named Sangam. My understanding is that there is no Localization support for the languages Tamil, Telugu or Devanagiri. As iOS supports TTF and OpenType fonts both to be added to the XCode, Is it possible to create a custom keyboard lay out, for typing using these fonts. As these languages has no similarities with any of the language keyboard that apple supports presently, is there a way to type, store and share the text contents using these custom type fonts.
Yes, simply embed the font files (.ttf or .otf files) in your app then add them to the list of the dedicated UIAppFonts key in your Info.plist file (Note: the key is called "Fonts provided by application" in its human-readable description).
See the doc here.
You can then simply use [UIFont fontWithName:size:] with the name of your custom font to manipulate the font and affect it to your labels and so on.

Resources