Shinjou Fang
Shinjou Fang

Reputation: 11

Problems in displaying polyphonic Chinese characters

I attempted to display polyphonic Chinese characters in Dart using the BpmfIansui-Regular.ttf font, which is designed for traditional Chinese characters with BoPoMoFo annotations. For instance, the tone of the Chinese character '一' (one) varies depending on the tone of the subsequent character. If the following character carries the fourth tone, as seen in '看一看' ('kàn yī kàn'), then '一' shifts to the second tone. Conversely, if the next character is in the first, second, or third tone, '一' retains the fourth tone, as in '寫一寫' ('xiě yī xiě'). The BpmfIansui-Regular.ttf font functions effectively in applications like Word and PowerPoint.

I used the following code, but it still shows "一" in the first tone (the default). It should display

Text(
    '\u{7528}\u{4E00}\u{E01E1}\u{7528}', // Unicode for 用一用, u{4E00}\u{E01E1} for "一"
    style: TextStyle(
      fontFamily: 'BpmfIansui-Regular',
      fontSize: 40,
    ),
 ),

Upvotes: 0

Views: 120

Answers (1)

Shinjou Fang
Shinjou Fang

Reputation: 11

I found out how to do it. In the FontFeature class, one can set stylistic set. See the following example. For details, see api.flutter.dev/flutter/dart-ui/FontFeature-class.html

enter code here

Text('Raleway Dots', style: TextStyle( fontFeatures: <FontFeature>[FontFeature.stylisticSet(1)], fontFamily: 'Raleway Dots', fontSize: 48, )), 

Upvotes: 0

Related Questions