Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
d2ba016c
T
Third Party Harfbuzz
项目概览
OpenHarmony
/
Third Party Harfbuzz
接近 2 年 前同步成功
通知
1
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看板
提交
d2ba016c
编写于
10月 12, 2010
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
More refactoring
上级
66e487df
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
81 addition
and
52 deletion
+81
-52
src/hb-ot-map-private.hh
src/hb-ot-map-private.hh
+5
-27
src/hb-ot-map.cc
src/hb-ot-map.cc
+29
-3
src/hb-ot-shape-private.hh
src/hb-ot-shape-private.hh
+14
-2
src/hb-ot-shape.cc
src/hb-ot-shape.cc
+28
-15
src/hb-ot-shape.h
src/hb-ot-shape.h
+5
-5
未找到文件。
src/hb-ot-map-private.hh
浏览文件 @
d2ba016c
...
...
@@ -73,32 +73,10 @@ struct hb_ot_map_t {
{
return
a
->
index
<
b
->
index
?
-
1
:
a
->
index
>
b
->
index
?
1
:
0
;
}
};
void
add_lookups
(
hb_ot_shape_context_t
*
c
,
unsigned
int
table_index
,
unsigned
int
feature_index
,
hb_mask_t
mask
)
{
unsigned
int
i
=
MAX_LOOKUPS
-
lookup_count
[
table_index
];
lookup_map_t
*
lookups
=
lookup_maps
[
table_index
]
+
lookup_count
[
table_index
];
unsigned
int
*
lookup_indices
=
(
unsigned
int
*
)
lookups
;
hb_ot_layout_feature_get_lookup_indexes
(
c
->
face
,
table_tags
[
table_index
],
feature_index
,
0
,
&
i
,
lookup_indices
);
lookup_count
[
table_index
]
+=
i
;
while
(
i
--
)
{
lookups
[
i
].
mask
=
mask
;
lookups
[
i
].
index
=
lookup_indices
[
i
];
}
}
HB_INTERNAL
void
add_lookups
(
hb_ot_shape_plan_context_t
*
c
,
unsigned
int
table_index
,
unsigned
int
feature_index
,
hb_mask_t
mask
);
public:
...
...
@@ -117,7 +95,7 @@ struct hb_ot_map_t {
inline
void
add_bool_feature
(
hb_tag_t
tag
,
bool
global
=
true
)
{
add_feature
(
tag
,
1
,
global
);
}
HB_INTERNAL
void
compile
(
hb_ot_shape_context_t
*
c
);
HB_INTERNAL
void
compile
(
hb_ot_shape_
plan_
context_t
*
c
);
hb_mask_t
get_global_mask
(
void
)
const
{
return
global_mask
;
}
...
...
src/hb-ot-map.cc
浏览文件 @
d2ba016c
...
...
@@ -34,7 +34,33 @@ HB_BEGIN_DECLS
void
hb_ot_map_t
::
compile
(
hb_ot_shape_context_t
*
c
)
hb_ot_map_t
::
add_lookups
(
hb_ot_shape_plan_context_t
*
c
,
unsigned
int
table_index
,
unsigned
int
feature_index
,
hb_mask_t
mask
)
{
unsigned
int
i
=
MAX_LOOKUPS
-
lookup_count
[
table_index
];
lookup_map_t
*
lookups
=
lookup_maps
[
table_index
]
+
lookup_count
[
table_index
];
unsigned
int
*
lookup_indices
=
(
unsigned
int
*
)
lookups
;
hb_ot_layout_feature_get_lookup_indexes
(
c
->
face
,
table_tags
[
table_index
],
feature_index
,
0
,
&
i
,
lookup_indices
);
lookup_count
[
table_index
]
+=
i
;
while
(
i
--
)
{
lookups
[
i
].
mask
=
mask
;
lookups
[
i
].
index
=
lookup_indices
[
i
];
}
}
void
hb_ot_map_t
::
compile
(
hb_ot_shape_plan_context_t
*
c
)
{
global_mask
=
0
;
lookup_count
[
0
]
=
lookup_count
[
1
]
=
0
;
...
...
@@ -49,8 +75,8 @@ hb_ot_map_t::compile (hb_ot_shape_context_t *c)
const
hb_tag_t
*
script_tags
;
hb_tag_t
language_tag
;
script_tags
=
hb_ot_tags_from_script
(
c
->
buffer
->
props
.
script
);
language_tag
=
hb_ot_tag_from_language
(
c
->
buffer
->
props
.
language
);
script_tags
=
hb_ot_tags_from_script
(
c
->
props
->
script
);
language_tag
=
hb_ot_tag_from_language
(
c
->
props
->
language
);
unsigned
int
script_index
[
2
],
language_index
[
2
];
for
(
unsigned
int
table_index
=
0
;
table_index
<
2
;
table_index
++
)
{
...
...
src/hb-ot-shape-private.hh
浏览文件 @
d2ba016c
...
...
@@ -37,14 +37,26 @@ HB_BEGIN_DECLS
struct
hb_ot_map_t
;
struct
hb_ot_shape_plan_context_t
{
struct
hb_ot_map_t
*
map
;
hb_face_t
*
face
;
hb_segment_properties_t
*
props
;
const
hb_feature_t
*
user_features
;
unsigned
int
num_user_features
;
};
struct
hb_ot_shape_context_t
{
/* Input to hb_ot_shape() */
hb_font_t
*
font
;
hb_face_t
*
face
;
hb_buffer_t
*
buffer
;
hb_feature_t
*
features
;
unsigned
int
num
_features
;
const
hb_feature_t
*
user_
features
;
unsigned
int
num_user
_features
;
/* Transient stuff */
hb_direction_t
original_direction
;
...
...
src/hb-ot-shape.cc
浏览文件 @
d2ba016c
...
...
@@ -49,9 +49,9 @@ hb_tag_t default_features[] = {
};
static
void
hb_ot_shape_collect_features
(
hb_ot_shape_context_t
*
c
)
hb_ot_shape_collect_features
(
hb_ot_shape_
plan_
context_t
*
c
)
{
switch
(
c
->
original_
direction
)
{
switch
(
c
->
props
->
direction
)
{
case
HB_DIRECTION_LTR
:
c
->
map
->
add_bool_feature
(
HB_TAG
(
'l'
,
't'
,
'r'
,
'a'
));
c
->
map
->
add_bool_feature
(
HB_TAG
(
'l'
,
't'
,
'r'
,
'm'
));
...
...
@@ -71,8 +71,8 @@ hb_ot_shape_collect_features (hb_ot_shape_context_t *c)
/* complex */
for
(
unsigned
int
i
=
0
;
i
<
c
->
num_features
;
i
++
)
{
const
hb_feature_t
*
feature
=
&
c
->
features
[
i
];
for
(
unsigned
int
i
=
0
;
i
<
c
->
num_
user_
features
;
i
++
)
{
const
hb_feature_t
*
feature
=
&
c
->
user_
features
[
i
];
c
->
map
->
add_feature
(
feature
->
tag
,
feature
->
value
,
(
feature
->
start
==
0
&&
feature
->
end
==
(
unsigned
int
)
-
1
));
}
}
...
...
@@ -85,9 +85,9 @@ hb_ot_shape_setup_masks (hb_ot_shape_context_t *c)
if
(
global_mask
)
c
->
buffer
->
set_masks
(
global_mask
,
global_mask
,
0
,
(
unsigned
int
)
-
1
);
for
(
unsigned
int
i
=
0
;
i
<
c
->
num_features
;
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
c
->
num_
user_
features
;
i
++
)
{
hb_feature_t
*
feature
=
&
c
->
features
[
i
];
const
hb_feature_t
*
feature
=
&
c
->
user_
features
[
i
];
if
(
!
(
feature
->
start
==
0
&&
feature
->
end
==
(
unsigned
int
)
-
1
))
{
unsigned
int
shift
;
hb_mask_t
mask
=
c
->
map
->
get_mask
(
feature
->
tag
,
&
shift
);
...
...
@@ -271,6 +271,9 @@ hb_position_complex_fallback_visual (hb_ot_shape_context_t *c)
static
void
hb_ot_shape_internal
(
hb_ot_shape_context_t
*
c
)
{
/* Save the original direction, we use it later. */
c
->
original_direction
=
c
->
buffer
->
props
.
direction
;
hb_ot_shape_setup_masks
(
c
);
hb_form_clusters
(
c
);
...
...
@@ -314,23 +317,33 @@ hb_ot_shape_internal (hb_ot_shape_context_t *c)
c
->
buffer
->
props
.
direction
=
c
->
original_direction
;
}
void
hb_ot_shape_plan_internal
(
hb_ot_map_t
*
map
,
hb_face_t
*
face
,
hb_segment_properties_t
*
props
,
const
hb_feature_t
*
user_features
,
unsigned
int
num_user_features
)
{
hb_ot_shape_plan_context_t
c
=
{
map
,
face
,
props
,
user_features
,
num_user_features
};
hb_ot_shape_collect_features
(
&
c
);
map
->
compile
(
&
c
);
}
void
hb_ot_shape
(
hb_font_t
*
font
,
hb_face_t
*
face
,
hb_buffer_t
*
buffer
,
hb_feature_t
*
features
,
unsigned
int
num
_features
)
const
hb_feature_t
*
user_
features
,
unsigned
int
num_user
_features
)
{
hb_ot_shape_context_t
c
=
{
font
,
face
,
buffer
,
features
,
num_features
};
hb_ot_map_t
map
;
/* Setup transient context members */
c
.
original_direction
=
buffer
->
props
.
direction
;
c
.
map
=
&
map
;
hb_ot_shape_collect_features
(
&
c
);
c
.
map
->
compile
(
&
c
);
hb_ot_shape_plan_internal
(
&
map
,
face
,
&
buffer
->
props
,
user_features
,
num_user_features
);
hb_ot_shape_context_t
c
=
{
font
,
face
,
buffer
,
user_features
,
num_user_features
};
c
.
map
=
&
map
;
hb_ot_shape_internal
(
&
c
);
}
...
...
src/hb-ot-shape.h
浏览文件 @
d2ba016c
...
...
@@ -34,11 +34,11 @@ HB_BEGIN_DECLS
void
hb_ot_shape
(
hb_font_t
*
font
,
hb_face_t
*
face
,
hb_buffer_t
*
buffer
,
hb_feature_t
*
features
,
unsigned
int
num
_features
);
hb_ot_shape
(
hb_font_t
*
font
,
hb_face_t
*
face
,
hb_buffer_t
*
buffer
,
const
hb_feature_t
*
user_
features
,
unsigned
int
num_user
_features
);
HB_END_DECLS
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录