Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sxychenjing
engine
提交
9c6e29c4
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,发现更多精彩内容 >>
未验证
提交
9c6e29c4
编写于
2月 27, 2018
作者:
J
Jason Simmons
提交者:
GitHub
2月 27, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
libtxt: lazily populate the fallback font cache (#4720)
上级
0d4e72e8
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
8 addition
and
22 deletion
+8
-22
third_party/txt/src/minikin/FontCollection.cpp
third_party/txt/src/minikin/FontCollection.cpp
+8
-0
third_party/txt/src/txt/font_collection.cc
third_party/txt/src/txt/font_collection.cc
+0
-22
未找到文件。
third_party/txt/src/minikin/FontCollection.cpp
浏览文件 @
9c6e29c4
...
...
@@ -292,6 +292,14 @@ const std::shared_ptr<FontFamily>& FontCollection::getFamilyForChar(
uint32_t
langListId
,
int
variant
)
const
{
if
(
ch
>=
mMaxChar
)
{
// libtxt: check if the fallback font provider can match this character
if
(
mFallbackFontProvider
)
{
const
std
::
shared_ptr
<
FontFamily
>&
fallback
=
mFallbackFontProvider
->
matchFallbackFont
(
ch
);
if
(
fallback
)
{
return
fallback
;
}
}
return
mFamilies
[
0
];
}
...
...
third_party/txt/src/txt/font_collection.cc
浏览文件 @
9c6e29c4
...
...
@@ -32,15 +32,6 @@ namespace txt {
namespace
{
// Example characters representing character classes that may require a
// fallback font.
const
std
::
vector
<
SkUnichar
>
fallback_characters
{
0x1f600
,
// emoji
0x4e00
,
// CJK
0x5d0
,
// Hebrew
0x627
,
// Arabic
};
// Font families that will be used as a last resort if no font manager provides
// a font matching a particular character.
const
std
::
vector
<
std
::
string
>
last_resort_fonts
{
...
...
@@ -201,19 +192,6 @@ FontCollection::GetFontFamilyForTypeface(const sk_sp<SkTypeface>& typeface) {
}
void
FontCollection
::
UpdateFallbackFonts
(
sk_sp
<
SkFontMgr
>
manager
)
{
// Prepopulate the fallback font cache with fonts matching some widely
// used character classes.
for
(
SkUnichar
fallback_char
:
fallback_characters
)
{
sk_sp
<
SkTypeface
>
typeface
(
manager
->
matchFamilyStyleCharacter
(
0
,
SkFontStyle
(),
nullptr
,
0
,
fallback_char
));
if
(
typeface
)
{
// Create a Minikin font family for this typeface if one does not already
// exist.
GetFontFamilyForTypeface
(
typeface
);
}
}
// Add additional font families to be used if nothing else matches.
for
(
const
std
::
string
&
family
:
last_resort_fonts
)
{
sk_sp
<
SkTypeface
>
typeface
(
manager
->
matchFamilyStyle
(
family
.
c_str
(),
SkFontStyle
()));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录