systemFontDirectories method

List<String> systemFontDirectories()

Diretórios usuais de fontes da plataforma atual.

Android e iOS não garantem acesso ao catálogo completo. Neles esta lista representa apenas locais normalmente legíveis; fontes empacotadas pelo aplicativo devem ser registradas por bytes no BLFontCollection.

Implementation

List<String> systemFontDirectories() {
  final env = Platform.environment;
  if (Platform.isWindows) {
    final windows = env['WINDIR'] ?? env['SystemRoot'];
    final local = env['LOCALAPPDATA'];
    return <String>[
      if (windows != null) '$windows${Platform.pathSeparator}Fonts',
      if (local != null)
        '$local${Platform.pathSeparator}Microsoft${Platform.pathSeparator}Windows${Platform.pathSeparator}Fonts',
    ];
  }
  if (Platform.isMacOS) {
    final home = env['HOME'];
    return <String>[
      '/System/Library/Fonts',
      '/Library/Fonts',
      if (home != null) '$home/Library/Fonts',
    ];
  }
  if (Platform.isAndroid) {
    return const <String>['/system/fonts', '/product/fonts', '/vendor/fonts'];
  }
  if (Platform.isIOS) {
    return const <String>['/System/Library/Fonts', '/Library/Fonts'];
  }
  final home = env['HOME'];
  return <String>[
    '/usr/share/fonts',
    '/usr/local/share/fonts',
    if (home != null) '$home/.fonts',
    if (home != null) '$home/.local/share/fonts',
  ];
}