Commit 9b7764d4 authored by P.Y. Laligand's avatar P.Y. Laligand Committed by GitHub

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

Fonts should never be bundled on Fuchsia.
parent 46b60773
...@@ -48,7 +48,7 @@ Future<Null> main(List<String> args) async { ...@@ -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.');
......
...@@ -69,6 +69,7 @@ class AssetBundle { ...@@ -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 { ...@@ -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 { ...@@ -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) { ...@@ -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));
......
...@@ -131,6 +131,7 @@ Future<int> assemble({ ...@@ -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({ ...@@ -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
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment