Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
9435fb24
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看板
提交
9435fb24
编写于
10月 27, 2018
作者:
E
Ebrahim Byagowi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[ot-color/png] Implement CBDT part
上级
5e2a52f7
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
79 addition
and
25 deletion
+79
-25
src/hb-ot-color-cbdt-table.hh
src/hb-ot-color-cbdt-table.hh
+51
-5
src/hb-ot-color.cc
src/hb-ot-color.cc
+2
-17
src/hb-ot-color.h
src/hb-ot-color.h
+4
-0
test/api/test-ot-color.c
test/api/test-ot-color.c
+22
-3
未找到文件。
src/hb-ot-color-cbdt-table.hh
浏览文件 @
9435fb24
...
...
@@ -504,12 +504,58 @@ struct CBDT
}
}
inline
hb_blob_t
*
reference_blob_for_glyph
(
hb_codepoint_t
glyph_id
HB_UNUSED
,
unsigned
int
requested_x_ppem
HB_UNUSED
,
unsigned
int
requested_y_ppem
HB_UNUSED
,
unsigned
int
*
strike_x_ppem
HB_UNUSED
,
unsigned
int
*
strike_y_ppem
HB_UNUSED
)
const
inline
hb_blob_t
*
reference_blob_for_glyph
(
hb_codepoint_t
glyph_id
,
unsigned
int
requested_x_ppem
,
unsigned
int
requested_y_ppem
,
unsigned
int
*
strike_x_ppem
,
unsigned
int
*
strike_y_ppem
)
const
{
if
(
!
cblc
)
return
hb_blob_get_empty
();
// Not a color bitmap font.
if
(
requested_x_ppem
==
0
)
requested_x_ppem
=
upem
;
if
(
requested_y_ppem
==
0
)
requested_y_ppem
=
upem
;
unsigned
int
x_ppem
=
requested_x_ppem
,
y_ppem
=
requested_y_ppem
;
const
void
*
base
;
const
IndexSubtableRecord
*
subtable_record
=
this
->
cblc
->
find_table
(
glyph_id
,
&
x_ppem
,
&
y_ppem
,
&
base
);
if
(
!
subtable_record
||
!
x_ppem
||
!
y_ppem
)
return
hb_blob_get_empty
();
unsigned
int
image_offset
=
0
,
image_length
=
0
,
image_format
=
0
;
if
(
!
subtable_record
->
get_image_data
(
glyph_id
,
base
,
&
image_offset
,
&
image_length
,
&
image_format
))
return
hb_blob_get_empty
();
switch
(
image_format
)
{
case
17
:
{
if
(
strike_x_ppem
)
*
strike_x_ppem
=
x_ppem
;
if
(
strike_x_ppem
)
*
strike_y_ppem
=
y_ppem
;
const
GlyphBitmapDataFormat17
&
glyphFormat17
=
StructAtOffset
<
GlyphBitmapDataFormat17
>
(
this
->
cbdt
,
image_offset
);
return
hb_blob_create_sub_blob
(
cbdt_blob
,
image_offset
+
GlyphBitmapDataFormat17
::
min_size
,
glyphFormat17
.
data
.
len
);
}
case
18
:
{
if
(
strike_x_ppem
)
*
strike_x_ppem
=
x_ppem
;
if
(
strike_x_ppem
)
*
strike_y_ppem
=
y_ppem
;
const
GlyphBitmapDataFormat18
&
glyphFormat18
=
StructAtOffset
<
GlyphBitmapDataFormat18
>
(
this
->
cbdt
,
image_offset
);
return
hb_blob_create_sub_blob
(
cbdt_blob
,
image_offset
+
GlyphBitmapDataFormat18
::
min_size
,
glyphFormat18
.
data
.
len
);
}
case
19
:
{
if
(
strike_x_ppem
)
*
strike_x_ppem
=
x_ppem
;
if
(
strike_x_ppem
)
*
strike_y_ppem
=
y_ppem
;
const
GlyphBitmapDataFormat19
&
glyphFormat19
=
StructAtOffset
<
GlyphBitmapDataFormat19
>
(
this
->
cbdt
,
image_offset
);
return
hb_blob_create_sub_blob
(
cbdt_blob
,
image_offset
+
GlyphBitmapDataFormat19
::
min_size
,
glyphFormat19
.
data
.
len
);
}
}
return
hb_blob_get_empty
();
}
...
...
src/hb-ot-color.cc
浏览文件 @
9435fb24
...
...
@@ -75,22 +75,6 @@ _get_svg (hb_face_t *face)
return
*
(
hb_ot_face_data
(
face
)
->
SVG
.
get
());
}
#if 0
static inline const OT::CBDT_accelerator_t&
_get_cbdt (hb_face_t *face)
{
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::CBDT_accelerator_t);
return *(hb_ot_face_data (face)->CBDT.get ());
}
static inline const OT::sbix&
_get_sbix (hb_face_t *face)
{
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::sbix);
return *(hb_ot_face_data (face)->sbix.get ());
}
#endif
/*
* CPAL
...
...
@@ -289,7 +273,7 @@ hb_ot_color_glyph_reference_blob_svg (hb_face_t *face, hb_codepoint_t glyph)
/*
* PNG
,
CBDT or sbix
* PNG
:
CBDT or sbix
*/
/**
...
...
@@ -335,4 +319,5 @@ hb_ot_color_glyph_reference_blob_png (hb_font_t *font,
HB_TAG
(
'p'
,
'n'
,
'g'
,
' '
),
strike_x_ppem
,
strike_y_ppem
);
return
hb_blob_get_empty
();
}
src/hb-ot-color.h
浏览文件 @
9435fb24
...
...
@@ -121,6 +121,10 @@ hb_ot_color_has_svg (hb_face_t *face);
HB_EXTERN
hb_blob_t
*
hb_ot_color_glyph_reference_blob_svg
(
hb_face_t
*
face
,
hb_codepoint_t
glyph
);
/*
* PNG: CBDT or sbix
*/
HB_EXTERN
hb_bool_t
hb_ot_color_has_png
(
hb_face_t
*
face
);
...
...
test/api/test-ot-color.c
浏览文件 @
9435fb24
...
...
@@ -405,22 +405,41 @@ static void
test_hb_ot_color_png
(
void
)
{
hb_blob_t
*
blob
;
unsigned
int
length
;
const
char
*
data
;
unsigned
int
strike_x_ppem
,
strike_y_ppem
;
/* sbix */
hb_font_t
*
sbix_font
;
sbix_font
=
hb_font_create
(
sbix
);
blob
=
hb_ot_color_glyph_reference_blob_png
(
sbix_font
,
0
,
NULL
,
NULL
);
g_assert
(
hb_blob_get_length
(
blob
)
==
0
);
unsigned
int
strike_x_ppem
,
strike_y_ppem
;
blob
=
hb_ot_color_glyph_reference_blob_png
(
sbix_font
,
1
,
&
strike_x_ppem
,
&
strike_y_ppem
);
unsigned
int
length
;
const
char
*
data
=
hb_blob_get_data
(
blob
,
&
length
);
data
=
hb_blob_get_data
(
blob
,
&
length
);
g_assert_cmpuint
(
length
,
==
,
224
);
g_assert_cmpuint
(
strike_x_ppem
,
==
,
300
);
g_assert_cmpuint
(
strike_y_ppem
,
==
,
300
);
g_assert
(
strncmp
(
data
+
1
,
"PNG"
,
3
)
==
0
);
hb_blob_destroy
(
blob
);
hb_font_destroy
(
sbix_font
);
/* cbdt */
hb_font_t
*
cbdt_font
;
cbdt_font
=
hb_font_create
(
cbdt
);
blob
=
hb_ot_color_glyph_reference_blob_png
(
cbdt_font
,
0
,
NULL
,
NULL
);
g_assert
(
hb_blob_get_length
(
blob
)
==
0
);
blob
=
hb_ot_color_glyph_reference_blob_png
(
cbdt_font
,
1
,
&
strike_x_ppem
,
&
strike_y_ppem
);
data
=
hb_blob_get_data
(
blob
,
&
length
);
g_assert_cmpuint
(
length
,
==
,
88
);
g_assert_cmpuint
(
strike_x_ppem
,
==
,
80
);
g_assert_cmpuint
(
strike_y_ppem
,
==
,
80
);
g_assert
(
strncmp
(
data
+
1
,
"PNG"
,
3
)
==
0
);
hb_blob_destroy
(
blob
);
hb_font_destroy
(
cbdt_font
);
}
int
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录