Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_43355755
engine
提交
67841bf0
E
engine
项目概览
weixin_43355755
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
提交
67841bf0
编写于
5月 29, 2014
作者:
R
Raph Levien
提交者:
Android Git Automerger
5月 29, 2014
浏览文件
操作
浏览文件
下载
差异文件
am
066e8575
: Fix ZWJ not working for Indic fonts
* commit '
066e8575
': Fix ZWJ not working for Indic fonts
上级
b4a27545
066e8575
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
25 addition
and
27 deletion
+25
-27
include/minikin/FontCollection.h
include/minikin/FontCollection.h
+2
-2
libs/minikin/FontCollection.cpp
libs/minikin/FontCollection.cpp
+23
-25
未找到文件。
include/minikin/FontCollection.h
浏览文件 @
67841bf0
...
...
@@ -32,8 +32,6 @@ public:
~
FontCollection
();
const
FontFamily
*
getFamilyForChar
(
uint32_t
ch
,
FontLanguage
lang
,
int
variant
)
const
;
class
Run
{
public:
// Do copy constructor, assignment, destructor so it can be used in vectors
...
...
@@ -74,6 +72,8 @@ private:
size_t
end
;
};
const
FontInstance
*
getInstanceForChar
(
uint32_t
ch
,
FontLanguage
lang
,
int
variant
)
const
;
// static for allocating unique id's
static
uint32_t
sNextId
;
...
...
libs/minikin/FontCollection.cpp
浏览文件 @
67841bf0
...
...
@@ -114,13 +114,8 @@ FontCollection::~FontCollection() {
// 3. If a font matches just language, it gets a score of 2.
// 4. Matching the "compact" or "elegant" variant adds one to the score.
// 5. Highest score wins, with ties resolved to the first font.
// Note that we may want to make the selection more dependent on
// context, so for example a sequence of Devanagari, ZWJ, Devanagari
// would get itemized as one run, even though by the rules the ZWJ
// would go to the Latin font.
const
FontFamily
*
FontCollection
::
getFamilyForChar
(
uint32_t
ch
,
FontLanguage
lang
,
int
variant
)
const
{
const
FontCollection
::
FontInstance
*
FontCollection
::
getInstanceForChar
(
uint32_t
ch
,
FontLanguage
lang
,
int
variant
)
const
{
if
(
ch
>=
mMaxChar
)
{
return
NULL
;
}
...
...
@@ -128,7 +123,7 @@ const FontFamily* FontCollection::getFamilyForChar(uint32_t ch, FontLanguage lan
#ifdef VERBOSE_DEBUG
ALOGD
(
"querying range %d:%d
\n
"
,
range
.
start
,
range
.
end
);
#endif
FontFamily
*
bestFamily
=
NULL
;
const
FontInstance
*
bestInstance
=
NULL
;
int
bestScore
=
-
1
;
for
(
size_t
i
=
range
.
start
;
i
<
range
.
end
;
i
++
)
{
const
FontInstance
*
instance
=
mInstanceVec
[
i
];
...
...
@@ -136,7 +131,7 @@ const FontFamily* FontCollection::getFamilyForChar(uint32_t ch, FontLanguage lan
FontFamily
*
family
=
instance
->
mFamily
;
// First font family in collection always matches
if
(
mInstances
[
0
].
mFamily
==
family
)
{
return
family
;
return
instance
;
}
int
score
=
lang
.
match
(
family
->
lang
())
*
2
;
if
(
variant
!=
0
&&
variant
==
family
->
variant
())
{
...
...
@@ -144,18 +139,18 @@ const FontFamily* FontCollection::getFamilyForChar(uint32_t ch, FontLanguage lan
}
if
(
score
>
bestScore
)
{
bestScore
=
score
;
best
Family
=
family
;
best
Instance
=
instance
;
}
}
}
return
best
Family
;
return
best
Instance
;
}
void
FontCollection
::
itemize
(
const
uint16_t
*
string
,
size_t
string_size
,
FontStyle
style
,
vector
<
Run
>*
result
)
const
{
FontLanguage
lang
=
style
.
getLanguage
();
int
variant
=
style
.
getVariant
();
const
Font
Family
*
lastFamily
=
NULL
;
const
Font
Instance
*
lastInstance
=
NULL
;
Run
*
run
=
NULL
;
int
nShorts
;
for
(
size_t
i
=
0
;
i
<
string_size
;
i
+=
nShorts
)
{
...
...
@@ -168,20 +163,23 @@ void FontCollection::itemize(const uint16_t *string, size_t string_size, FontSty
nShorts
=
2
;
}
}
const
FontFamily
*
family
=
getFamilyForChar
(
ch
,
lang
,
variant
);
if
(
i
==
0
||
family
!=
lastFamily
)
{
Run
dummy
;
result
->
push_back
(
dummy
);
run
=
&
result
->
back
();
if
(
family
==
NULL
)
{
run
->
font
=
NULL
;
// maybe we should do something different here
}
else
{
run
->
font
=
family
->
getClosestMatch
(
style
);
// TODO: simplify refcounting (FontCollection lifetime dominates)
run
->
font
->
RefLocked
();
// Continue using existing font as long as it has coverage.
if
(
lastInstance
==
NULL
||
!
lastInstance
->
mCoverage
->
get
(
ch
))
{
const
FontInstance
*
instance
=
getInstanceForChar
(
ch
,
lang
,
variant
);
if
(
i
==
0
||
instance
!=
lastInstance
)
{
Run
dummy
;
result
->
push_back
(
dummy
);
run
=
&
result
->
back
();
if
(
instance
==
NULL
)
{
run
->
font
=
NULL
;
// maybe we should do something different here
}
else
{
run
->
font
=
instance
->
mFamily
->
getClosestMatch
(
style
);
// TODO: simplify refcounting (FontCollection lifetime dominates)
run
->
font
->
RefLocked
();
}
lastInstance
=
instance
;
run
->
start
=
i
;
}
lastFamily
=
family
;
run
->
start
=
i
;
}
run
->
end
=
i
+
nShorts
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录