Following https://airsdk.dev/docs/development/text/embedding-fonts, I've wrote this [Embed]
meta-data:
package fortoresseXY.fonts {
import flash.text.Font;
public class FortoresseXYFonts {
...
[Embed(
source = "./notoSans/NotoSans-ExtraLight.ttf",
fontName = "XNoto Sans ExtraLight",
fontWeight = "100",
fontStyle = "normal",
mimeType = "application/x-font-truetype",
advancedAntiAliasing = "true",
embedAsCFF = "false"
)]
public static const notoSansExtraLight: Class;
...
public static function register(): void {
...
Font.registerFont(notoSansExtraLight);
...
}
}
}
I've added the X
prefix to not use my local system font.
In a Feathers UI theme I'm using in my application within Theme.setTheme(...)
, I've done this:
override public function getTextFormat(align: String = null): TextFormat {
const tf: TextFormat = super.getTextFormat(align);
tf.font = "Noto Sans";
return tf;
}
private function getHeadingTextFormat(align: String = null): TextFormat {
const tf: TextFormat = this.getTextFormat(align);
tf.font = "XNoto Sans ExtraLight";
tf.size = this.headerFontSize;
return tf;
}
When I remove the X
prefix from this TextFormat
used in heading label, the Noto Sans ExtraLight font renders fine. Otherwise, the default AIR font is used.