Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
45f3d980
T
Third Party Harfbuzz
项目概览
OpenHarmony
/
Third Party Harfbuzz
大约 1 年 前同步成功
通知
0
Star
18
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Harfbuzz
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
45f3d980
编写于
5月 03, 2013
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[OTLayout] Merge / templateize apply_string()
上级
e015b8f2
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
69 addition
and
76 deletion
+69
-76
src/hb-ot-layout-gpos-table.hh
src/hb-ot-layout-gpos-table.hh
+0
-25
src/hb-ot-layout-gsub-table.hh
src/hb-ot-layout-gsub-table.hh
+0
-48
src/hb-ot-layout.cc
src/hb-ot-layout.cc
+69
-3
未找到文件。
src/hb-ot-layout-gpos-table.hh
浏览文件 @
45f3d980
...
...
@@ -1472,31 +1472,6 @@ struct PosLookup : Lookup
static
bool
apply_recurse_func
(
hb_apply_context_t
*
c
,
unsigned
int
lookup_index
);
inline
bool
apply_string
(
hb_apply_context_t
*
c
,
const
hb_set_digest_t
*
digest
)
const
{
bool
ret
=
false
;
if
(
unlikely
(
!
c
->
buffer
->
len
||
!
c
->
lookup_mask
))
return
false
;
c
->
set_recurse_func
(
apply_recurse_func
);
c
->
set_lookup
(
*
this
);
c
->
buffer
->
idx
=
0
;
while
(
c
->
buffer
->
idx
<
c
->
buffer
->
len
)
{
if
(
digest
->
may_have
(
c
->
buffer
->
cur
().
codepoint
)
&&
(
c
->
buffer
->
cur
().
mask
&
c
->
lookup_mask
)
&&
apply_once
(
c
))
ret
=
true
;
else
c
->
buffer
->
idx
++
;
}
return
ret
;
}
template
<
typename
context_t
>
static
inline
typename
context_t
::
return_t
dispatch_recurse_func
(
context_t
*
c
,
unsigned
int
lookup_index
);
...
...
src/hb-ot-layout-gsub-table.hh
浏览文件 @
45f3d980
...
...
@@ -1247,54 +1247,6 @@ struct SubstLookup : Lookup
}
static
bool
apply_recurse_func
(
hb_apply_context_t
*
c
,
unsigned
int
lookup_index
);
inline
bool
apply_string
(
hb_apply_context_t
*
c
,
const
hb_set_digest_t
*
digest
)
const
{
bool
ret
=
false
;
if
(
unlikely
(
!
c
->
buffer
->
len
||
!
c
->
lookup_mask
))
return
false
;
c
->
set_recurse_func
(
apply_recurse_func
);
c
->
set_lookup
(
*
this
);
if
(
likely
(
!
is_reverse
()))
{
/* in/out forward substitution */
c
->
buffer
->
clear_output
();
c
->
buffer
->
idx
=
0
;
while
(
c
->
buffer
->
idx
<
c
->
buffer
->
len
)
{
if
(
digest
->
may_have
(
c
->
buffer
->
cur
().
codepoint
)
&&
(
c
->
buffer
->
cur
().
mask
&
c
->
lookup_mask
)
&&
apply_once
(
c
))
ret
=
true
;
else
c
->
buffer
->
next_glyph
();
}
if
(
ret
)
c
->
buffer
->
swap_buffers
();
}
else
{
/* in-place backward substitution */
c
->
buffer
->
remove_output
();
c
->
buffer
->
idx
=
c
->
buffer
->
len
-
1
;
do
{
if
(
digest
->
may_have
(
c
->
buffer
->
cur
().
codepoint
)
&&
(
c
->
buffer
->
cur
().
mask
&
c
->
lookup_mask
)
&&
apply_once
(
c
))
ret
=
true
;
else
c
->
buffer
->
idx
--
;
}
while
((
int
)
c
->
buffer
->
idx
>=
0
);
}
return
ret
;
}
inline
SubstLookupSubTable
&
serialize_subtable
(
hb_serialize_context_t
*
c
,
unsigned
int
i
)
...
...
src/hb-ot-layout.cc
浏览文件 @
45f3d980
...
...
@@ -2,7 +2,7 @@
* Copyright © 1998-2004 David Turner and Werner Lemberg
* Copyright © 2006 Behdad Esfahbod
* Copyright © 2007,2008,2009 Red Hat, Inc.
* Copyright © 2012 Google, Inc.
* Copyright © 2012
,2013
Google, Inc.
*
* This is part of HarfBuzz, a text shaping library.
*
...
...
@@ -788,6 +788,69 @@ struct GPOSProxy
};
template
<
typename
Lookup
>
static
inline
bool
apply_once
(
OT
::
hb_apply_context_t
*
c
,
const
Lookup
&
lookup
)
{
if
(
!
c
->
check_glyph_property
(
&
c
->
buffer
->
cur
(),
c
->
lookup_props
))
return
false
;
return
lookup
.
dispatch
(
c
);
}
template
<
typename
Proxy
>
static
inline
bool
apply_string
(
OT
::
hb_apply_context_t
*
c
,
const
typename
Proxy
::
Lookup
&
lookup
,
const
hb_ot_layout_lookup_accelerator_t
&
accel
)
{
bool
ret
=
false
;
if
(
unlikely
(
!
c
->
buffer
->
len
||
!
c
->
lookup_mask
))
return
false
;
c
->
set_lookup
(
lookup
);
if
(
likely
(
!
lookup
.
is_reverse
()))
{
/* in/out forward substitution/positioning */
if
(
Proxy
::
table_index
==
0
)
c
->
buffer
->
clear_output
();
c
->
buffer
->
idx
=
0
;
while
(
c
->
buffer
->
idx
<
c
->
buffer
->
len
)
{
if
(
accel
.
digest
.
may_have
(
c
->
buffer
->
cur
().
codepoint
)
&&
(
c
->
buffer
->
cur
().
mask
&
c
->
lookup_mask
)
&&
apply_once
(
c
,
lookup
))
ret
=
true
;
else
c
->
buffer
->
next_glyph
();
}
if
(
ret
&&
Proxy
::
table_index
==
0
)
c
->
buffer
->
swap_buffers
();
}
else
{
/* in-place backward substitution/positioning */
if
(
Proxy
::
table_index
==
0
)
c
->
buffer
->
remove_output
();
c
->
buffer
->
idx
=
c
->
buffer
->
len
-
1
;
do
{
if
(
accel
.
digest
.
may_have
(
c
->
buffer
->
cur
().
codepoint
)
&&
(
c
->
buffer
->
cur
().
mask
&
c
->
lookup_mask
)
&&
apply_once
(
c
,
lookup
))
ret
=
true
;
else
c
->
buffer
->
idx
--
;
}
while
((
int
)
c
->
buffer
->
idx
>=
0
);
}
return
ret
;
}
template
<
typename
Proxy
>
inline
void
hb_ot_map_t
::
apply
(
const
Proxy
&
proxy
,
const
hb_ot_shape_plan_t
*
plan
,
...
...
@@ -797,6 +860,7 @@ inline void hb_ot_map_t::apply (const Proxy &proxy,
const
unsigned
int
table_index
=
proxy
.
table_index
;
unsigned
int
i
=
0
;
OT
::
hb_apply_context_t
c
(
table_index
,
font
,
buffer
);
c
.
set_recurse_func
(
Proxy
::
Lookup
::
apply_recurse_func
);
for
(
unsigned
int
stage_index
=
0
;
stage_index
<
stages
[
table_index
].
len
;
stage_index
++
)
{
const
stage_map_t
*
stage
=
&
stages
[
table_index
][
stage_index
];
...
...
@@ -805,7 +869,9 @@ inline void hb_ot_map_t::apply (const Proxy &proxy,
unsigned
int
lookup_index
=
lookups
[
table_index
][
i
].
index
;
c
.
set_lookup_mask
(
lookups
[
table_index
][
i
].
mask
);
c
.
set_auto_zwj
(
lookups
[
table_index
][
i
].
auto_zwj
);
proxy
.
table
.
get_lookup
(
lookup_index
).
apply_string
(
&
c
,
&
proxy
.
accels
[
lookup_index
].
digest
);
apply_string
<
Proxy
>
(
&
c
,
proxy
.
table
.
get_lookup
(
lookup_index
),
proxy
.
accels
[
lookup_index
]);
}
if
(
stage
->
pause_func
)
...
...
@@ -833,5 +899,5 @@ hb_ot_layout_substitute_lookup (OT::hb_apply_context_t *c,
const
OT
::
SubstLookup
&
lookup
,
const
hb_ot_layout_lookup_accelerator_t
&
accel
)
{
lookup
.
apply_string
(
c
,
&
accel
.
digest
);
apply_string
<
GSUBProxy
>
(
c
,
lookup
,
accel
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录