Updated to mapbox-ios-sdk-4.10.0.
Then text-font has been disabled.
"text-font": [
"my-japanese-fontstack"
],
In this way PingFang is applied.
/cc @fabian-guerra
Hi, @honjo2. Thank you for using Mapbox. I am sorry to hear you are having some issues. Could you please provide us with a code snippet or test app we could use to track down the issue?
Also, starting 4.10.0 we introduced MGLAttributedExpression that let's you set the text, font and scale size to MGLSymbolStyleLayer.text could you please try to set the font array using"
MGLSymbolStyleLayer.text = [NSExpression mgl_expressionForAttributedExpressions:@[[NSExpression expressionForConstantValue:attributedExpression]]];
https://mapion.github.io/mapion-vector/#15/35.62277/139.75021


Why, only KANJI will be PingFang.
Japanese HIRAGANA and KATAKANA is OK.
Alphabet and Number too.
Hi, @honjo2. Thank you for your reply.
In my previous message asked you to try a workaround using MGLAttributedExpression object, do you think you could give it a try?
Is it possible you could share the style url and the account name where is uploaded? If you are not comfortable sharing the info here, you can send an email to customer support here https://support.mapbox.com/hc/en-us/requests/new?ticket_form_id=360000291231 and reference this ticket.
MGLSymbolStyleLayer.text = [NSExpression mgl_expressionForAttributedExpressions:@[[NSExpression expressionForConstantValue:attributedExpression]]];
in Swift, please
Hi, @honjo2. This link has an example on how to create an attributed expression in Swift: https://docs.mapbox.com/ios/api/maps/4.10.0/Classes/MGLAttributedExpression.html
If you meant how to use it with the text then:
After retrieving your symbol style layer from your style:
symbolStyleLayer.text = NSExpression.init(forAttributedExpressions: [NSExpression(forConstantValue: attributedExpression)])
Could you please share with Mapbox support your account name, and style url so we can track down the issue:
https://support.mapbox.com/hc/en-us/requests/new?ticket_form_id=360000291231
In the ticket please reference this link.
textFontNames property is ignored, because that property is only compatible with server-side fonts uploaded to Mapbox Studio.Previously, local font rendering would only be enabled when the MGLIdeographicFontFamilyName property was set in Info.plist. You can avoid the default Chinese font by setting that Info.plist key to the name of a Japanese font you expect to be installed on the system. Unfortunately, there isnât a way to turn off ideographic font rendering on iOS anymore. We should special-case a value like - or null to turn off local font rendering.
Thanks, @1ec5. @fabian-guerra and I also did some testing:
MGLIdeographicFontFamilyName plist key, it would then always use that font for any Chinese characters.MGLIdeographicFontFamilyName to an empty string didnât work, for example. Bundling your custom font with your app could work, but we did not try this.PingFang TC is not a valid font family name on iOS â it should be PingFang or, better, Helvetica.A few points:
JK in CJK). We need to better support our non-Chinese customers/users and they should not be required to flip a setting to get proper text rendering.
_Itâs visible in most labels here, but specifically: 丸ăŽĺ
at the upper left should be rendered in the same typeface, but the hiragana ㎠is in the custom font and 丸/ĺ
are in PingFang._
I think our local glyph generation being limited to âideographicâ characters is a mistake and leads to a poor experience for Japanese and Korean (the JK in CJK). We need to better support our non-Chinese customers/users and they should not be required to flip a setting to get proper text rendering.
Font substitution of Han characters causes more than aesthetic issues: due to Han unification, a number of characters have distinct glyph forms depending on the language (and to a lesser extent the region):
For native speakers, variants can be unintelligible or be unacceptable in educated contexts. English speakers may understand a handwritten note saying "4P5 kg" as "495 kg", but writing the nine backwards (so it looks like a "P") can be jarring and would be considered incorrect in any school. Likewise, to users of one CJK language reading a document with "foreign" glyphs: variants of 骨 can appear as mirror images, č can be missing a stroke/have an extraneous stroke, and 䝤 may be unreadable or be confused with äť depending on which variant of 䝤 (e.g. 䝤ó ) is used.
For the purposes of modern map display, hard-coding a Chinese font like PingFang primarily affects Japanese. (Han characters no longer appear in modern place names in Korean or Vietnamese.) There may also be a handful of edge cases in Chinese where a national variant of a character isnât used where it should be.
There are two ways to disambiguate the characters, and both of them would require significant effort on the server side:
name field, and thereâs no machine-readable way for GL to know that the name_ja and name_zh fields contain Japanese and Chinese text, respectively (ref mapbox/tilejson-spec#14).Note that, depending on the system locale, operating systems often default to Simplified Chinese fonts in the absence of any language data.
/cc @mapbox/language
From my understanding, our first step is to set a default font for all character sets. It will fix two issues at least:
And next step, as @1ec5 mentioned above, might let sever join this game to improve this.
ios-v5.2.0-alpha.3 onward, specifying MGLIdeographicFontFamilyName = NO in your plist will allow the use of remote fonts for CJK glyphs.
Most helpful comment
ios-v5.2.0-alpha.3onward, specifyingMGLIdeographicFontFamilyName = NOin your plist will allow the use of remote fonts for CJK glyphs.