Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
733bd049
Unverified
Commit
733bd049
authored
Jan 22, 2018
by
Michael Goderbauer
Committed by
GitHub
Jan 22, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix custom fonts on Windows (#14191)
Fixes
https://github.com/flutter/flutter/issues/13870
.
parent
159db5ca
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
68 additions
and
1 deletion
+68
-1
asset.dart
packages/flutter_tools/lib/src/asset.dart
+1
-1
asset_test.dart
packages/flutter_tools/test/asset_test.dart
+51
-0
pubspec.yaml
...ages/flutter_tools/test/data/asset_test/font/pubspec.yaml
+8
-0
test_font_file
...es/flutter_tools/test/data/asset_test/font/test_font_file
+1
-0
.packages
packages/flutter_tools/test/data/asset_test/main/.packages
+1
-0
pubspec.yaml
...ages/flutter_tools/test/data/asset_test/main/pubspec.yaml
+6
-0
No files found.
packages/flutter_tools/lib/src/asset.dart
View file @
733bd049
...
...
@@ -118,7 +118,7 @@ class AssetBundle {
for
(
String
packageName
in
packageMap
.
map
.
keys
)
{
final
Uri
package
=
packageMap
.
map
[
packageName
];
if
(
package
!=
null
&&
package
.
scheme
==
'file'
)
{
final
String
packageManifestPath
=
package
.
resolve
(
'../pubspec.yaml'
).
path
;
final
String
packageManifestPath
=
fs
.
path
.
fromUri
(
package
.
resolve
(
'../pubspec.yaml'
))
;
final
FlutterManifest
packageFlutterManifest
=
await
FlutterManifest
.
createFromPath
(
packageManifestPath
);
if
(
packageFlutterManifest
==
null
)
continue
;
...
...
packages/flutter_tools/test/asset_test.dart
0 → 100644
View file @
733bd049
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:async'
;
import
'package:flutter_tools/src/asset.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/cache.dart'
;
import
'package:test/test.dart'
;
import
'src/common.dart'
;
import
'src/context.dart'
;
void
main
(
)
{
group
(
'Assets'
,
()
{
final
String
dataPath
=
fs
.
path
.
join
(
getFlutterRoot
(),
'packages'
,
'flutter_tools'
,
'test'
,
'data'
,
'asset_test'
,
);
setUpAll
(()
{
Cache
.
disableLocking
();
});
// This test intentionally does not use a memory file system to ensure
// that AssetBundle with fonts also works on Windows.
testUsingContext
(
'app font uses local font file'
,
()
async
{
final
AssetBundle
asset
=
new
AssetBundle
();
await
asset
.
build
(
manifestPath
:
fs
.
path
.
join
(
dataPath
,
'main'
,
'pubspec.yaml'
),
packagesPath:
fs
.
path
.
join
(
dataPath
,
'main'
,
'.packages'
),
includeDefaultFonts:
false
,
);
expect
(
asset
.
entries
.
containsKey
(
'FontManifest.json'
),
isTrue
);
expect
(
await
getValueAsString
(
'FontManifest.json'
,
asset
),
'[{"family":"packages/font/test_font","fonts":[{"asset":"packages/font/test_font_file"}]}]'
,
);
});
});
}
Future
<
String
>
getValueAsString
(
String
key
,
AssetBundle
asset
)
async
{
return
new
String
.
fromCharCodes
(
await
asset
.
entries
[
key
].
contentsAsBytes
());
}
packages/flutter_tools/test/data/asset_test/font/pubspec.yaml
0 → 100644
View file @
733bd049
name
:
font
description
:
A test project that contains a font.
flutter
:
uses-material-design
:
true
fonts
:
-
family
:
test_font
fonts
:
-
asset
:
test_font_file
packages/flutter_tools/test/data/asset_test/font/test_font_file
0 → 100644
View file @
733bd049
This is a fake font.
packages/flutter_tools/test/data/asset_test/main/.packages
0 → 100644
View file @
733bd049
font:../font/lib/
packages/flutter_tools/test/data/asset_test/main/pubspec.yaml
0 → 100644
View file @
733bd049
name
:
main
description
:
A test project that has a package with a font as a dependency.
dependencies
:
font
:
path
:
../font
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment