Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
38706a07
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看板
提交
38706a07
编写于
10月 28, 2018
作者:
E
Ebrahim Byagowi
提交者:
Behdad Esfahbod
10月 28, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[ot-color] Preparation for setting PNG width/height in extents
上级
d6d6f3bc
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
59 addition
and
21 deletion
+59
-21
src/dump-emoji.cc
src/dump-emoji.cc
+4
-3
src/hb-ot-color-sbix-table.hh
src/hb-ot-color-sbix-table.hh
+43
-9
src/hb-ot-color.cc
src/hb-ot-color.cc
+6
-8
src/hb-ot-font.cc
src/hb-ot-font.cc
+6
-1
未找到文件。
src/dump-emoji.cc
浏览文件 @
38706a07
...
...
@@ -69,12 +69,13 @@ sbix_dump (hb_face_t *face)
for
(
unsigned
int
glyph_id
=
0
;
glyph_id
<
num_glyphs
;
glyph_id
++
)
{
hb_blob_t
*
blob
;
blob
=
sbix
.
reference_blob_for_glyph
(
glyph_id
,
0
,
available_ppems
[
group
],
HB_TAG
(
'p'
,
'n'
,
'g'
,
' '
));
unsigned
int
ppem
=
available_ppems
[
group
];
blob
=
sbix
.
reference_blob_for_glyph
(
glyph_id
,
ppem
,
ppem
,
HB_TAG
(
'p'
,
'n'
,
'g'
,
' '
),
nullptr
,
nullptr
);
if
(
hb_blob_get_length
(
blob
)
==
0
)
continue
;
char
output_path
[
255
];
sprintf
(
output_path
,
"out/sbix-%d-%d.png"
,
available_ppems
[
group
]
,
glyph_id
);
sprintf
(
output_path
,
"out/sbix-%d-%d.png"
,
ppem
,
glyph_id
);
FILE
*
f
=
fopen
(
output_path
,
"wb"
);
unsigned
int
length
;
const
char
*
data
=
hb_blob_get_data
(
blob
,
&
length
);
...
...
src/hb-ot-color-sbix-table.hh
浏览文件 @
38706a07
...
...
@@ -75,7 +75,7 @@ struct SBIXStrike
inline
unsigned
int
get_resolution
()
const
{
return
resolution
;
}
inline
unsigned
int
blob_size
(
unsigned
int
glyph_id
)
const
inline
unsigned
int
calculate_
blob_size
(
unsigned
int
glyph_id
)
const
{
return
imageOffsetsZ
[
glyph_id
+
1
]
-
imageOffsetsZ
[
glyph_id
]
-
SBIXGlyph
::
min_size
;
}
...
...
@@ -84,6 +84,8 @@ struct SBIXStrike
hb_blob_t
*
sbix_blob
,
unsigned
int
sbix_len
,
unsigned
int
strike_offset
,
int
*
x_offset
,
int
*
y_offset
,
hb_tag_t
file_type
,
unsigned
int
num_glyphs
)
const
{
...
...
@@ -95,7 +97,7 @@ struct SBIXStrike
const
SBIXGlyph
*
glyph
=
&
(
this
+
imageOffsetsZ
[
glyph_id
]);
if
(
unlikely
(
glyph
->
graphicType
==
HB_TAG
(
'd'
,
'u'
,
'p'
,
'e'
)
&&
blob_size
(
glyph_id
)
>=
2
))
calculate_
blob_size
(
glyph_id
)
>=
2
))
{
unsigned
int
new_glyph_id
=
*
((
HBUINT16
*
)
&
glyph
->
data
);
if
(
new_glyph_id
<
num_glyphs
)
...
...
@@ -108,9 +110,15 @@ struct SBIXStrike
}
if
(
unlikely
(
file_type
!=
glyph
->
graphicType
))
return
hb_blob_get_empty
();
unsigned
int
blob_size
=
calculate_blob_size
(
glyph_id
);
if
(
unlikely
(
blob_size
==
0
))
return
hb_blob_get_empty
();
if
(
x_offset
)
*
x_offset
=
glyph
->
xOffset
;
if
(
y_offset
)
*
y_offset
=
glyph
->
yOffset
;
unsigned
int
offset
=
strike_offset
+
SBIXGlyph
::
min_size
;
offset
+=
imageOffsetsZ
[
glyph_id
];
return
hb_blob_create_sub_blob
(
sbix_blob
,
offset
,
blob_size
(
glyph_id
)
);
return
hb_blob_create_sub_blob
(
sbix_blob
,
offset
,
blob_size
);
}
protected:
...
...
@@ -163,25 +171,51 @@ struct sbix
}
inline
hb_blob_t
*
reference_blob_for_glyph
(
hb_codepoint_t
glyph_id
,
unsigned
int
ptem
HB_UNUSED
,
unsigned
int
requested_ppem
,
unsigned
int
requested_file_type
)
const
unsigned
int
x_ppem
,
unsigned
int
y_ppem
,
unsigned
int
file_type
,
int
*
x_offset
,
int
*
y_offset
)
const
{
if
(
unlikely
(
sbix_len
==
0
||
sbix_table
->
strikes
.
len
==
0
))
return
hb_blob_get_empty
();
/* TODO: Does spec guarantee strikes are ascended sorted? */
unsigned
int
group
=
sbix_table
->
strikes
.
len
-
1
;
if
(
requested_ppem
!=
0
)
unsigned
int
ppem
=
MAX
(
x_ppem
,
y_ppem
);
if
(
ppem
!=
0
)
/* TODO: Use bsearch maybe or doesn't worth it? */
for
(
group
=
0
;
group
<
sbix_table
->
strikes
.
len
;
group
++
)
if
((
sbix_table
+
sbix_table
->
strikes
[
group
]).
get_ppem
()
>=
requested_
ppem
)
if
((
sbix_table
+
sbix_table
->
strikes
[
group
]).
get_ppem
()
>=
ppem
)
break
;
const
SBIXStrike
&
strike
=
sbix_table
+
sbix_table
->
strikes
[
group
];
return
strike
.
get_glyph_blob
(
glyph_id
,
sbix_blob
,
sbix_len
,
sbix_table
->
strikes
[
group
],
requested_file_type
,
num_glyphs
);
x_offset
,
y_offset
,
file_type
,
num_glyphs
);
}
inline
bool
get_png_extents
(
hb_codepoint_t
glyph
,
unsigned
int
x_ppem
,
unsigned
int
y_ppem
,
hb_glyph_extents_t
*
extents
)
const
{
int
x_offset
,
y_offset
;
hb_blob_t
*
blob
=
reference_blob_for_glyph
(
glyph
,
x_ppem
,
y_ppem
,
HB_TAG
(
'P'
,
'N'
,
'G'
,
' '
),
&
x_offset
,
&
y_offset
);
if
(
hb_blob_get_length
(
blob
)
==
0
)
return
false
;
extents
->
x_bearing
=
x_offset
;
extents
->
y_bearing
=
y_offset
;
/* XXX: Help me please! */
extents
->
width
=
0
;
extents
->
height
=
0
;
hb_blob_destroy
(
blob
);
return
true
;
}
inline
bool
has_data
()
const
...
...
src/hb-ot-color.cc
浏览文件 @
38706a07
...
...
@@ -316,16 +316,14 @@ hb_blob_t *
hb_ot_color_glyph_reference_png
(
hb_font_t
*
font
,
hb_codepoint_t
glyph
)
{
hb_blob_t
*
blob
=
hb_blob_get_empty
();
/* don't run cbdt first if aat is set */
if
(
!
hb_options
().
aat
&&
_get_cbdt
(
font
->
face
).
has_data
())
blob
=
_get_cbdt
(
font
->
face
).
reference_blob_for_glyph
(
glyph
,
font
->
x_ppem
,
font
->
y_ppem
);
if
(
_get_sbix
(
font
->
face
).
has_data
()
&&
!
hb_blob_get_length
(
blob
))
blob
=
_get_sbix
(
font
->
face
).
reference_blob_for_glyph
(
glyph
,
font
->
ptem
,
MAX
(
font
->
x_ppem
,
font
->
y_ppem
),
HB_TAG
(
'p'
,
'n'
,
'g'
,
' '
));
if
(
_get_sbix
(
font
->
face
).
has_data
())
blob
=
_get_sbix
(
font
->
face
).
reference_blob_for_glyph
(
glyph
,
font
->
x_ppem
,
font
->
y_ppem
,
HB_TAG
(
'p'
,
'n'
,
'g'
,
' '
),
nullptr
,
nullptr
);
if
(
hb_
options
().
aat
&&
_get_cbdt
(
font
->
face
).
has_data
()
&&
!
hb_blob_get_length
(
blob
))
if
(
hb_
blob_get_length
(
blob
)
==
0
&&
_get_cbdt
(
font
->
face
).
has_data
(
))
blob
=
_get_cbdt
(
font
->
face
).
reference_blob_for_glyph
(
glyph
,
font
->
x_ppem
,
font
->
y_ppem
);
return
blob
;
...
...
src/hb-ot-font.cc
浏览文件 @
38706a07
...
...
@@ -39,6 +39,7 @@
#include "hb-ot-glyf-table.hh"
#include "hb-ot-vorg-table.hh"
#include "hb-ot-color-cbdt-table.hh"
#include "hb-ot-color-sbix-table.hh"
/**
...
...
@@ -182,7 +183,11 @@ 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
=
ot_face
->
glyf
->
get_extents
(
glyph
,
extents
);
bool
ret
=
false
;
if
(
ot_face
->
sbix
->
has_data
())
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
)
ret
=
ot_face
->
CBDT
->
get_extents
(
glyph
,
extents
);
// TODO Hook up side-bearings variations.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录