Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
7a0471aa
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看板
提交
7a0471aa
编写于
11月 01, 2018
作者:
E
Ebrahim Byagowi
提交者:
Behdad Esfahbod
11月 25, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[feat] Turn AAT feature id into enum
上级
b233fa4b
变更
9
展开全部
隐藏空白更改
内联
并排
Showing
9 changed file
with
150 addition
and
135 deletion
+150
-135
src/hb-aat-layout-feat-table.hh
src/hb-aat-layout-feat-table.hh
+10
-10
src/hb-aat-layout-morx-table.hh
src/hb-aat-layout-morx-table.hh
+5
-5
src/hb-aat-layout.cc
src/hb-aat-layout.cc
+85
-85
src/hb-aat-layout.hh
src/hb-aat-layout.hh
+3
-3
src/hb-aat-map.cc
src/hb-aat-map.cc
+1
-1
src/hb-aat-map.hh
src/hb-aat-map.hh
+2
-2
src/hb-aat.h
src/hb-aat.h
+38
-26
test/api/test-aat-layout.c
test/api/test-aat-layout.c
+5
-3
test/api/test-c.c
test/api/test-c.c
+1
-0
未找到文件。
src/hb-aat-layout-feat-table.hh
浏览文件 @
7a0471aa
...
...
@@ -60,7 +60,7 @@ struct FeatureName
=======
static
int
cmp
(
const
void
*
key_
,
const
void
*
entry_
)
{
hb_aat_
feature_type_t
key
=
*
(
hb_aa
t_feature_type_t
*
)
key_
;
hb_aat_
layout_feature_type_t
key
=
*
(
hb_aat_layou
t_feature_type_t
*
)
key_
;
const
FeatureName
*
entry
=
(
const
FeatureName
*
)
entry_
;
return
key
<
entry
->
feature
?
-
1
:
key
>
entry
->
feature
?
1
:
...
...
@@ -85,10 +85,10 @@ struct FeatureName
<<<<<<<
HEAD
=======
inline
unsigned
int
get_settings
(
const
feat
*
feat
,
hb_aat_feature_setting_t
*
default_setting
,
hb_aat_
layout_
feature_setting_t
*
default_setting
,
unsigned
int
start_offset
,
unsigned
int
*
selectors_count
,
hb_aat_feature_type_selector_t
*
selectors_buffer
)
const
hb_aat_
layout_
feature_type_selector_t
*
selectors_buffer
)
const
{
bool
exclusive
=
featureFlags
&
Exclusive
;
bool
not_default
=
featureFlags
&
NotDefault
;
...
...
@@ -109,7 +109,7 @@ struct FeatureName
unsigned
int
index
=
not_default
?
featureFlags
&
IndexMask
:
0
;
if
(
exclusive
&&
index
<
settings_count
)
*
default_setting
=
settings
[
index
].
setting
;
else
*
default_setting
=
HB_AAT_
FEATURE_NO_DEFAULT_SETTING
;
else
*
default_setting
=
HB_AAT_
LAYOUT_FEATURE_TYPE_UNDEFINED
;
}
if
(
selectors_count
)
*
selectors_count
=
len
;
return
settings_count
;
...
...
@@ -143,7 +143,7 @@ struct feat
{
static
const
hb_tag_t
tableTag
=
HB_AAT_TAG_feat
;
inline
const
FeatureName
&
get_feature
(
hb_aat_feature_type_t
key
)
const
inline
const
FeatureName
&
get_feature
(
hb_aat_
layout_
feature_type_t
key
)
const
{
const
FeatureName
*
feature
=
(
FeatureName
*
)
hb_bsearch
(
&
key
,
&
names
,
FeatureName
::
static_size
,
...
...
@@ -153,11 +153,11 @@ struct feat
return
feature
?
*
feature
:
Null
(
FeatureName
);
}
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
*
selectors_count
,
/* IN/OUT. May be NULL. */
hb_aat_feature_type_selector_t
*
selectors_buffer
/* OUT. May be NULL. */
)
const
inline
unsigned
int
get_settings
(
hb_aat_
layout_
feature_type_t
type
,
hb_aat_
layout_
feature_setting_t
*
default_setting
,
/* OUT. May be NULL. */
unsigned
int
start_offset
,
unsigned
int
*
selectors_count
,
/* IN/OUT. May be NULL. */
hb_aat_
layout_
feature_type_selector_t
*
selectors_buffer
/* OUT. May be NULL. */
)
const
{
return
get_feature
(
type
).
get_settings
(
this
,
default_setting
,
start_offset
,
selectors_count
,
selectors_buffer
);
...
...
src/hb-aat-layout-morx-table.hh
浏览文件 @
7a0471aa
...
...
@@ -958,19 +958,19 @@ struct Chain
for
(
unsigned
i
=
0
;
i
<
count
;
i
++
)
{
const
Feature
&
feature
=
featureZ
[
i
];
hb_aat_
feature_type_t
type
=
feature
.
featureType
;
hb_aat_feature_setting_t
setting
=
feature
.
featureSetting
;
hb_aat_
layout_feature_type_t
type
=
(
hb_aat_layout_feature_type_t
)
(
unsigned
int
)
feature
.
featureType
;
hb_aat_
layout_
feature_setting_t
setting
=
feature
.
featureSetting
;
retry:
const
hb_aat_map_builder_t
::
feature_info_t
*
info
=
map
->
features
.
bsearch
(
type
);
const
hb_aat_map_builder_t
::
feature_info_t
*
info
=
map
->
features
.
bsearch
(
(
uint16_t
)
type
);
if
(
info
&&
info
->
setting
==
setting
)
{
flags
&=
feature
.
disableFlags
;
flags
|=
feature
.
enableFlags
;
}
else
if
(
type
==
3
/*kLetterCaseType*/
&&
setting
==
3
/*kSmallCapsSelector*/
)
else
if
(
type
==
HB_AAT_LAYOUT_FEATURE_TYPE_LETTER_CASE
&&
setting
==
3
/*kSmallCapsSelector*/
)
{
/* Deprecated. https://github.com/harfbuzz/harfbuzz/issues/1342 */
type
=
37
/*kLowerCaseType*/
;
type
=
HB_AAT_LAYOUT_FEATURE_TYPE_LOWER_CASE
;
setting
=
1
/*kLowerCaseSmallCapsSelector*/
;
goto
retry
;
}
...
...
src/hb-aat-layout.cc
浏览文件 @
7a0471aa
此差异已折叠。
点击以展开。
src/hb-aat-layout.hh
浏览文件 @
7a0471aa
...
...
@@ -36,9 +36,9 @@
struct
hb_aat_feature_mapping_t
{
hb_tag_t
otFeatureTag
;
hb_aat_feature_type_t
aatFeatureType
;
hb_aat_feature_setting_t
selectorToEnable
;
hb_aat_feature_setting_t
selectorToDisable
;
hb_aat_
layout_
feature_type_t
aatFeatureType
;
hb_aat_
layout_
feature_setting_t
selectorToEnable
;
hb_aat_
layout_
feature_setting_t
selectorToDisable
;
static
inline
int
cmp
(
const
void
*
key_
,
const
void
*
entry_
)
{
...
...
src/hb-aat-map.cc
浏览文件 @
7a0471aa
...
...
@@ -37,7 +37,7 @@ void hb_aat_map_builder_t::add_feature (hb_tag_t tag,
if
(
tag
==
HB_TAG
(
'a'
,
'a'
,
'l'
,
't'
))
{
feature_info_t
*
info
=
features
.
push
();
info
->
type
=
17
/*kCharacterAlternativesType*/
;
info
->
type
=
HB_AAT_LAYOUT_FEATURE_TYPE_CHARACTER_ALTERNATIVES
;
info
->
setting
=
value
;
return
;
}
...
...
src/hb-aat-map.hh
浏览文件 @
7a0471aa
...
...
@@ -66,8 +66,8 @@ struct hb_aat_map_builder_t
public:
struct
feature_info_t
{
hb_aat_feature_type_t
type
;
hb_aat_feature_setting_t
setting
;
hb_aat_
layout_
feature_type_t
type
;
hb_aat_
layout_
feature_setting_t
setting
;
unsigned
seq
;
/* For stable sorting only. */
static
int
cmp
(
const
void
*
pa
,
const
void
*
pb
)
...
...
src/hb-aat.h
浏览文件 @
7a0471aa
...
...
@@ -22,10 +22,6 @@
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*/
#ifndef HB_OT_H_IN
#error "Include <hb-ot.h> instead."
#endif
#ifndef HB_AAT_H
#define HB_AAT_H
...
...
@@ -34,14 +30,35 @@
HB_BEGIN_DECLS
/**
* hb_aat_type_t:
*
* Feature identifier
*
/*
* Since: REPLACEME
*/
typedef
uint16_t
hb_aat_feature_type_t
;
typedef
enum
{
HB_AAT_LAYOUT_FEATURE_TYPE_LIGATURES
=
1
,
HB_AAT_LAYOUT_FEATURE_TYPE_LETTER_CASE
=
3
,
HB_AAT_LAYOUT_FEATURE_TYPE_VERTICAL_SUBSTITUTION
=
4
,
HB_AAT_LAYOUT_FEATURE_TYPE_NUMBER_SPACING
=
6
,
HB_AAT_LAYOUT_FEATURE_TYPE_VERTICAL_POSITION
=
10
,
HB_AAT_LAYOUT_FEATURE_TYPE_FRACTIONS
=
11
,
HB_AAT_LAYOUT_FEATURE_TYPE_TYPOGRAPHIC_EXTRAS
=
14
,
HB_AAT_LAYOUT_FEATURE_TYPE_CHARACTER_ALTERNATIVES
=
17
,
HB_AAT_LAYOUT_FEATURE_TYPE_MATHEMATICAL_EXTRAS
=
15
,
HB_AAT_LAYOUT_FEATURE_TYPE_STYLE_OPTIONS
=
19
,
HB_AAT_LAYOUT_FEATURE_TYPE_CHARACTER_SHAPE
=
20
,
HB_AAT_LAYOUT_FEATURE_TYPE_NUMBER_CASE
=
21
,
HB_AAT_LAYOUT_FEATURE_TYPE_TEXT_SPACING
=
22
,
HB_AAT_LAYOUT_FEATURE_TYPE_TRANSLITERATION
=
23
,
HB_AAT_LAYOUT_FEATURE_TYPE_RUBYKANA
=
28
,
HB_AAT_LAYOUT_FEATURE_TYPE_ITALIC_CJK_ROMAN
=
32
,
HB_AAT_LAYOUT_FEATURE_TYPE_CASE_SENSITIVE_LAYOUT
=
33
,
HB_AAT_LAYOUT_FEATURE_TYPE_ALTERNATE_KANA
=
34
,
HB_AAT_LAYOUT_FEATURE_TYPE_STYLISTIC_ALTERNATIVES
=
35
,
HB_AAT_LAYOUT_FEATURE_TYPE_CONTEXTUAL_ALTERNATIVES
=
36
,
HB_AAT_LAYOUT_FEATURE_TYPE_LOWER_CASE
=
37
,
HB_AAT_LAYOUT_FEATURE_TYPE_UPPER_CASE
=
38
,
HB_AAT_LAYOUT_FEATURE_TYPE_UNDEFINED
=
0xFFFF
}
hb_aat_layout_feature_type_t
;
/**
* hb_aat_feature_t:
...
...
@@ -50,33 +67,28 @@ typedef uint16_t hb_aat_feature_type_t;
*
* Since: REPLACEME
*/
typedef
u
int16_t
hb_aa
t_feature_setting_t
;
typedef
u
nsigned
int
hb_aat_layou
t_feature_setting_t
;
/**
* hb_aat_feature_type_selector_t:
* hb_aat_
layout_
feature_type_selector_t:
*
* Feature type record
*
* Since: REPLACEME
**/
typedef
struct
hb_aat_feature_type_selector_t
typedef
struct
hb_aat_
layout_
feature_type_selector_t
{
hb_aat_feature_setting_t
setting
;
hb_aat_
layout_
feature_setting_t
setting
;
hb_ot_name_id_t
name_id
;
}
hb_aat_feature_type_selector_t
;
/*
* Since: REPLACEME
*/
#define HB_AAT_FEATURE_NO_DEFAULT_SETTING ((hb_aat_feature_setting_t) -1)
}
hb_aat_layout_feature_type_selector_t
;
HB_EXTERN
unsigned
int
hb_aat_layout_get_feature_settings
(
hb_face_t
*
face
,
hb_aat_feature_type_t
type
,
hb_aat_feature_setting_t
*
default_setting
,
/* OUT. May be NULL. */
unsigned
int
start_offset
,
unsigned
int
*
selectors_count
,
/* IN/OUT. May be NULL. */
hb_aat_feature_type_selector_t
*
selectors_buffer
/* OUT. May be NULL. */
);
hb_aat_layout_get_feature_settings
(
hb_face_t
*
face
,
hb_aat_
layout_
feature_type_t
type
,
hb_aat_
layout_
feature_setting_t
*
default_setting
,
/* OUT. May be NULL. */
unsigned
int
start_offset
,
unsigned
int
*
selectors_count
,
/* IN/OUT. May be NULL. */
hb_aat_
layout_
feature_type_selector_t
*
selectors_buffer
/* OUT. May be NULL. */
);
HB_END_DECLS
...
...
test/api/test-aat-layout.c
浏览文件 @
7a0471aa
...
...
@@ -24,15 +24,17 @@
#include "hb-test.h"
#include <hb.h>
#include <hb-ot.h>
#include <hb-aat.h>
/* Unit tests for hb-aat.h */
static
void
test_aat_get_feature_settings
(
void
)
{
hb_aat_feature_setting_t
default_setting
;
hb_aat_feature_type_selector_t
records
[
3
];
hb_aat_
layout_
feature_setting_t
default_setting
;
hb_aat_
layout_
feature_type_selector_t
records
[
3
];
unsigned
int
count
=
3
;
hb_face_t
*
face
=
hb_test_open_font_file
(
"fonts/aat-feat.ttf"
);
...
...
@@ -65,7 +67,7 @@ test_aat_get_feature_settings (void)
g_assert_cmpuint
(
1
,
==
,
hb_aat_layout_get_feature_settings
(
face
,
14
,
&
default_setting
,
0
,
&
count
,
records
));
g_assert_cmpuint
(
1
,
==
,
count
);
g_assert_cmpuint
(
HB_AAT_
FEATURE_NO_DEFAULT_SETTING
,
==
,
default_setting
);
g_assert_cmpuint
(
HB_AAT_
LAYOUT_FEATURE_TYPE_UNDEFINED
,
==
,
default_setting
);
g_assert_cmpuint
(
8
,
==
,
records
[
0
].
setting
);
g_assert_cmpuint
(
308
,
==
,
records
[
0
].
name_id
);
...
...
test/api/test-c.c
浏览文件 @
7a0471aa
...
...
@@ -33,6 +33,7 @@
#include <hb.h>
#include <hb-ot.h>
#include <hb-aat.h>
#ifdef HAVE_GLIB
#include <hb-glib.h>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录