多音字显示问题

问题描述 投票:0回答:1

我尝试使用 BpmfIansui-Regular.ttf 字体在 Dart 中显示多音汉字,该字体是为带有 BoPoMoFo 注释的繁体汉字设计的。例如,汉字“一”(一)的声调根据后续字符的声调而变化。如果后面的字带有第四声,如“看一看”(“kàn yī kàn”),那么“一”就会转为第二声。相反,如果下一个字符是第一声、第二声或第三声,“一”保留第四声,如“写一写”(“xiě yī xiě”)。 BpmfIansui-Regular.ttf 字体在 Word 和 PowerPoint 等应用程序中有效运行。

我用了下面的代码,但是第一声还是显示“一”(默认)。应该会显示

Text(
    '\u{7528}\u{4E00}\u{E01E1}\u{7528}', // Unicode for 用一用, u{4E00}\u{E01E1} for "一"
    style: TextStyle(
      fontFamily: 'BpmfIansui-Regular',
      fontSize: 40,
    ),
 ),
flutter dart cjk pinyin bopomofo
1个回答
0
投票

我知道怎么做了。在FontFeature类中,可以设置风格集。请参阅以下示例。详情请参见 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, )), 
© www.soinside.com 2019 - 2024. All rights reserved.