Added an option to allow default fonts to not be packed in an flx file. (#6710)

Fonts should never be bundled on Fuchsia.
This commit is contained in:
P.Y. Laligand 2016-11-04 14:06:44 -07:00 committed by GitHub
parent 46b60773e8
commit 9b7764d48f
3 changed files with 8 additions and 4 deletions

View File

@ -48,7 +48,7 @@ Future<Null> main(List<String> args) async {
workingDirPath: argResults[_kOptionWorking], workingDirPath: argResults[_kOptionWorking],
packagesPath: argResults[_kOptionPackages], packagesPath: argResults[_kOptionPackages],
manifestPath: defaultManifestPath, manifestPath: defaultManifestPath,
includeRobotoFonts: true, includeDefaultFonts: false,
); );
if (buildResult != 0) { if (buildResult != 0) {
printError('Error building $outputPath: $buildResult.'); printError('Error building $outputPath: $buildResult.');

View File

@ -69,6 +69,7 @@ class AssetBundle {
String manifestPath: defaultManifestPath, String manifestPath: defaultManifestPath,
String workingDirPath, String workingDirPath,
String packagesPath, String packagesPath,
bool includeDefaultFonts: true,
bool includeRobotoFonts: true, bool includeRobotoFonts: true,
bool reportLicensedPackages: false bool reportLicensedPackages: false
}) async { }) async {
@ -120,7 +121,7 @@ class AssetBundle {
} }
List<_Asset> materialAssets = <_Asset>[]; List<_Asset> materialAssets = <_Asset>[];
if (usesMaterialDesign) { if (usesMaterialDesign && includeDefaultFonts) {
materialAssets.addAll(_getMaterialAssets(_kFontSetMaterial)); materialAssets.addAll(_getMaterialAssets(_kFontSetMaterial));
if (includeRobotoFonts) if (includeRobotoFonts)
materialAssets.addAll(_getMaterialAssets(_kFontSetRoboto)); materialAssets.addAll(_getMaterialAssets(_kFontSetRoboto));
@ -135,7 +136,7 @@ class AssetBundle {
entries.add(_createAssetManifest(assetVariants)); entries.add(_createAssetManifest(assetVariants));
AssetBundleEntry fontManifest = AssetBundleEntry fontManifest =
_createFontManifest(manifestDescriptor, usesMaterialDesign, includeRobotoFonts); _createFontManifest(manifestDescriptor, usesMaterialDesign, includeDefaultFonts, includeRobotoFonts);
if (fontManifest != null) if (fontManifest != null)
entries.add(fontManifest); entries.add(fontManifest);
@ -311,9 +312,10 @@ AssetBundleEntry _createAssetManifest(Map<_Asset, List<_Asset>> assetVariants) {
AssetBundleEntry _createFontManifest(Map<String, dynamic> manifestDescriptor, AssetBundleEntry _createFontManifest(Map<String, dynamic> manifestDescriptor,
bool usesMaterialDesign, bool usesMaterialDesign,
bool includeDefaultFonts,
bool includeRobotoFonts) { bool includeRobotoFonts) {
List<Map<String, dynamic>> fonts = <Map<String, dynamic>>[]; List<Map<String, dynamic>> fonts = <Map<String, dynamic>>[];
if (usesMaterialDesign) { if (usesMaterialDesign && includeDefaultFonts) {
fonts.addAll(_getMaterialFonts(AssetBundle._kFontSetMaterial)); fonts.addAll(_getMaterialFonts(AssetBundle._kFontSetMaterial));
if (includeRobotoFonts) if (includeRobotoFonts)
fonts.addAll(_getMaterialFonts(AssetBundle._kFontSetRoboto)); fonts.addAll(_getMaterialFonts(AssetBundle._kFontSetRoboto));

View File

@ -131,6 +131,7 @@ Future<int> assemble({
String privateKeyPath: defaultPrivateKeyPath, String privateKeyPath: defaultPrivateKeyPath,
String workingDirPath, String workingDirPath,
String packagesPath, String packagesPath,
bool includeDefaultFonts: true,
bool includeRobotoFonts: true, bool includeRobotoFonts: true,
bool reportLicensedPackages: false bool reportLicensedPackages: false
}) async { }) async {
@ -145,6 +146,7 @@ Future<int> assemble({
manifestPath: manifestPath, manifestPath: manifestPath,
workingDirPath: workingDirPath, workingDirPath: workingDirPath,
packagesPath: packagesPath, packagesPath: packagesPath,
includeDefaultFonts: includeDefaultFonts,
includeRobotoFonts: includeRobotoFonts, includeRobotoFonts: includeRobotoFonts,
reportLicensedPackages: reportLicensedPackages reportLicensedPackages: reportLicensedPackages
); );