Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
b791bbba
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看板
提交
b791bbba
编写于
11月 01, 2018
作者:
E
Ebrahim Byagowi
提交者:
Behdad Esfahbod
11月 25, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[feat] Apply @jfkthame reviews
上级
95abd537
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
54 addition
and
40 deletion
+54
-40
src/hb-aat-layout-feat-table.hh
src/hb-aat-layout-feat-table.hh
+15
-12
src/hb-aat-layout.cc
src/hb-aat-layout.cc
+12
-11
src/hb-aat-layout.h
src/hb-aat-layout.h
+9
-5
test/api/fonts/aat-feat.ttf
test/api/fonts/aat-feat.ttf
+0
-0
test/api/test-aat-layout.c
test/api/test-aat-layout.c
+18
-12
未找到文件。
src/hb-aat-layout-feat-table.hh
浏览文件 @
b791bbba
...
...
@@ -84,14 +84,13 @@ struct FeatureName
<<<<<<<
HEAD
=======
inline
unsigned
int
get_settings
(
const
feat
*
feat
,
hb_
bool_t
*
is_exclusive
,
hb_
aat_feature_setting_t
*
default_setting
,
unsigned
int
start_offset
,
unsigned
int
*
records_count
,
hb_aat_feature_option_record_t
*
records_buffer
)
const
{
bool
exclusive
=
featureFlags
&
Exclusive
;
bool
not_default
=
featureFlags
&
NotDefault
;
if
(
is_exclusive
)
*
is_exclusive
=
exclusive
;
const
UnsizedArrayOf
<
SettingName
>&
settings
=
feat
+
settingTable
;
unsigned
int
len
=
0
;
unsigned
int
settings_count
=
nSettings
;
...
...
@@ -100,15 +99,19 @@ struct FeatureName
len
=
MIN
(
settings_count
-
start_offset
,
*
records_count
);
for
(
unsigned
int
i
=
0
;
i
<
len
;
i
++
)
{
records_buffer
[
i
].
is_default
=
exclusive
&&
not_default
&&
i
+
start_offset
==
(
featureFlags
&
IndexMask
);
records_buffer
[
i
].
name_id
=
settings
[
start_offset
+
i
].
nameIndex
;
records_buffer
[
i
].
setting
=
settings
[
start_offset
+
i
].
setting
;
}
if
(
exclusive
&&
!
not_default
&&
start_offset
==
0
&&
len
!=
0
)
records_buffer
[
0
].
is_default
=
true
;
}
if
(
is_exclusive
)
*
is_exclusive
=
exclusive
;
if
(
default_setting
)
{
if
(
exclusive
)
{
if
(
settings_count
&&
!
not_default
)
*
default_setting
=
settings
[
0
].
setting
;
else
if
(
not_default
)
*
default_setting
=
featureFlags
&
IndexMask
;
}
else
*
default_setting
=
HB_AAT_FEATURE_NO_DEFAULT_INDEX
;
}
if
(
records_count
)
*
records_count
=
len
;
return
settings_count
;
}
...
...
@@ -151,14 +154,14 @@ struct feat
return
feature
?
*
feature
:
Null
(
FeatureName
);
}
inline
unsigned
int
get_settings
(
hb_aat_feature_type_t
key
,
hb_
bool_t
*
is_exclusive
,
inline
unsigned
int
get_settings
(
hb_aat_feature_type_t
type
,
hb_
aat_feature_setting_t
*
default_setting
,
/* OUT. May be NULL. */
unsigned
int
start_offset
,
unsigned
int
*
records_count
,
unsigned
int
*
records_count
,
/* IN/OUT. May be NULL. */
hb_aat_feature_option_record_t
*
records_buffer
)
const
{
return
get_feature
(
key
).
get_settings
(
this
,
is_exclusive
,
start_offset
,
records_count
,
records_buffer
);
return
get_feature
(
type
).
get_settings
(
this
,
default_setting
,
start_offset
,
records_count
,
records_buffer
);
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
...
...
src/hb-aat-layout.cc
浏览文件 @
b791bbba
...
...
@@ -308,12 +308,13 @@ _hb_aat_language_get (hb_face_t *face,
/**
* hb_aat_get_feature_settings:
* @face: a font face.
* @identifier: aat feature id you are querying.
* @is_exclusive: (out): is only one of the features can be enabled.
* @start_offset: start offset, if you are iterating
* @records_count: (inout): gets input buffer size, puts number of filled one
* @records_buffer: (out): buffer of records
* @face: a font face.
* @identifier: aat feature id you are querying.
* @default_setting: (out): default value for the type. If it is HB_AAT_FEATURE_NO_DEFAULT_INDEX
* means non is default and it is not exclusive also.
* @start_offset: start offset, if you are iterating
* @records_count: (inout): gets input buffer size, puts number of filled one
* @records_buffer: (out): buffer of records
*
* Returns: Total number of records available for the feature.
*
...
...
@@ -322,11 +323,11 @@ _hb_aat_language_get (hb_face_t *face,
unsigned
int
hb_aat_get_feature_settings
(
hb_face_t
*
face
,
hb_aat_feature_type_t
identifier
,
hb_
bool_t
*
is_exclusive
,
hb_
aat_feature_setting_t
*
default_setting
,
/* OUT. May be NULL. */
unsigned
int
start_offset
,
unsigned
int
*
records_count
,
/* IN/OUT. May be NULL. */
hb_aat_feature_option_record_t
*
records_buffer
/* OUT. May be NULL. */
)
unsigned
int
*
records_count
,
/* IN/OUT. May be NULL. */
hb_aat_feature_option_record_t
*
records_buffer
/* OUT. May be NULL. */
)
{
return
_get_feat
(
face
).
get_settings
(
identifier
,
is_exclusive
,
start_offset
,
records_count
,
records_buffer
);
return
_get_feat
(
face
).
get_settings
(
identifier
,
default_setting
,
start_offset
,
records_count
,
records_buffer
);
}
src/hb-aat-layout.h
浏览文件 @
b791bbba
...
...
@@ -57,18 +57,22 @@ typedef uint16_t hb_aat_feature_setting_t;
**/
typedef
struct
hb_aat_feature_option_record_t
{
hb_bool_t
is_default
;
hb_aat_feature_setting_t
setting
;
hb_ot_name_id_t
name_id
;
}
hb_aat_feature_option_record_t
;
/*
* Since: REPLACEME
*/
#define HB_AAT_FEATURE_NO_DEFAULT_INDEX ((hb_aat_feature_setting_t) -1)
HB_EXTERN
unsigned
int
hb_aat_get_feature_settings
(
hb_face_t
*
face
,
hb_aat_feature_type_t
identifier
,
hb_
bool_t
*
is_exclusive
,
hb_aat_feature_type_t
type
,
hb_
aat_feature_setting_t
*
default_setting
,
/* OUT. May be NULL. */
unsigned
int
start_offset
,
unsigned
int
*
records_count
,
/* IN/OUT. May be NULL. */
hb_aat_feature_option_record_t
*
records_buffer
/* OUT. May be NULL. */
);
unsigned
int
*
records_count
,
/* IN/OUT. May be NULL. */
hb_aat_feature_option_record_t
*
records_buffer
/* OUT. May be NULL. */
);
HB_END_DECLS
...
...
test/api/fonts/aat-feat.ttf
0 → 100644
浏览文件 @
b791bbba
文件已添加
test/api/test-aat-layout.c
浏览文件 @
b791bbba
...
...
@@ -31,49 +31,55 @@
static
void
test_aat_get_feature_settings
(
void
)
{
hb_
bool_t
is_exclusive
;
hb_
aat_feature_setting_t
default_setting
;
hb_aat_feature_option_record_t
records
[
3
];
unsigned
int
count
=
3
;
hb_face_t
*
face
=
hb_test_open_font_file
(
"fonts/aat-feat.ttf"
);
g_assert_cmpuint
(
4
,
==
,
hb_aat_get_feature_settings
(
face
,
18
,
&
is_exclusive
,
g_assert_cmpuint
(
4
,
==
,
hb_aat_get_feature_settings
(
face
,
18
,
&
default_setting
,
0
,
&
count
,
records
));
g_assert_cmpuint
(
3
,
==
,
count
);
g_assert
(
is_exclusive
);
g_assert
_cmpuint
(
0
,
==
,
default_setting
);
g_assert_cmpuint
(
1
,
==
,
records
[
0
].
is_default
);
g_assert_cmpuint
(
0
,
==
,
records
[
0
].
setting
);
g_assert_cmpuint
(
294
,
==
,
records
[
0
].
name_id
);
g_assert_cmpuint
(
0
,
==
,
records
[
1
].
is_default
);
g_assert_cmpuint
(
1
,
==
,
records
[
1
].
setting
);
g_assert_cmpuint
(
295
,
==
,
records
[
1
].
name_id
);
g_assert_cmpuint
(
0
,
==
,
records
[
2
].
is_default
);
g_assert_cmpuint
(
2
,
==
,
records
[
2
].
setting
);
g_assert_cmpuint
(
296
,
==
,
records
[
2
].
name_id
);
count
=
3
;
g_assert_cmpuint
(
4
,
==
,
hb_aat_get_feature_settings
(
face
,
18
,
&
is_exclusive
,
g_assert_cmpuint
(
4
,
==
,
hb_aat_get_feature_settings
(
face
,
18
,
&
default_setting
,
3
,
&
count
,
records
));
g_assert_cmpuint
(
1
,
==
,
count
);
g_assert
(
is_exclusive
);
g_assert
_cmpuint
(
0
,
==
,
default_setting
);
g_assert_cmpuint
(
0
,
==
,
records
[
0
].
is_default
);
g_assert_cmpuint
(
3
,
==
,
records
[
0
].
setting
);
g_assert_cmpuint
(
297
,
==
,
records
[
0
].
name_id
);
count
=
1
;
g_assert_cmpuint
(
1
,
==
,
hb_aat_get_feature_settings
(
face
,
14
,
&
default_setting
,
0
,
&
count
,
records
));
g_assert_cmpuint
(
1
,
==
,
count
);
g_assert_cmpuint
(
HB_AAT_FEATURE_NO_DEFAULT_INDEX
,
==
,
default_setting
);
g_assert_cmpuint
(
8
,
==
,
records
[
0
].
setting
);
g_assert_cmpuint
(
308
,
==
,
records
[
0
].
name_id
);
count
=
100
;
g_assert_cmpuint
(
0
,
==
,
hb_aat_get_feature_settings
(
face
,
32
,
&
is_exclusive
,
g_assert_cmpuint
(
0
,
==
,
hb_aat_get_feature_settings
(
face
,
32
,
NULL
,
0
,
&
count
,
records
));
g_assert_cmpuint
(
0
,
==
,
count
);
g_assert
(
!
is_exclusive
);
hb_face_destroy
(
face
);
hb_face_t
*
sbix
=
hb_test_open_font_file
(
"fonts/chromacheck-sbix.ttf"
);
g_assert_cmpuint
(
0
,
==
,
hb_aat_get_feature_settings
(
face
,
100
,
&
is_exclusive
,
g_assert_cmpuint
(
0
,
==
,
hb_aat_get_feature_settings
(
sbix
,
100
,
NULL
,
0
,
&
count
,
records
));
hb_face_destroy
(
sbix
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录