Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
895fb5d3
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看板
提交
895fb5d3
编写于
10月 12, 2010
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Refactor, in a different direction
上级
d2ba016c
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
38 addition
and
46 deletion
+38
-46
src/hb-ot-map-private.hh
src/hb-ot-map-private.hh
+8
-7
src/hb-ot-map.cc
src/hb-ot-map.cc
+12
-11
src/hb-ot-shape-private.hh
src/hb-ot-shape-private.hh
+1
-12
src/hb-ot-shape.cc
src/hb-ot-shape.cc
+17
-16
未找到文件。
src/hb-ot-map-private.hh
浏览文件 @
895fb5d3
...
...
@@ -29,7 +29,7 @@
#ifndef HB_OT_MAP_PRIVATE_HH
#define HB_OT_MAP_PRIVATE_HH
#include "hb-
ot-shape
-private.hh"
#include "hb-
buffer
-private.hh"
#include "hb-ot-layout.h"
...
...
@@ -73,7 +73,7 @@ struct hb_ot_map_t {
{
return
a
->
index
<
b
->
index
?
-
1
:
a
->
index
>
b
->
index
?
1
:
0
;
}
};
HB_INTERNAL
void
add_lookups
(
hb_
ot_shape_plan_context_t
*
c
,
HB_INTERNAL
void
add_lookups
(
hb_
face_t
*
face
,
unsigned
int
table_index
,
unsigned
int
feature_index
,
hb_mask_t
mask
);
...
...
@@ -95,7 +95,8 @@ 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_plan_context_t
*
c
);
HB_INTERNAL
void
compile
(
hb_face_t
*
face
,
hb_segment_properties_t
*
props
);
hb_mask_t
get_global_mask
(
void
)
const
{
return
global_mask
;
}
...
...
@@ -105,14 +106,14 @@ struct hb_ot_map_t {
return
map
?
map
->
mask
:
0
;
}
inline
void
substitute
(
hb_
ot_shape_context_t
*
c
)
const
{
inline
void
substitute
(
hb_
face_t
*
face
,
hb_buffer_t
*
buffer
)
const
{
for
(
unsigned
int
i
=
0
;
i
<
lookup_count
[
0
];
i
++
)
hb_ot_layout_substitute_lookup
(
c
->
face
,
c
->
buffer
,
lookup_maps
[
0
][
i
].
index
,
lookup_maps
[
0
][
i
].
mask
);
hb_ot_layout_substitute_lookup
(
face
,
buffer
,
lookup_maps
[
0
][
i
].
index
,
lookup_maps
[
0
][
i
].
mask
);
}
inline
void
position
(
hb_
ot_shape_context_t
*
c
)
const
{
inline
void
position
(
hb_
font_t
*
font
,
hb_face_t
*
face
,
hb_buffer_t
*
buffer
)
const
{
for
(
unsigned
int
i
=
0
;
i
<
lookup_count
[
1
];
i
++
)
hb_ot_layout_position_lookup
(
c
->
font
,
c
->
face
,
c
->
buffer
,
lookup_maps
[
1
][
i
].
index
,
lookup_maps
[
1
][
i
].
mask
);
hb_ot_layout_position_lookup
(
font
,
face
,
buffer
,
lookup_maps
[
1
][
i
].
index
,
lookup_maps
[
1
][
i
].
mask
);
}
private:
...
...
src/hb-ot-map.cc
浏览文件 @
895fb5d3
...
...
@@ -34,7 +34,7 @@ HB_BEGIN_DECLS
void
hb_ot_map_t
::
add_lookups
(
hb_
ot_shape_plan_context_t
*
c
,
hb_ot_map_t
::
add_lookups
(
hb_
face_t
*
face
,
unsigned
int
table_index
,
unsigned
int
feature_index
,
hb_mask_t
mask
)
...
...
@@ -44,7 +44,7 @@ hb_ot_map_t::add_lookups (hb_ot_shape_plan_context_t *c,
unsigned
int
*
lookup_indices
=
(
unsigned
int
*
)
lookups
;
hb_ot_layout_feature_get_lookup_indexes
(
c
->
face
,
hb_ot_layout_feature_get_lookup_indexes
(
face
,
table_tags
[
table_index
],
feature_index
,
0
,
&
i
,
...
...
@@ -60,7 +60,8 @@ hb_ot_map_t::add_lookups (hb_ot_shape_plan_context_t *c,
void
hb_ot_map_t
::
compile
(
hb_ot_shape_plan_context_t
*
c
)
hb_ot_map_t
::
compile
(
hb_face_t
*
face
,
hb_segment_properties_t
*
props
)
{
global_mask
=
0
;
lookup_count
[
0
]
=
lookup_count
[
1
]
=
0
;
...
...
@@ -75,14 +76,14 @@ hb_ot_map_t::compile (hb_ot_shape_plan_context_t *c)
const
hb_tag_t
*
script_tags
;
hb_tag_t
language_tag
;
script_tags
=
hb_ot_tags_from_script
(
c
->
props
->
script
);
language_tag
=
hb_ot_tag_from_language
(
c
->
props
->
language
);
script_tags
=
hb_ot_tags_from_script
(
props
->
script
);
language_tag
=
hb_ot_tag_from_language
(
props
->
language
);
unsigned
int
script_index
[
2
],
language_index
[
2
];
for
(
unsigned
int
table_index
=
0
;
table_index
<
2
;
table_index
++
)
{
hb_tag_t
table_tag
=
table_tags
[
table_index
];
hb_ot_layout_table_choose_script
(
c
->
face
,
table_tag
,
script_tags
,
&
script_index
[
table_index
]);
hb_ot_layout_script_find_language
(
c
->
face
,
table_tag
,
script_index
[
table_index
],
language_tag
,
&
language_index
[
table_index
]);
hb_ot_layout_table_choose_script
(
face
,
table_tag
,
script_tags
,
&
script_index
[
table_index
]);
hb_ot_layout_script_find_language
(
face
,
table_tag
,
script_index
[
table_index
],
language_tag
,
&
language_index
[
table_index
]);
}
...
...
@@ -124,7 +125,7 @@ hb_ot_map_t::compile (hb_ot_shape_plan_context_t *c)
bool
found
=
false
;
unsigned
int
feature_index
[
2
];
for
(
unsigned
int
table_index
=
0
;
table_index
<
2
;
table_index
++
)
found
|=
hb_ot_layout_language_find_feature
(
c
->
face
,
found
|=
hb_ot_layout_language_find_feature
(
face
,
table_tags
[
table_index
],
script_index
[
table_index
],
language_index
[
table_index
],
...
...
@@ -161,15 +162,15 @@ hb_ot_map_t::compile (hb_ot_shape_plan_context_t *c)
/* Collect lookup indices for features */
unsigned
int
required_feature_index
;
if
(
hb_ot_layout_language_get_required_feature_index
(
c
->
face
,
if
(
hb_ot_layout_language_get_required_feature_index
(
face
,
table_tag
,
script_index
[
table_index
],
language_index
[
table_index
],
&
required_feature_index
))
add_lookups
(
c
,
table_index
,
required_feature_index
,
1
);
add_lookups
(
face
,
table_index
,
required_feature_index
,
1
);
for
(
unsigned
i
=
0
;
i
<
feature_count
;
i
++
)
add_lookups
(
c
,
table_index
,
feature_maps
[
i
].
index
[
table_index
],
feature_maps
[
i
].
mask
);
add_lookups
(
face
,
table_index
,
feature_maps
[
i
].
index
[
table_index
],
feature_maps
[
i
].
mask
);
/* Sort lookups and merge duplicates */
qsort
(
lookup_maps
[
table_index
],
lookup_count
[
table_index
],
sizeof
(
lookup_maps
[
table_index
][
0
]),
(
hb_compare_func_t
)
lookup_map_t
::
cmp
);
...
...
src/hb-ot-shape-private.hh
浏览文件 @
895fb5d3
...
...
@@ -31,23 +31,12 @@
#include "hb-ot-shape.h"
#include "hb-
buffer
-private.hh"
#include "hb-
ot-map
-private.hh"
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
{
...
...
src/hb-ot-shape.cc
浏览文件 @
895fb5d3
...
...
@@ -49,16 +49,19 @@ hb_tag_t default_features[] = {
};
static
void
hb_ot_shape_collect_features
(
hb_ot_shape_plan_context_t
*
c
)
hb_ot_shape_collect_features
(
hb_ot_map_t
*
map
,
hb_segment_properties_t
*
props
,
const
hb_feature_t
*
user_features
,
unsigned
int
num_user_features
)
{
switch
(
c
->
props
->
direction
)
{
switch
(
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'
));
map
->
add_bool_feature
(
HB_TAG
(
'l'
,
't'
,
'r'
,
'a'
));
map
->
add_bool_feature
(
HB_TAG
(
'l'
,
't'
,
'r'
,
'm'
));
break
;
case
HB_DIRECTION_RTL
:
c
->
map
->
add_bool_feature
(
HB_TAG
(
'r'
,
't'
,
'l'
,
'a'
));
c
->
map
->
add_bool_feature
(
HB_TAG
(
'r'
,
't'
,
'l'
,
'm'
),
false
);
map
->
add_bool_feature
(
HB_TAG
(
'r'
,
't'
,
'l'
,
'a'
));
map
->
add_bool_feature
(
HB_TAG
(
'r'
,
't'
,
'l'
,
'm'
),
false
);
break
;
case
HB_DIRECTION_TTB
:
case
HB_DIRECTION_BTT
:
...
...
@@ -67,13 +70,13 @@ hb_ot_shape_collect_features (hb_ot_shape_plan_context_t *c)
}
for
(
unsigned
int
i
=
0
;
i
<
ARRAY_LENGTH
(
default_features
);
i
++
)
c
->
map
->
add_bool_feature
(
default_features
[
i
]);
map
->
add_bool_feature
(
default_features
[
i
]);
/* complex */
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
));
for
(
unsigned
int
i
=
0
;
i
<
num_user_features
;
i
++
)
{
const
hb_feature_t
*
feature
=
&
user_features
[
i
];
map
->
add_feature
(
feature
->
tag
,
feature
->
value
,
(
feature
->
start
==
0
&&
feature
->
end
==
(
unsigned
int
)
-
1
));
}
}
...
...
@@ -105,7 +108,7 @@ hb_ot_substitute_complex (hb_ot_shape_context_t *c)
if
(
!
hb_ot_layout_has_substitution
(
c
->
face
))
return
;
c
->
map
->
substitute
(
c
);
c
->
map
->
substitute
(
c
->
face
,
c
->
buffer
);
c
->
applied_substitute_complex
=
TRUE
;
return
;
...
...
@@ -118,7 +121,7 @@ hb_ot_position_complex (hb_ot_shape_context_t *c)
if
(
!
hb_ot_layout_has_positioning
(
c
->
face
))
return
;
c
->
map
->
position
(
c
);
c
->
map
->
position
(
c
->
font
,
c
->
face
,
c
->
buffer
);
hb_ot_layout_position_finish
(
c
->
font
,
c
->
face
,
c
->
buffer
);
...
...
@@ -324,11 +327,9 @@ hb_ot_shape_plan_internal (hb_ot_map_t *map,
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
);
hb_ot_shape_collect_features
(
map
,
props
,
user_features
,
num_user_features
);
map
->
compile
(
&
c
);
map
->
compile
(
face
,
props
);
}
void
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录