Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
1de17bdb
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看板
提交
1de17bdb
编写于
10月 22, 2018
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[colr] Add hb_ot_color_layer_t
We never return parallel arrays from functions. That's inconvenient and hard to bind.
上级
3b3668ac
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
39 addition
and
34 deletion
+39
-34
src/hb-ot-color.cc
src/hb-ot-color.cc
+8
-10
src/hb-ot-color.h
src/hb-ot-color.h
+16
-6
test/api/test-ot-color.c
test/api/test-ot-color.c
+15
-18
未找到文件。
src/hb-ot-color.cc
浏览文件 @
1de17bdb
...
...
@@ -244,25 +244,23 @@ hb_ot_color_has_layers (hb_face_t *face)
}
/**
* hb_ot_color_g
et_color
_layers:
* hb_ot_color_g
lyph_get
_layers:
* @face: a font face.
* @glyph:
* @start_offset:
* @count: (inout) (optional):
* @glyphs: (array length=count) (out) (optional):
* @color_indices: (array length=count) (out) (optional):
* @layers: (array length=count) (out) (optional):
*
* Returns:
*
* Since: REPLACEME
*/
unsigned
int
hb_ot_color_get_color_layers
(
hb_face_t
*
face
,
hb_codepoint_t
glyph
,
unsigned
int
start_offset
,
unsigned
int
*
count
/* IN/OUT. May be NULL. */
,
hb_codepoint_t
*
glyphs
/* OUT. May be NULL. */
,
unsigned
int
*
color_indices
/* OUT. May be NULL. */
)
hb_ot_color_glyph_get_layers
(
hb_face_t
*
face
,
hb_codepoint_t
glyph
,
unsigned
int
start_offset
,
unsigned
int
*
count
,
/* IN/OUT. May be NULL. */
hb_ot_color_layer_t
*
layers
/* OUT. May be NULL. */
)
{
const
OT
::
COLR
&
colr
=
_get_colr
(
face
);
unsigned
int
num_results
=
0
;
...
...
@@ -275,7 +273,7 @@ hb_ot_color_get_color_layers (hb_face_t *face,
for
(
unsigned
int
i
=
0
;
i
<
layer_count
;
i
++
)
{
if
(
colr
.
get_layer_record
(
start_layer_index
+
start_offset
+
i
,
&
glyphs
[
num_results
],
&
color_indices
[
num_results
]
))
&
layers
[
num_results
].
glyph
,
&
layers
[
num_results
].
color_index
))
++
num_results
;
}
}
...
...
src/hb-ot-color.h
浏览文件 @
1de17bdb
...
...
@@ -91,13 +91,23 @@ hb_ot_color_get_palette_flags (hb_face_t *face, unsigned int palette);
HB_EXTERN
hb_bool_t
hb_ot_color_has_layers
(
hb_face_t
*
face
);
/**
* hb_ot_color_layer_t:
*
* Since: REPLACEME
**/
typedef
struct
hb_ot_color_layer_t
{
hb_codepoint_t
glyph
;
unsigned
int
color_index
;
}
hb_ot_color_layer_t
;
HB_EXTERN
unsigned
int
hb_ot_color_get_color_layers
(
hb_face_t
*
face
,
hb_codepoint_t
glyph
,
unsigned
int
start_offset
,
unsigned
int
*
count
,
/* IN/OUT. May be NULL. */
hb_codepoint_t
*
glyphs
,
/* OUT. May be NULL. */
unsigned
int
*
color_indices
/* OUT. May be NULL. */
);
hb_ot_color_glyph_get_layers
(
hb_face_t
*
face
,
hb_codepoint_t
glyph
,
unsigned
int
start_offset
,
unsigned
int
*
count
,
/* IN/OUT. May be NULL. */
hb_ot_color_layer_t
*
layers
/* OUT. May be NULL. */
);
HB_END_DECLS
...
...
test/api/test-ot-color.c
浏览文件 @
1de17bdb
...
...
@@ -317,36 +317,33 @@ test_hb_ot_color_get_palette_entry_name_id (void)
static
void
test_hb_ot_color_g
et_color
_layers
(
void
)
test_hb_ot_color_g
lyph_get
_layers
(
void
)
{
hb_codepoint_t
layer_gids
[
1
];
unsigned
int
color_indices
[
1
];
hb_ot_color_layer_t
layers
[
1
];
unsigned
int
count
=
1
;
g_assert_cmpuint
(
hb_ot_color_g
et_color
_layers
(
cpal_v1
,
0
,
0
,
NULL
,
NULL
,
NULL
),
==
,
0
);
g_assert_cmpuint
(
hb_ot_color_g
et_color
_layers
(
cpal_v1
,
1
,
0
,
NULL
,
NULL
,
NULL
),
==
,
0
);
g_assert_cmpuint
(
hb_ot_color_g
et_color
_layers
(
cpal_v1
,
2
,
0
,
NULL
,
NULL
,
NULL
),
==
,
2
);
g_assert_cmpuint
(
hb_ot_color_g
lyph_get
_layers
(
cpal_v1
,
0
,
0
,
NULL
,
NULL
),
==
,
0
);
g_assert_cmpuint
(
hb_ot_color_g
lyph_get
_layers
(
cpal_v1
,
1
,
0
,
NULL
,
NULL
),
==
,
0
);
g_assert_cmpuint
(
hb_ot_color_g
lyph_get
_layers
(
cpal_v1
,
2
,
0
,
NULL
,
NULL
),
==
,
2
);
unsigned
int
num_layers
;
num_layers
=
hb_ot_color_get_color_layers
(
cpal_v1
,
2
,
0
,
&
count
,
layer_gids
,
color_indices
);
num_layers
=
hb_ot_color_glyph_get_layers
(
cpal_v1
,
2
,
0
,
&
count
,
layers
);
g_assert_cmpuint
(
num_layers
,
==
,
2
);
g_assert_cmpuint
(
count
,
==
,
1
);
g_assert_cmpuint
(
layer
_gids
[
0
]
,
==
,
3
);
g_assert_cmpuint
(
color_indices
[
0
]
,
==
,
1
);
g_assert_cmpuint
(
layer
s
[
0
].
glyph
,
==
,
3
);
g_assert_cmpuint
(
layers
[
0
].
color_index
,
==
,
1
);
count
=
1
;
hb_ot_color_get_color_layers
(
cpal_v1
,
2
,
1
,
&
count
,
layer_gids
,
color_indices
);
hb_ot_color_glyph_get_layers
(
cpal_v1
,
2
,
1
,
&
count
,
layers
);
g_assert_cmpuint
(
num_layers
,
==
,
2
);
g_assert_cmpuint
(
count
,
==
,
1
);
g_assert_cmpuint
(
layer
_gids
[
0
]
,
==
,
4
);
g_assert_cmpuint
(
color_indices
[
0
]
,
==
,
0
);
g_assert_cmpuint
(
layer
s
[
0
].
glyph
,
==
,
4
);
g_assert_cmpuint
(
layers
[
0
].
color_index
,
==
,
0
);
}
static
void
...
...
@@ -394,7 +391,7 @@ main (int argc, char **argv)
hb_test_add
(
test_hb_ot_color_get_palette_colors_v0
);
hb_test_add
(
test_hb_ot_color_get_palette_colors_v1
);
hb_test_add
(
test_hb_ot_color_get_palette_entry_name_id
);
hb_test_add
(
test_hb_ot_color_g
et_color
_layers
);
hb_test_add
(
test_hb_ot_color_g
lyph_get
_layers
);
hb_test_add
(
test_hb_ot_color_has_data
);
status
=
hb_test_run
();
hb_face_destroy
(
cpal_v0
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录