Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sxychenjing
engine
提交
8320617d
E
engine
项目概览
sxychenjing
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
8320617d
编写于
1月 25, 2021
作者:
H
Harry Terkelsen
提交者:
GitHub
1月 25, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Adds Roboto as a global font fallback in CanvasKit (#23928)
上级
82a0b588
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
10 addition
and
7 deletion
+10
-7
lib/web_ui/lib/src/engine/canvaskit/fonts.dart
lib/web_ui/lib/src/engine/canvaskit/fonts.dart
+2
-1
lib/web_ui/lib/src/engine/canvaskit/text.dart
lib/web_ui/lib/src/engine/canvaskit/text.dart
+1
-3
lib/web_ui/test/canvaskit/fallback_fonts_golden_test.dart
lib/web_ui/test/canvaskit/fallback_fonts_golden_test.dart
+7
-3
未找到文件。
lib/web_ui/lib/src/engine/canvaskit/fonts.dart
浏览文件 @
8320617d
...
@@ -28,7 +28,7 @@ class SkiaFontCollection {
...
@@ -28,7 +28,7 @@ class SkiaFontCollection {
final
Map
<
String
,
List
<
SkTypeface
>>
familyToTypefaceMap
=
final
Map
<
String
,
List
<
SkTypeface
>>
familyToTypefaceMap
=
<
String
,
List
<
SkTypeface
>>{};
<
String
,
List
<
SkTypeface
>>{};
final
List
<
String
>
globalFontFallbacks
=
<
String
>[];
final
List
<
String
>
globalFontFallbacks
=
<
String
>[
'Roboto'
];
final
Map
<
String
,
int
>
_fontFallbackCounts
=
<
String
,
int
>{};
final
Map
<
String
,
int
>
_fontFallbackCounts
=
<
String
,
int
>{};
...
@@ -178,6 +178,7 @@ class SkiaFontCollection {
...
@@ -178,6 +178,7 @@ class SkiaFontCollection {
void
debugResetFallbackFonts
()
{
void
debugResetFallbackFonts
()
{
_registeredFallbackFonts
.
clear
();
_registeredFallbackFonts
.
clear
();
globalFontFallbacks
.
clear
();
globalFontFallbacks
.
clear
();
globalFontFallbacks
.
add
(
'Roboto'
);
_fontFallbackCounts
.
clear
();
_fontFallbackCounts
.
clear
();
}
}
...
...
lib/web_ui/lib/src/engine/canvaskit/text.dart
浏览文件 @
8320617d
...
@@ -814,9 +814,7 @@ enum _ParagraphCommandType {
...
@@ -814,9 +814,7 @@ enum _ParagraphCommandType {
List
<
String
>
_getEffectiveFontFamilies
(
String
?
fontFamily
,
List
<
String
>
_getEffectiveFontFamilies
(
String
?
fontFamily
,
[
List
<
String
>?
fontFamilyFallback
])
{
[
List
<
String
>?
fontFamilyFallback
])
{
List
<
String
>
fontFamilies
=
<
String
>[];
List
<
String
>
fontFamilies
=
<
String
>[];
if
(
fontFamily
==
null
)
{
if
(
fontFamily
!=
null
)
{
fontFamilies
.
add
(
'Roboto'
);
}
else
{
fontFamilies
.
add
(
fontFamily
);
fontFamilies
.
add
(
fontFamily
);
}
}
if
(
fontFamilyFallback
!=
null
&&
if
(
fontFamilyFallback
!=
null
&&
...
...
lib/web_ui/test/canvaskit/fallback_fonts_golden_test.dart
浏览文件 @
8320617d
...
@@ -51,6 +51,10 @@ void testMain() {
...
@@ -51,6 +51,10 @@ void testMain() {
ui
.
window
.
onPlatformMessage
=
savedCallback
;
ui
.
window
.
onPlatformMessage
=
savedCallback
;
});
});
test
(
'Roboto is always a fallback font'
,
()
{
expect
(
skiaFontCollection
.
globalFontFallbacks
,
contains
(
'Roboto'
));
});
test
(
'will download Noto Naskh Arabic if Arabic text is added'
,
()
async
{
test
(
'will download Noto Naskh Arabic if Arabic text is added'
,
()
async
{
final
Completer
<
void
>
fontChangeCompleter
=
Completer
<
void
>();
final
Completer
<
void
>
fontChangeCompleter
=
Completer
<
void
>();
// Intercept the system font change message.
// Intercept the system font change message.
...
@@ -83,7 +87,7 @@ void testMain() {
...
@@ -83,7 +87,7 @@ void testMain() {
}
}
'''
;
'''
;
expect
(
skiaFontCollection
.
globalFontFallbacks
,
isEmpty
);
expect
(
skiaFontCollection
.
globalFontFallbacks
,
[
'Roboto'
]
);
// Creating this paragraph should cause us to start to download the
// Creating this paragraph should cause us to start to download the
// fallback font.
// fallback font.
...
@@ -123,7 +127,7 @@ void testMain() {
...
@@ -123,7 +127,7 @@ void testMain() {
'https://fonts.googleapis.com/css2?family=Noto+Naskh+Arabic+UI'
]
=
'https://fonts.googleapis.com/css2?family=Noto+Naskh+Arabic+UI'
]
=
'invalid CSS... this should cause our parser to fail'
;
'invalid CSS... this should cause our parser to fail'
;
expect
(
skiaFontCollection
.
globalFontFallbacks
,
isEmpty
);
expect
(
skiaFontCollection
.
globalFontFallbacks
,
[
'Roboto'
]
);
// Creating this paragraph should cause us to start to download the
// Creating this paragraph should cause us to start to download the
// fallback font.
// fallback font.
...
@@ -136,7 +140,7 @@ void testMain() {
...
@@ -136,7 +140,7 @@ void testMain() {
await
Future
<
void
>.
delayed
(
Duration
.
zero
);
await
Future
<
void
>.
delayed
(
Duration
.
zero
);
expect
(
notoDownloadQueue
.
isPending
,
isFalse
);
expect
(
notoDownloadQueue
.
isPending
,
isFalse
);
expect
(
skiaFontCollection
.
globalFontFallbacks
,
isEmpty
);
expect
(
skiaFontCollection
.
globalFontFallbacks
,
[
'Roboto'
]
);
});
});
// TODO: https://github.com/flutter/flutter/issues/60040
// TODO: https://github.com/flutter/flutter/issues/60040
},
skip:
isIosSafari
);
},
skip:
isIosSafari
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录