loadArabicFont function

Future<void> loadArabicFont()

Registers the bundled Amiri font so Arabic text renders with real glyphs in tests. Safe to call more than once.

Implementation

Future<void> loadArabicFont() async {
  const path = 'fonts/Amiri-Regular.ttf';
  ByteData data;
  try {
    data = await rootBundle.load('packages/arabize_test/lib/$path');
  } on FlutterError {
    data = await rootBundle.load('lib/$path');
  }
  await (FontLoader(arabicTestFontFamily)..addFont(Future.value(data))).load();
}