Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
4ceabb8c
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看板
提交
4ceabb8c
编写于
10月 25, 2018
作者:
E
Ebrahim Byagowi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[svg] Hide start_glyph and end_glyph from API
上级
c7a4e3df
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
25 addition
and
63 deletion
+25
-63
src/dump-emoji.cc
src/dump-emoji.cc
+8
-13
src/hb-ot-color-svg-table.hh
src/hb-ot-color-svg-table.hh
+12
-30
src/hb-ot-color.cc
src/hb-ot-color.cc
+2
-7
src/hb-ot-color.h
src/hb-ot-color.h
+1
-4
test/api/test-ot-color.c
test/api/test-ot-color.c
+2
-9
未找到文件。
src/dump-emoji.cc
浏览文件 @
4ceabb8c
...
...
@@ -75,29 +75,24 @@ svg_dump (hb_face_t *face)
for
(
unsigned
int
glyph_id
=
0
;
glyph_id
<
glyph_count
;
glyph_id
++
)
{
hb_codepoint_t
start_glyph_id
,
end_glyph_id
;
hb_blob_t
*
blob
=
hb_ot_color_glyph_svg_create_blob
(
face
,
glyph_id
,
&
start_glyph_id
,
&
end_glyph_id
);
hb_blob_t
*
blob
=
hb_ot_color_glyph_svg_create_blob
(
face
,
glyph_id
);
if
(
hb_blob_get_length
(
blob
)
==
0
)
continue
;
char
output_path
[
255
];
if
(
start_glyph_id
==
end_glyph_id
)
sprintf
(
output_path
,
"out/svg-%d.svg"
,
start_glyph_id
);
else
sprintf
(
output_path
,
"out/svg-%d-%d.svg"
,
start_glyph_id
,
end_glyph_id
);
unsigned
int
length
;
const
char
*
data
=
hb_blob_get_data
(
blob
,
&
length
);
// append "z" if the content is gzipped, https://stackoverflow.com/a/6059405
if
(
length
>
2
&&
(
data
[
0
]
==
'\x1F'
)
&&
(
data
[
1
]
==
'\x8B'
))
strcat
(
output_path
,
"z"
);
char
output_path
[
256
];
sprintf
(
output_path
,
"out/svg-%d.svg%s"
,
glyph_id
,
// append "z" if the content is gzipped, https://stackoverflow.com/a/6059405
(
length
>
2
&&
(
data
[
0
]
==
'\x1F'
)
&&
(
data
[
1
]
==
'\x8B'
))
?
"z"
:
""
);
FILE
*
f
=
fopen
(
output_path
,
"wb"
);
fwrite
(
data
,
1
,
length
,
f
);
fclose
(
f
);
if
(
glyph_id
<
end_glyph_id
)
glyph_id
=
end_glyph_id
;
hb_blob_destroy
(
blob
)
;
}
}
...
...
src/hb-ot-color-svg-table.hh
浏览文件 @
4ceabb8c
...
...
@@ -40,9 +40,6 @@ namespace OT {
struct
SVGDocumentIndexEntry
{
friend
struct
SVG
;
friend
struct
SVGDocumentIndex
;
inline
int
cmp
(
hb_codepoint_t
g
)
const
{
return
g
<
startGlyphID
?
-
1
:
g
>
endGlyphID
?
1
:
0
;
}
...
...
@@ -53,6 +50,13 @@ struct SVGDocumentIndexEntry
return
b
->
cmp
(
*
a
);
}
inline
hb_blob_t
*
create_blob
(
hb_blob_t
*
svg_blob
,
unsigned
int
index_offset
)
const
{
if
(
svgDocLength
==
0
)
return
hb_blob_get_empty
();
return
hb_blob_create_sub_blob
(
svg_blob
,
(
unsigned
int
)
svgDoc
+
index_offset
,
svgDocLength
);
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
...
...
@@ -85,7 +89,7 @@ struct SVGDocumentIndex
entries
.
len
,
sizeof
(
SVGDocumentIndexEntry
),
SVGDocumentIndexEntry
::
cmp
);
return
likely
(
rec
&&
glyph_id
<=
rec
->
endGlyphID
)
?
*
rec
:
Null
(
SVGDocumentIndexEntry
);
return
likely
(
rec
)
?
*
rec
:
Null
(
SVGDocumentIndexEntry
);
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
...
...
@@ -120,34 +124,12 @@ struct SVG
hb_blob_destroy
(
svg_blob
);
}
inline
hb_blob_t
*
failed_create_blob
(
hb_codepoint_t
glyph_id
,
hb_codepoint_t
*
start_glyph_id
,
hb_codepoint_t
*
end_glyph_id
)
const
{
if
(
start_glyph_id
)
*
start_glyph_id
=
0
;
if
(
end_glyph_id
)
*
end_glyph_id
=
0
;
return
hb_blob_get_empty
();
}
inline
hb_blob_t
*
create_blob
(
hb_codepoint_t
glyph_id
,
hb_codepoint_t
*
start_glyph_id
,
hb_codepoint_t
*
end_glyph_id
)
const
inline
hb_blob_t
*
create_blob_for_glyph
(
hb_codepoint_t
glyph_id
)
const
{
if
(
unlikely
(
svg_len
==
0
))
return
failed_create_blob
(
glyph_id
,
start_glyph_id
,
end_glyph_id
);
const
SVGDocumentIndex
&
index
=
svg
+
svg
->
svgDocIndex
;
const
SVGDocumentIndexEntry
&
entry
=
index
.
get_glyph_entry
(
glyph_id
);
if
(
unlikely
(
entry
.
svgDocLength
==
0
))
return
failed_create_blob
(
glyph_id
,
start_glyph_id
,
end_glyph_id
);
unsigned
int
blob_offset
=
entry
.
svgDoc
;
blob_offset
+=
svg
->
svgDocIndex
;
if
(
unlikely
(
blob_offset
>
svg_len
||
blob_offset
+
entry
.
svgDocLength
>
svg_len
))
return
failed_create_blob
(
glyph_id
,
start_glyph_id
,
end_glyph_id
);
if
(
start_glyph_id
)
*
start_glyph_id
=
entry
.
startGlyphID
;
if
(
end_glyph_id
)
*
end_glyph_id
=
entry
.
endGlyphID
;
return
hb_blob_create_sub_blob
(
svg_blob
,
blob_offset
,
entry
.
svgDocLength
);
return
hb_blob_get_empty
();
return
(
svg
+
svg
->
svgDocIndex
).
get_glyph_entry
(
glyph_id
).
create_blob
(
svg_blob
,
svg
->
svgDocIndex
);
}
inline
bool
has_data
()
const
...
...
src/hb-ot-color.cc
浏览文件 @
4ceabb8c
...
...
@@ -262,18 +262,13 @@ hb_ot_color_has_svg (hb_face_t *face)
* hb_ot_color_glyph_svg_create_blob:
* @face:
* @glyph:
* @start_glyph: (out) (optional): Start of range this SVG supports
* @end_glyph: (out) (optional): End of range this SVG supports
*
* Returns:
*
* Since: REPLACEME
*/
hb_blob_t
*
hb_ot_color_glyph_svg_create_blob
(
hb_face_t
*
face
,
hb_codepoint_t
glyph
,
hb_codepoint_t
*
start_glyph
,
/* OUT. May be NULL. */
hb_codepoint_t
*
end_glyph
/* OUT. May be NULL. */
)
hb_ot_color_glyph_svg_create_blob
(
hb_face_t
*
face
,
hb_codepoint_t
glyph
)
{
return
_get_svg
(
face
).
create_blob
(
glyph
,
start_glyph
,
end_
glyph
);
return
_get_svg
(
face
).
create_blob
_for_glyph
(
glyph
);
}
src/hb-ot-color.h
浏览文件 @
4ceabb8c
...
...
@@ -119,10 +119,7 @@ HB_EXTERN hb_bool_t
hb_ot_color_has_svg
(
hb_face_t
*
face
);
HB_EXTERN
hb_blob_t
*
hb_ot_color_glyph_svg_create_blob
(
hb_face_t
*
face
,
hb_codepoint_t
glyph
,
hb_codepoint_t
*
start_glyph
,
/* OUT. May be NULL. */
hb_codepoint_t
*
end_glyph
/* OUT. May be NULL. */
);
hb_ot_color_glyph_svg_create_blob
(
hb_face_t
*
face
,
hb_codepoint_t
glyph
);
HB_END_DECLS
...
...
test/api/test-ot-color.c
浏览文件 @
4ceabb8c
...
...
@@ -375,28 +375,21 @@ test_hb_ot_color_has_data (void)
static
void
test_hb_ot_color_svg
(
void
)
{
hb_codepoint_t
start_glyph
,
end_glyph
;
hb_blob_t
*
blob
;
blob
=
hb_ot_color_glyph_svg_create_blob
(
svg
,
0
,
&
start_glyph
,
&
end_glyph
);
blob
=
hb_ot_color_glyph_svg_create_blob
(
svg
,
0
);
g_assert
(
hb_blob_get_length
(
blob
)
==
0
);
g_assert
(
start_glyph
==
0
);
g_assert
(
end_glyph
==
0
);
blob
=
hb_ot_color_glyph_svg_create_blob
(
svg
,
1
,
&
start_glyph
,
&
end_glyph
);
blob
=
hb_ot_color_glyph_svg_create_blob
(
svg
,
1
);
unsigned
int
length
;
const
char
*
data
=
hb_blob_get_data
(
blob
,
&
length
);
g_assert_cmpuint
(
length
,
==
,
146
);
g_assert_cmpuint
(
start_glyph
,
==
,
1
);
g_assert_cmpuint
(
end_glyph
,
==
,
1
);
g_assert
(
strncmp
(
data
,
"<?xml"
,
4
)
==
0
);
g_assert
(
strncmp
(
data
+
140
,
"</svg>"
,
5
)
==
0
);
hb_blob_destroy
(
blob
);
blob
=
hb_ot_color_glyph_svg_create_blob
(
empty
,
0
,
&
start_glyph
,
&
end_glyph
);
g_assert
(
hb_blob_get_length
(
blob
)
==
0
);
g_assert
(
start_glyph
==
0
);
g_assert
(
end_glyph
==
0
);
}
int
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录