Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
8f08c327
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看板
提交
8f08c327
编写于
10月 08, 2010
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Minor cleanup
上级
a806762a
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
28 addition
and
56 deletion
+28
-56
src/hb-open-type-private.hh
src/hb-open-type-private.hh
+2
-6
src/hb-ot-map-private.hh
src/hb-ot-map-private.hh
+17
-44
src/hb-ot-tag.c
src/hb-ot-tag.c
+5
-6
src/hb-private.h
src/hb-private.h
+4
-0
未找到文件。
src/hb-open-type-private.hh
浏览文件 @
8f08c327
...
@@ -718,13 +718,9 @@ struct SortedArrayOf : ArrayOf<Type> {
...
@@ -718,13 +718,9 @@ struct SortedArrayOf : ArrayOf<Type> {
template
<
typename
SearchType
>
template
<
typename
SearchType
>
inline
int
search
(
const
SearchType
&
x
)
const
{
inline
int
search
(
const
SearchType
&
x
)
const
{
class
Cmp
{
class
Cmp
{
public:
static
int
cmp
(
const
void
*
p1
,
const
void
*
p2
)
{
public:
static
int
cmp
(
const
SearchType
*
a
,
const
Type
*
b
)
{
return
b
->
cmp
(
*
a
);
}
const
SearchType
*
a
=
reinterpret_cast
<
const
SearchType
*>
(
p1
);
const
Type
*
b
=
reinterpret_cast
<
const
Type
*>
(
p2
);
return
b
->
cmp
(
*
a
);
}
};
};
const
Type
*
p
=
(
const
Type
*
)
bsearch
(
&
x
,
this
->
array
,
this
->
len
,
sizeof
(
this
->
array
[
0
]),
Cmp
::
cmp
);
const
Type
*
p
=
(
const
Type
*
)
bsearch
(
&
x
,
this
->
array
,
this
->
len
,
sizeof
(
this
->
array
[
0
]),
(
hb_compare_func_t
)
Cmp
::
cmp
);
return
p
?
p
-
this
->
array
:
-
1
;
return
p
?
p
-
this
->
array
:
-
1
;
}
}
};
};
...
...
src/hb-ot-map-private.hh
浏览文件 @
8f08c327
...
@@ -43,23 +43,16 @@ static const hb_tag_t table_tags[2] = {HB_OT_TAG_GSUB, HB_OT_TAG_GPOS};
...
@@ -43,23 +43,16 @@ static const hb_tag_t table_tags[2] = {HB_OT_TAG_GSUB, HB_OT_TAG_GPOS};
struct
hb_mask_allocator_t
{
struct
hb_mask_allocator_t
{
private:
struct
feature_info_t
{
struct
feature_info_t
{
hb_tag_t
tag
;
hb_tag_t
tag
;
unsigned
int
value
;
unsigned
int
value
;
unsigned
int
seq
;
unsigned
int
seq
;
bool
global
;
bool
global
;
static
int
static
int
cmp
(
const
feature_info_t
*
a
,
const
feature_info_t
*
b
)
cmp
(
const
void
*
p1
,
const
void
*
p2
)
{
return
(
a
->
tag
!=
b
->
tag
)
?
(
a
->
tag
<
b
->
tag
?
-
1
:
1
)
:
(
a
->
seq
<
b
->
seq
?
-
1
:
1
);
}
{
const
feature_info_t
*
a
=
reinterpret_cast
<
const
feature_info_t
*>
(
p1
);
const
feature_info_t
*
b
=
reinterpret_cast
<
const
feature_info_t
*>
(
p2
);
if
(
a
->
tag
!=
b
->
tag
)
return
a
->
tag
<
b
->
tag
?
-
1
:
1
;
return
a
->
seq
<
b
->
seq
?
-
1
:
1
;
}
};
};
struct
feature_map_t
{
struct
feature_map_t
{
...
@@ -68,28 +61,16 @@ struct hb_mask_allocator_t {
...
@@ -68,28 +61,16 @@ struct hb_mask_allocator_t {
unsigned
int
shift
;
unsigned
int
shift
;
hb_mask_t
mask
;
hb_mask_t
mask
;
static
int
static
int
cmp
(
const
feature_map_t
*
a
,
const
feature_map_t
*
b
)
cmp
(
const
void
*
p1
,
const
void
*
p2
)
{
return
a
->
tag
<
b
->
tag
?
-
1
:
a
->
tag
>
b
->
tag
?
1
:
0
;
}
{
const
feature_map_t
*
a
=
reinterpret_cast
<
const
feature_map_t
*>
(
p1
);
const
feature_map_t
*
b
=
reinterpret_cast
<
const
feature_map_t
*>
(
p2
);
return
a
->
tag
<
b
->
tag
?
-
1
:
a
->
tag
>
b
->
tag
?
1
:
0
;
}
};
};
struct
lookup_map_t
{
struct
lookup_map_t
{
unsigned
int
index
;
unsigned
int
index
;
hb_mask_t
mask
;
hb_mask_t
mask
;
static
int
static
int
cmp
(
const
lookup_map_t
*
a
,
const
lookup_map_t
*
b
)
cmp
(
const
void
*
p1
,
const
void
*
p2
)
{
return
a
->
index
<
b
->
index
?
-
1
:
a
->
index
>
b
->
index
?
1
:
0
;
}
{
const
lookup_map_t
*
a
=
reinterpret_cast
<
const
lookup_map_t
*>
(
p1
);
const
lookup_map_t
*
b
=
reinterpret_cast
<
const
lookup_map_t
*>
(
p2
);
return
a
->
index
<
b
->
index
?
-
1
:
a
->
index
>
b
->
index
?
1
:
0
;
}
};
};
...
@@ -120,6 +101,7 @@ struct hb_mask_allocator_t {
...
@@ -120,6 +101,7 @@ struct hb_mask_allocator_t {
public:
hb_mask_allocator_t
(
void
)
:
feature_count
(
0
)
{}
hb_mask_allocator_t
(
void
)
:
feature_count
(
0
)
{}
...
@@ -160,10 +142,8 @@ struct hb_mask_allocator_t {
...
@@ -160,10 +142,8 @@ struct hb_mask_allocator_t {
}
}
/* Sort the features so we can bsearch later */
/* Sort features and merge duplicates */
qsort
(
feature_infos
,
feature_count
,
sizeof
(
feature_infos
[
0
]),
feature_info_t
::
cmp
);
qsort
(
feature_infos
,
feature_count
,
sizeof
(
feature_infos
[
0
]),
(
hb_compare_func_t
)
feature_info_t
::
cmp
);
/* Remove dups, let later-occurring features override earlier ones. */
unsigned
int
j
=
0
;
unsigned
int
j
=
0
;
for
(
unsigned
int
i
=
1
;
i
<
feature_count
;
i
++
)
for
(
unsigned
int
i
=
1
;
i
<
feature_count
;
i
++
)
if
(
feature_infos
[
i
].
tag
!=
feature_infos
[
j
].
tag
)
if
(
feature_infos
[
i
].
tag
!=
feature_infos
[
j
].
tag
)
...
@@ -248,9 +228,7 @@ struct hb_mask_allocator_t {
...
@@ -248,9 +228,7 @@ struct hb_mask_allocator_t {
add_lookups
(
c
,
table_index
,
feature_maps
[
i
].
index
[
table_index
],
feature_maps
[
i
].
mask
);
add_lookups
(
c
,
table_index
,
feature_maps
[
i
].
index
[
table_index
],
feature_maps
[
i
].
mask
);
/* Sort lookups and merge duplicates */
/* 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
);
qsort
(
lookup_maps
[
table_index
],
lookup_count
[
table_index
],
sizeof
(
lookup_maps
[
table_index
][
0
]),
lookup_map_t
::
cmp
);
if
(
lookup_count
[
table_index
])
if
(
lookup_count
[
table_index
])
{
{
unsigned
int
j
=
0
;
unsigned
int
j
=
0
;
...
@@ -268,22 +246,17 @@ struct hb_mask_allocator_t {
...
@@ -268,22 +246,17 @@ struct hb_mask_allocator_t {
hb_mask_t
get_global_mask
(
void
)
{
return
global_mask
;
}
hb_mask_t
get_global_mask
(
void
)
{
return
global_mask
;
}
hb_mask_t
get_mask
(
hb_tag_t
tag
,
unsigned
int
*
shift
)
const
{
hb_mask_t
get_mask
(
hb_tag_t
tag
,
unsigned
int
*
shift
)
const
{
const
feature_map_t
*
map
=
(
const
feature_map_t
*
)
bsearch
(
&
tag
,
feature_maps
,
feature_count
,
sizeof
(
feature_maps
[
0
]),
feature_map_t
::
cmp
);
const
feature_map_t
*
map
=
(
const
feature_map_t
*
)
bsearch
(
&
tag
,
feature_maps
,
feature_count
,
sizeof
(
feature_maps
[
0
]),
(
hb_compare_func_t
)
feature_map_t
::
cmp
);
if
(
likely
(
map
))
{
if
(
shift
)
*
shift
=
map
?
map
->
shift
:
0
;
if
(
shift
)
*
shift
=
map
->
shift
;
return
map
?
map
->
mask
:
0
;
return
map
->
mask
;
}
else
{
if
(
shift
)
*
shift
=
0
;
return
0
;
}
}
}
void
substitute
(
hb_ot_shape_context_t
*
c
)
const
{
inline
void
substitute
(
hb_ot_shape_context_t
*
c
)
const
{
for
(
unsigned
int
i
=
0
;
i
<
lookup_count
[
0
];
i
++
)
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
(
c
->
face
,
c
->
buffer
,
lookup_maps
[
0
][
i
].
index
,
lookup_maps
[
0
][
i
].
mask
);
}
}
void
position
(
hb_ot_shape_context_t
*
c
)
const
{
inline
void
position
(
hb_ot_shape_context_t
*
c
)
const
{
for
(
unsigned
int
i
=
0
;
i
<
lookup_count
[
1
];
i
++
)
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
(
c
->
font
,
c
->
face
,
c
->
buffer
,
lookup_maps
[
1
][
i
].
index
,
lookup_maps
[
1
][
i
].
mask
);
}
}
...
...
src/hb-ot-tag.c
浏览文件 @
8f08c327
...
@@ -591,10 +591,9 @@ static const LangTag ot_languages[] = {
...
@@ -591,10 +591,9 @@ static const LangTag ot_languages[] = {
};
};
static
int
static
int
lang_compare_first_component
(
const
void
*
p
a
,
lang_compare_first_component
(
const
char
*
a
,
const
void
*
p
b
)
const
char
*
b
)
{
{
const
char
*
a
=
pa
,
*
b
=
pb
;
unsigned
int
da
,
db
;
unsigned
int
da
,
db
;
const
char
*
p
;
const
char
*
p
;
...
@@ -645,7 +644,7 @@ hb_ot_tag_from_language (hb_language_t language)
...
@@ -645,7 +644,7 @@ hb_ot_tag_from_language (hb_language_t language)
/* find a language matching in the first component */
/* find a language matching in the first component */
lang_tag
=
bsearch
(
lang_str
,
ot_languages
,
lang_tag
=
bsearch
(
lang_str
,
ot_languages
,
ARRAY_LENGTH
(
ot_languages
),
sizeof
(
LangTag
),
ARRAY_LENGTH
(
ot_languages
),
sizeof
(
LangTag
),
lang_compare_first_component
);
(
hb_compare_func_t
)
lang_compare_first_component
);
/* we now need to find the best language matching */
/* we now need to find the best language matching */
if
(
lang_tag
)
if
(
lang_tag
)
...
@@ -654,12 +653,12 @@ hb_ot_tag_from_language (hb_language_t language)
...
@@ -654,12 +653,12 @@ hb_ot_tag_from_language (hb_language_t language)
/* go to the final one matching in the first component */
/* go to the final one matching in the first component */
while
(
lang_tag
+
1
<
ot_languages
+
ARRAY_LENGTH
(
ot_languages
)
&&
while
(
lang_tag
+
1
<
ot_languages
+
ARRAY_LENGTH
(
ot_languages
)
&&
lang_compare_first_component
(
lang_str
,
lang_tag
+
1
)
==
0
)
lang_compare_first_component
(
lang_str
,
(
lang_tag
+
1
)
->
language
)
==
0
)
lang_tag
++
;
lang_tag
++
;
/* go back, find which one matches completely */
/* go back, find which one matches completely */
while
(
lang_tag
>=
ot_languages
&&
while
(
lang_tag
>=
ot_languages
&&
lang_compare_first_component
(
lang_str
,
lang_tag
)
==
0
)
lang_compare_first_component
(
lang_str
,
lang_tag
->
language
)
==
0
)
{
{
if
(
lang_matches
(
lang_str
,
lang_tag
->
language
))
{
if
(
lang_matches
(
lang_str
,
lang_tag
->
language
))
{
found
=
TRUE
;
found
=
TRUE
;
...
...
src/hb-private.h
浏览文件 @
8f08c327
...
@@ -186,6 +186,10 @@ _hb_ctz (unsigned int number)
...
@@ -186,6 +186,10 @@ _hb_ctz (unsigned int number)
#endif
#endif
}
}
/* Type of bsearch() / qsort() compare function */
typedef
int
(
*
hb_compare_func_t
)
(
const
void
*
,
const
void
*
);
/* We need external help for these */
/* We need external help for these */
#ifdef HAVE_GLIB
#ifdef HAVE_GLIB
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录