Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
bac1dd6a
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看板
提交
bac1dd6a
编写于
5月 02, 2013
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[OTLayout] Refactor a bit more
上级
d2c96819
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
78 addition
and
75 deletion
+78
-75
src/hb-ot-layout-gsubgpos-private.hh
src/hb-ot-layout-gsubgpos-private.hh
+5
-5
src/hb-ot-layout-private.hh
src/hb-ot-layout-private.hh
+13
-13
src/hb-ot-layout.cc
src/hb-ot-layout.cc
+50
-50
src/hb-ot-map-private.hh
src/hb-ot-map-private.hh
+3
-4
src/hb-ot-shape-complex-arabic-fallback.hh
src/hb-ot-shape-complex-arabic-fallback.hh
+5
-2
src/hb-ot-shape-fallback.cc
src/hb-ot-shape-fallback.cc
+2
-1
未找到文件。
src/hb-ot-layout-gsubgpos-private.hh
浏览文件 @
bac1dd6a
...
...
@@ -278,14 +278,12 @@ struct hb_apply_context_t
hb_apply_context_t
(
unsigned
int
table_index_
,
hb_font_t
*
font_
,
hb_buffer_t
*
buffer_
,
hb_mask_t
lookup_mask_
,
bool
auto_zwj_
)
:
hb_buffer_t
*
buffer_
)
:
table_index
(
table_index_
),
font
(
font_
),
face
(
font
->
face
),
buffer
(
buffer_
),
direction
(
buffer_
->
props
.
direction
),
lookup_mask
(
lookup_mask_
),
auto_zwj
(
auto_zwj_
),
lookup_mask
(
1
),
auto_zwj
(
true
),
recurse_func
(
NULL
),
nesting_level_left
(
MAX_NESTING_LEVEL
),
lookup_props
(
0
),
...
...
@@ -293,6 +291,8 @@ struct hb_apply_context_t
has_glyph_classes
(
gdef
.
has_glyph_classes
()),
debug_depth
(
0
)
{}
inline
void
set_lookup_mask
(
hb_mask_t
mask
)
{
lookup_mask
=
mask
;
}
inline
void
set_auto_zwj
(
bool
auto_zwj_
)
{
auto_zwj
=
auto_zwj_
;
}
inline
void
set_recurse_func
(
recurse_func_t
func
)
{
recurse_func
=
func
;
}
inline
void
set_lookup_props
(
unsigned
int
lookup_props_
)
{
lookup_props
=
lookup_props_
;
}
inline
void
set_lookup
(
const
Lookup
&
l
)
{
lookup_props
=
l
.
get_props
();
}
...
...
src/hb-ot-layout-private.hh
浏览文件 @
bac1dd6a
...
...
@@ -202,12 +202,19 @@ HB_INTERNAL void
hb_ot_layout_substitute_start
(
hb_font_t
*
font
,
hb_buffer_t
*
buffer
);
HB_INTERNAL
hb_bool_t
hb_ot_layout_substitute_lookup
(
hb_font_t
*
font
,
hb_buffer_t
*
buffer
,
unsigned
int
lookup_index
,
hb_mask_t
mask
,
hb_bool_t
auto_zwj
);
struct
hb_ot_layout_lookup_accelerator_t
;
namespace
OT
{
struct
hb_apply_context_t
;
struct
SubstLookup
;
}
HB_INTERNAL
void
hb_ot_layout_substitute_lookup
(
OT
::
hb_apply_context_t
*
c
,
const
OT
::
SubstLookup
&
lookup
,
const
hb_ot_layout_lookup_accelerator_t
&
accel
);
/* Should be called after all the substitute_lookup's are done */
HB_INTERNAL
void
...
...
@@ -220,13 +227,6 @@ HB_INTERNAL void
hb_ot_layout_position_start
(
hb_font_t
*
font
,
hb_buffer_t
*
buffer
);
HB_INTERNAL
hb_bool_t
hb_ot_layout_position_lookup
(
hb_font_t
*
font
,
hb_buffer_t
*
buffer
,
unsigned
int
lookup_index
,
hb_mask_t
mask
,
hb_bool_t
auto_zwj
);
/* Should be called after all the position_lookup's are done */
HB_INTERNAL
void
hb_ot_layout_position_finish
(
hb_font_t
*
font
,
...
...
src/hb-ot-layout.cc
浏览文件 @
bac1dd6a
...
...
@@ -669,22 +669,6 @@ hb_ot_layout_substitute_start (hb_font_t *font, hb_buffer_t *buffer)
OT
::
GSUB
::
substitute_start
(
font
,
buffer
);
}
hb_bool_t
hb_ot_layout_substitute_lookup
(
hb_font_t
*
font
,
hb_buffer_t
*
buffer
,
unsigned
int
lookup_index
,
hb_mask_t
mask
,
hb_bool_t
auto_zwj
)
{
if
(
unlikely
(
lookup_index
>=
hb_ot_layout_from_face
(
font
->
face
)
->
gsub_lookup_count
))
return
false
;
OT
::
hb_apply_context_t
c
(
0
,
font
,
buffer
,
mask
,
auto_zwj
);
const
OT
::
SubstLookup
&
l
=
hb_ot_layout_from_face
(
font
->
face
)
->
gsub
->
get_lookup
(
lookup_index
);
return
l
.
apply_string
(
&
c
,
&
hb_ot_layout_from_face
(
font
->
face
)
->
gsub_accels
[
lookup_index
].
digest
);
}
void
hb_ot_layout_substitute_finish
(
hb_font_t
*
font
,
hb_buffer_t
*
buffer
)
{
...
...
@@ -719,22 +703,6 @@ hb_ot_layout_position_start (hb_font_t *font, hb_buffer_t *buffer)
OT
::
GPOS
::
position_start
(
font
,
buffer
);
}
hb_bool_t
hb_ot_layout_position_lookup
(
hb_font_t
*
font
,
hb_buffer_t
*
buffer
,
unsigned
int
lookup_index
,
hb_mask_t
mask
,
hb_bool_t
auto_zwj
)
{
if
(
unlikely
(
lookup_index
>=
hb_ot_layout_from_face
(
font
->
face
)
->
gpos_lookup_count
))
return
false
;
OT
::
hb_apply_context_t
c
(
1
,
font
,
buffer
,
mask
,
auto_zwj
);
const
OT
::
PosLookup
&
l
=
hb_ot_layout_from_face
(
font
->
face
)
->
gpos
->
get_lookup
(
lookup_index
);
return
l
.
apply_string
(
&
c
,
&
hb_ot_layout_from_face
(
font
->
face
)
->
gpos_accels
[
lookup_index
].
digest
);
}
void
hb_ot_layout_position_finish
(
hb_font_t
*
font
,
hb_buffer_t
*
buffer
)
{
...
...
@@ -788,35 +756,57 @@ hb_ot_layout_get_size_params (hb_face_t *face,
/*
* Parts of
hb-ot-map
are implemented here such that they have direct
* Parts of
different types
are implemented here such that they have direct
* access to GSUB/GPOS lookups.
*/
inline
void
hb_ot_map_t
::
apply
(
unsigned
int
table_index
,
struct
GSUBProxy
{
static
const
unsigned
int
table_index
=
0
;
typedef
OT
::
SubstLookup
Lookup
;
GSUBProxy
(
hb_face_t
*
face
)
:
table
(
*
hb_ot_layout_from_face
(
face
)
->
gsub
),
accels
(
hb_ot_layout_from_face
(
face
)
->
gsub_accels
)
{}
const
OT
::
GSUB
&
table
;
const
hb_ot_layout_lookup_accelerator_t
*
accels
;
};
struct
GPOSProxy
{
static
const
unsigned
int
table_index
=
1
;
typedef
OT
::
PosLookup
Lookup
;
GPOSProxy
(
hb_face_t
*
face
)
:
table
(
*
hb_ot_layout_from_face
(
face
)
->
gpos
),
accels
(
hb_ot_layout_from_face
(
face
)
->
gpos_accels
)
{}
const
OT
::
GPOS
&
table
;
const
hb_ot_layout_lookup_accelerator_t
*
accels
;
};
template
<
typename
Proxy
>
inline
void
hb_ot_map_t
::
apply
(
const
Proxy
&
proxy
,
const
hb_ot_shape_plan_t
*
plan
,
hb_font_t
*
font
,
hb_buffer_t
*
buffer
)
const
{
const
unsigned
int
table_index
=
proxy
.
table_index
;
unsigned
int
i
=
0
;
OT
::
hb_apply_context_t
c
(
table_index
,
font
,
buffer
);
for
(
unsigned
int
stage_index
=
0
;
stage_index
<
stages
[
table_index
].
len
;
stage_index
++
)
{
const
stage_map_t
*
stage
=
&
stages
[
table_index
][
stage_index
];
for
(;
i
<
stage
->
last_lookup
;
i
++
)
switch
(
table_index
)
{
case
0
:
hb_ot_layout_substitute_lookup
(
font
,
buffer
,
lookups
[
table_index
][
i
].
index
,
lookups
[
table_index
][
i
].
mask
,
lookups
[
table_index
][
i
].
auto_zwj
);
break
;
case
1
:
hb_ot_layout_position_lookup
(
font
,
buffer
,
lookups
[
table_index
][
i
].
index
,
lookups
[
table_index
][
i
].
mask
,
lookups
[
table_index
][
i
].
auto_zwj
);
break
;
}
{
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
);
}
if
(
stage
->
pause_func
)
{
...
...
@@ -828,10 +818,20 @@ inline void hb_ot_map_t::apply (unsigned int table_index,
void
hb_ot_map_t
::
substitute
(
const
hb_ot_shape_plan_t
*
plan
,
hb_font_t
*
font
,
hb_buffer_t
*
buffer
)
const
{
apply
(
0
,
plan
,
font
,
buffer
);
GSUBProxy
proxy
(
font
->
face
);
apply
(
proxy
,
plan
,
font
,
buffer
);
}
void
hb_ot_map_t
::
position
(
const
hb_ot_shape_plan_t
*
plan
,
hb_font_t
*
font
,
hb_buffer_t
*
buffer
)
const
{
apply
(
1
,
plan
,
font
,
buffer
);
GPOSProxy
proxy
(
font
->
face
);
apply
(
proxy
,
plan
,
font
,
buffer
);
}
HB_INTERNAL
void
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
);
}
src/hb-ot-map-private.hh
浏览文件 @
bac1dd6a
...
...
@@ -118,10 +118,9 @@ struct hb_ot_map_t
}
HB_INTERNAL
void
collect_lookups
(
unsigned
int
table_index
,
hb_set_t
*
lookups
)
const
;
HB_INTERNAL
inline
void
apply
(
unsigned
int
table_index
,
const
struct
hb_ot_shape_plan_t
*
plan
,
hb_font_t
*
font
,
hb_buffer_t
*
buffer
)
const
;
template
<
typename
Proxy
>
HB_INTERNAL
inline
void
apply
(
const
Proxy
&
proxy
,
const
struct
hb_ot_shape_plan_t
*
plan
,
hb_font_t
*
font
,
hb_buffer_t
*
buffer
)
const
;
HB_INTERNAL
void
substitute
(
const
struct
hb_ot_shape_plan_t
*
plan
,
hb_font_t
*
font
,
hb_buffer_t
*
buffer
)
const
;
HB_INTERNAL
void
position
(
const
struct
hb_ot_shape_plan_t
*
plan
,
hb_font_t
*
font
,
hb_buffer_t
*
buffer
)
const
;
...
...
src/hb-ot-shape-complex-arabic-fallback.hh
浏览文件 @
bac1dd6a
...
...
@@ -246,10 +246,13 @@ arabic_fallback_plan_shape (arabic_fallback_plan_t *fallback_plan,
hb_font_t
*
font
,
hb_buffer_t
*
buffer
)
{
OT
::
hb_apply_context_t
c
(
0
,
font
,
buffer
);
for
(
unsigned
int
i
=
0
;
i
<
ARABIC_NUM_FALLBACK_FEATURES
;
i
++
)
if
(
fallback_plan
->
lookup_array
[
i
])
{
OT
::
hb_apply_context_t
c
(
0
,
font
,
buffer
,
fallback_plan
->
mask_array
[
i
],
true
/*auto_zwj*/
);
fallback_plan
->
lookup_array
[
i
]
->
apply_string
(
&
c
,
&
fallback_plan
->
accel_array
[
i
].
digest
);
c
.
set_lookup_mask
(
fallback_plan
->
mask_array
[
i
]);
hb_ot_layout_substitute_lookup
(
&
c
,
*
fallback_plan
->
lookup_array
[
i
],
fallback_plan
->
accel_array
[
i
]);
}
}
...
...
src/hb-ot-shape-fallback.cc
浏览文件 @
bac1dd6a
...
...
@@ -420,7 +420,8 @@ _hb_ot_shape_fallback_kern (const hb_ot_shape_plan_t *plan,
hb_mask_t
kern_mask
=
plan
->
map
.
get_1_mask
(
HB_DIRECTION_IS_HORIZONTAL
(
buffer
->
props
.
direction
)
?
HB_TAG
(
'k'
,
'e'
,
'r'
,
'n'
)
:
HB_TAG
(
'v'
,
'k'
,
'r'
,
'n'
));
OT
::
hb_apply_context_t
c
(
1
,
font
,
buffer
,
kern_mask
,
true
/*auto_zwj*/
);
OT
::
hb_apply_context_t
c
(
1
,
font
,
buffer
);
c
.
set_lookup_mask
(
kern_mask
);
c
.
set_lookup_props
(
OT
::
LookupFlag
::
IgnoreMarks
);
for
(
buffer
->
idx
=
0
;
buffer
->
idx
<
count
;)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录