Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
d77a098b
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看板
提交
d77a098b
编写于
11月 24, 2018
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[arrays] Improve bfind() interface
Much more useful now. :)
上级
1204a247
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
43 addition
and
29 deletion
+43
-29
src/hb-dsalgs.hh
src/hb-dsalgs.hh
+25
-4
src/hb-open-file.hh
src/hb-open-file.hh
+1
-8
src/hb-open-type.hh
src/hb-open-type.hh
+8
-4
src/hb-ot-layout-common.hh
src/hb-ot-layout-common.hh
+2
-8
src/hb-set.hh
src/hb-set.hh
+3
-3
src/hb-vector.hh
src/hb-vector.hh
+4
-2
未找到文件。
src/hb-dsalgs.hh
浏览文件 @
d77a098b
...
...
@@ -650,6 +650,13 @@ template <typename T>
inline
hb_array_t
<
T
>
hb_array
(
T
*
array
,
unsigned
int
len
)
{
return
hb_array_t
<
T
>
(
array
,
len
);
}
enum
hb_bfind_not_found_t
{
HB_BFIND_NOT_FOUND_DONT_STORE
,
HB_BFIND_NOT_FOUND_STORE
,
HB_BFIND_NOT_FOUND_STORE_CLOSEST
,
};
template
<
typename
Type
>
struct
hb_sorted_array_t
:
hb_array_t
<
Type
>
{
...
...
@@ -669,7 +676,9 @@ struct hb_sorted_array_t : hb_array_t<Type>
return
bfind
(
x
,
&
i
)
?
&
this
->
arrayZ
[
i
]
:
not_found
;
}
template
<
typename
T
>
inline
bool
bfind
(
const
T
&
x
,
unsigned
int
*
i
=
nullptr
)
const
inline
bool
bfind
(
const
T
&
x
,
unsigned
int
*
i
=
nullptr
,
hb_bfind_not_found_t
not_found
=
HB_BFIND_NOT_FOUND_DONT_STORE
,
unsigned
int
to_store
=
(
unsigned
int
)
-
1
)
const
{
int
min
=
0
,
max
=
(
int
)
this
->
len
-
1
;
const
Type
*
array
=
this
->
arrayZ
;
...
...
@@ -690,9 +699,21 @@ struct hb_sorted_array_t : hb_array_t<Type>
}
if
(
i
)
{
if
(
max
<
0
||
(
max
<
(
int
)
this
->
len
&&
array
[
max
].
cmp
(
x
)
>
0
))
max
++
;
*
i
=
max
;
switch
(
not_found
)
{
case
HB_BFIND_NOT_FOUND_DONT_STORE
:
break
;
case
HB_BFIND_NOT_FOUND_STORE
:
*
i
=
to_store
;
break
;
case
HB_BFIND_NOT_FOUND_STORE_CLOSEST
:
if
(
max
<
0
||
(
max
<
(
int
)
this
->
len
&&
array
[
max
].
cmp
(
x
)
>
0
))
max
++
;
*
i
=
max
;
break
;
}
}
return
false
;
}
...
...
src/hb-open-file.hh
浏览文件 @
d77a098b
...
...
@@ -111,14 +111,7 @@ typedef struct OffsetTable
{
Tag
t
;
t
.
set
(
tag
);
unsigned
int
i
;
if
(
tables
.
bfind
(
t
,
&
i
))
{
if
(
table_index
)
*
table_index
=
i
;
return
true
;
}
if
(
table_index
)
*
table_index
=
(
unsigned
)
Index
::
NOT_FOUND_INDEX
;
return
false
;
return
tables
.
bfind
(
t
,
table_index
,
HB_BFIND_NOT_FOUND_STORE
,
Index
::
NOT_FOUND_INDEX
);
}
inline
const
TableRecord
&
get_table_by_tag
(
hb_tag_t
tag
)
const
{
...
...
src/hb-open-type.hh
浏览文件 @
d77a098b
...
...
@@ -475,8 +475,10 @@ struct SortedUnsizedArrayOf : UnsizedArrayOf<Type>
inline
const
Type
&
bsearch
(
unsigned
int
len
,
const
T
&
x
)
const
{
return
*
as_array
(
len
).
bsearch
(
x
,
&
Null
(
Type
));
}
template
<
typename
T
>
inline
bool
bfind
(
unsigned
int
len
,
const
T
&
x
,
unsigned
int
*
i
=
nullptr
)
const
{
return
as_array
(
len
).
bfind
(
x
,
i
);
}
inline
bool
bfind
(
unsigned
int
len
,
const
T
&
x
,
unsigned
int
*
i
=
nullptr
,
hb_bfind_not_found_t
not_found
=
HB_BFIND_NOT_FOUND_DONT_STORE
,
unsigned
int
to_store
=
(
unsigned
int
)
-
1
)
const
{
return
as_array
(
len
).
bfind
(
x
,
i
,
not_found
,
to_store
);
}
};
...
...
@@ -782,8 +784,10 @@ struct SortedArrayOf : ArrayOf<Type, LenType>
inline
const
Type
&
bsearch
(
const
T
&
x
)
const
{
return
*
as_array
().
bsearch
(
x
,
&
Null
(
Type
));
}
template
<
typename
T
>
inline
bool
bfind
(
const
T
&
x
,
unsigned
int
*
i
=
nullptr
)
const
{
return
as_array
().
bfind
(
x
,
i
);
}
inline
bool
bfind
(
const
T
&
x
,
unsigned
int
*
i
=
nullptr
,
hb_bfind_not_found_t
not_found
=
HB_BFIND_NOT_FOUND_DONT_STORE
,
unsigned
int
to_store
=
(
unsigned
int
)
-
1
)
const
{
return
as_array
().
bfind
(
x
,
i
,
not_found
,
to_store
);
}
};
/*
...
...
src/hb-ot-layout-common.hh
浏览文件 @
d77a098b
...
...
@@ -128,12 +128,7 @@ struct RecordArrayOf : SortedArrayOf<Record<Type> >
}
inline
bool
find_index
(
hb_tag_t
tag
,
unsigned
int
*
index
)
const
{
if
(
!
this
->
bfind
(
tag
,
index
))
{
if
(
index
)
*
index
=
Index
::
NOT_FOUND_INDEX
;
return
false
;
}
return
true
;
return
this
->
bfind
(
tag
,
index
,
HB_BFIND_NOT_FOUND_STORE
,
Index
::
NOT_FOUND_INDEX
);
}
};
...
...
@@ -821,8 +816,7 @@ struct CoverageFormat1
inline
unsigned
int
get_coverage
(
hb_codepoint_t
glyph_id
)
const
{
unsigned
int
i
;
if
(
!
glyphArray
.
bfind
(
glyph_id
,
&
i
))
return
NOT_COVERED
;
glyphArray
.
bfind
(
glyph_id
,
&
i
,
HB_BFIND_NOT_FOUND_STORE
,
NOT_COVERED
);
return
i
;
}
...
...
src/hb-set.hh
浏览文件 @
d77a098b
...
...
@@ -544,7 +544,7 @@ struct hb_set_t
page_map_t
map
=
{
get_major
(
*
codepoint
),
0
};
unsigned
int
i
;
page_map
.
bfind
(
map
,
&
i
);
page_map
.
bfind
(
map
,
&
i
,
HB_BFIND_NOT_FOUND_STORE_CLOSEST
);
if
(
i
<
page_map
.
len
&&
page_map
[
i
].
major
==
map
.
major
)
{
if
(
pages
[
page_map
[
i
].
index
].
next
(
codepoint
))
...
...
@@ -575,7 +575,7 @@ struct hb_set_t
page_map_t
map
=
{
get_major
(
*
codepoint
),
0
};
unsigned
int
i
;
page_map
.
bfind
(
map
,
&
i
);
page_map
.
bfind
(
map
,
&
i
,
HB_BFIND_NOT_FOUND_STORE_CLOSEST
);
if
(
i
<
page_map
.
len
&&
page_map
[
i
].
major
==
map
.
major
)
{
if
(
pages
[
page_map
[
i
].
index
].
previous
(
codepoint
))
...
...
@@ -670,7 +670,7 @@ struct hb_set_t
{
page_map_t
map
=
{
get_major
(
g
),
pages
.
len
};
unsigned
int
i
;
if
(
!
page_map
.
bfind
(
map
,
&
i
))
if
(
!
page_map
.
bfind
(
map
,
&
i
,
HB_BFIND_NOT_FOUND_STORE_CLOSEST
))
{
if
(
!
resize
(
pages
.
len
+
1
))
return
nullptr
;
...
...
src/hb-vector.hh
浏览文件 @
d77a098b
...
...
@@ -239,8 +239,10 @@ struct hb_vector_t
inline
const
Type
*
bsearch
(
const
T
&
x
,
const
Type
*
not_found
=
nullptr
)
const
{
return
as_sorted_array
().
bsearch
(
x
,
not_found
);
}
template
<
typename
T
>
inline
bool
bfind
(
const
T
&
x
,
unsigned
int
*
i
=
nullptr
)
const
{
return
as_sorted_array
().
bfind
(
x
,
i
);
}
inline
bool
bfind
(
const
T
&
x
,
unsigned
int
*
i
=
nullptr
,
hb_bfind_not_found_t
not_found
=
HB_BFIND_NOT_FOUND_DONT_STORE
,
unsigned
int
to_store
=
(
unsigned
int
)
-
1
)
const
{
return
as_sorted_array
().
bfind
(
x
,
i
,
not_found
,
to_store
);
}
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录