Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
632e9af8
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看板
提交
632e9af8
编写于
10月 28, 2018
作者:
E
Ebrahim Byagowi
提交者:
Behdad Esfahbod
10月 28, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[ot-color] Implement PNGHeader and test it, it doesn't work however
上级
38706a07
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
32 addition
and
8 deletion
+32
-8
src/hb-ot-color-sbix-table.hh
src/hb-ot-color-sbix-table.hh
+15
-5
src/hb-ot-font.cc
src/hb-ot-font.cc
+1
-3
test/api/test-ot-color.c
test/api/test-ot-color.c
+16
-0
未找到文件。
src/hb-ot-color-sbix-table.hh
浏览文件 @
632e9af8
...
...
@@ -196,23 +196,33 @@ struct sbix
file_type
,
num_glyphs
);
}
struct
PNGHeader
{
HBUINT8
header
[
9
];
HBUINT32
width
;
HBUINT32
height
;
};
inline
bool
get_png_extents
(
hb_codepoint_t
glyph
,
unsigned
int
x_ppem
,
unsigned
int
y_ppem
,
hb_glyph_extents_t
*
extents
)
const
{
if
(
likely
(
sbix_len
==
0
))
return
hb_blob_get_empty
();
int
x_offset
,
y_offset
;
hb_blob_t
*
blob
=
reference_blob_for_glyph
(
glyph
,
x_ppem
,
y_ppem
,
HB_TAG
(
'
P'
,
'N'
,
'G
'
,
' '
),
HB_TAG
(
'
p'
,
'n'
,
'g
'
,
' '
),
&
x_offset
,
&
y_offset
);
if
(
hb_blob_get_length
(
blob
)
==
0
)
if
(
hb_blob_get_length
(
blob
)
<
sizeof
(
PNGHeader
)
)
return
false
;
extents
->
x_bearing
=
x_offset
;
extents
->
y_bearing
=
y_offset
;
/* XXX: Help me please! */
extents
->
width
=
0
;
extents
->
height
=
0
;
const
PNGHeader
&
header
=
*
blob
->
as
<
PNGHeader
>
();
extents
->
width
=
header
.
width
+
10
0
;
extents
->
height
=
header
.
height
;
hb_blob_destroy
(
blob
);
return
true
;
...
...
src/hb-ot-font.cc
浏览文件 @
632e9af8
...
...
@@ -183,9 +183,7 @@ hb_ot_get_glyph_extents (hb_font_t *font,
void
*
user_data
HB_UNUSED
)
{
const
hb_ot_face_data_t
*
ot_face
=
(
const
hb_ot_face_data_t
*
)
font_data
;
bool
ret
=
false
;
if
(
ot_face
->
sbix
->
has_data
())
ret
=
ot_face
->
sbix
->
get_png_extents
(
glyph
,
font
->
x_ppem
,
font
->
y_ppem
,
extents
);
bool
ret
=
ot_face
->
sbix
->
get_png_extents
(
glyph
,
font
->
x_ppem
,
font
->
y_ppem
,
extents
);
if
(
!
ret
)
ret
=
ot_face
->
glyf
->
get_extents
(
glyph
,
extents
);
if
(
!
ret
)
...
...
test/api/test-ot-color.c
浏览文件 @
632e9af8
...
...
@@ -407,17 +407,28 @@ test_hb_ot_color_png (void)
hb_blob_t
*
blob
;
unsigned
int
length
;
const
char
*
data
;
hb_glyph_extents_t
extents
;
/* sbix */
hb_font_t
*
sbix_font
;
sbix_font
=
hb_font_create
(
sbix
);
blob
=
hb_ot_color_glyph_reference_png
(
sbix_font
,
0
);
hb_font_get_glyph_extents
(
sbix_font
,
0
,
&
extents
);
g_assert_cmpint
(
extents
.
x_bearing
,
==
,
0
);
g_assert_cmpint
(
extents
.
y_bearing
,
==
,
0
);
g_assert_cmpint
(
extents
.
width
,
==
,
0
);
g_assert_cmpint
(
extents
.
height
,
==
,
0
);
g_assert
(
hb_blob_get_length
(
blob
)
==
0
);
blob
=
hb_ot_color_glyph_reference_png
(
sbix_font
,
1
);
data
=
hb_blob_get_data
(
blob
,
&
length
);
g_assert_cmpuint
(
length
,
==
,
224
);
g_assert
(
strncmp
(
data
+
1
,
"PNG"
,
3
)
==
0
);
hb_font_get_glyph_extents
(
sbix_font
,
1
,
&
extents
);
g_assert_cmpint
(
extents
.
x_bearing
,
==
,
0
);
g_assert_cmpint
(
extents
.
y_bearing
,
==
,
0
);
g_assert_cmpint
(
extents
.
width
,
==
,
3501
);
g_assert_cmpint
(
extents
.
height
,
==
,
20992
);
hb_blob_destroy
(
blob
);
hb_font_destroy
(
sbix_font
);
...
...
@@ -431,6 +442,11 @@ test_hb_ot_color_png (void)
data
=
hb_blob_get_data
(
blob
,
&
length
);
g_assert_cmpuint
(
length
,
==
,
88
);
g_assert
(
strncmp
(
data
+
1
,
"PNG"
,
3
)
==
0
);
hb_font_get_glyph_extents
(
cbdt_font
,
1
,
&
extents
);
g_assert_cmpint
(
extents
.
x_bearing
,
==
,
0
);
g_assert_cmpint
(
extents
.
y_bearing
,
==
,
1024
);
g_assert_cmpint
(
extents
.
width
,
==
,
1024
);
g_assert_cmpint
(
extents
.
height
,
==
,
-
1024
);
hb_blob_destroy
(
blob
);
hb_font_destroy
(
cbdt_font
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录