Flex for Android で開発している気になるのが、フォントの表示である。
デフォルトだと中華フォントのようなものが指定され、見栄えが良くない。
Flex for iOS のようにフォントを指定しようとしても、フォントの指定自体サポートされていないようである。
これを解決するには埋め込みフォント使用することになるのだが、これが思ったよりもはまってしまったので、後で忘れないように記載。
ポイントは以下の2点。使用した埋め込みフォントは IPA Pゴシックフォント。
・embedAsCFF が true でないと適用されないコンポーネントと、false でないと適用されないコンポーネントが存在する。
・ActionBar のようにフォントがデフォルトで bold に設定されていると、指定してあると適用されない。font-weight を normal にする。
@font-face
{
src : url("./assets/ipagp.ttf");
fontFamily : IPAPGothic;
embedAsCFF : false;
}
@font-face
{
src : url("./assets/ipagp.ttf");
fontFamily : IPAPGothicCFF;
embedAsCFF : true;
}
@media (os-platform : "Android") {
global
{
font-family : IPAPGothicCFF;
}
s|ViewNavigatorApplication
{
font-family: IPAPGothicCFF;
}
s|TextInput
{
font-family: IPAPGothic;
}
s|TextArea
{
font-family: IPAPGothic;
}
s|Label
{
font-family: IPAPGothicCFF;
}
s|List
{
font-family: IPAPGothic;
}
s|TabbedViewNavigator #tabBar
{
font-family: IPAPGothic;
}
s|ActionBar
{
font-family: IPAPGothic;
font-weight: normal;
}
s|ActionBar #titleDisplay
{
font-family: IPAPGothic;
font-weight: normal;
}
s|Button{
font-family: IPAPGothic;
font-weight: normal;
}
s|LabelItemRenderer
{
font-family: IPAPGothic;
}
}