Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
01c7d53f
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看板
提交
01c7d53f
编写于
10月 28, 2018
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[sbix] Select best strike based on ppem
上级
f9f26bff
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
30 addition
and
25 deletion
+30
-25
src/hb-ot-color-sbix-table.hh
src/hb-ot-color-sbix-table.hh
+28
-22
src/hb-ot-color.cc
src/hb-ot-color.cc
+1
-2
src/hb-ot-font.cc
src/hb-ot-font.cc
+1
-1
未找到文件。
src/hb-ot-color-sbix-table.hh
浏览文件 @
01c7d53f
...
...
@@ -172,37 +172,44 @@ struct sbix
return
result
;
}
inline
bool
get_extents
(
hb_codepoint_t
glyph
,
unsigned
int
x_ppem
,
unsigned
int
y_ppem
,
inline
bool
get_extents
(
hb_font_t
*
font
,
hb_codepoint_t
glyph
,
hb_glyph_extents_t
*
extents
)
const
{
/* We only support PNG right now, and following function checks type. */
return
get_png_extents
(
glyph
,
x_ppem
,
y_ppem
,
extents
);
return
get_png_extents
(
font
,
glyph
,
extents
);
}
inline
hb_blob_t
*
reference_blob_for_glyph
(
hb_codepoint_t
glyph_id
,
unsigned
int
x_ppem
,
unsigned
int
y_ppem
,
inline
hb_blob_t
*
reference_blob_for_glyph
(
hb_font_t
*
font
,
hb_codepoint_t
glyph_id
,
unsigned
int
file_type
,
int
*
x_offset
,
int
*
y_offset
)
const
{
if
(
unlikely
(
sbix_len
==
0
||
sbix_table
->
strikes
.
len
==
0
))
if
(
unlikely
(
!
sbix_len
||
!
sbix_table
->
strikes
.
len
))
return
hb_blob_get_empty
();
/* TODO: Does spec guarantee strikes are ascended sorted? */
unsigned
int
group
=
sbix_table
->
strikes
.
len
-
1
;
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
()
>=
ppem
)
break
;
unsigned
int
requested_ppem
=
MAX
(
font
->
x_ppem
,
font
->
y_ppem
);
if
(
!
requested_ppem
)
requested_ppem
=
1
<<
30
;
/* Choose largest strike. */
/* TODO Add DPI sensitivity as well? */
unsigned
int
best_i
=
0
;
unsigned
int
best_ppem
=
(
sbix_table
+
sbix_table
->
strikes
[
0
]).
get_ppem
();
for
(
unsigned
int
i
=
1
;
i
<
sbix_table
->
strikes
.
len
;
i
++
)
{
unsigned
int
ppem
=
(
sbix_table
+
sbix_table
->
strikes
[
i
]).
get_ppem
();
if
((
requested_ppem
<=
ppem
&&
ppem
<
best_ppem
)
||
(
requested_ppem
>
best_ppem
&&
ppem
>
best_ppem
))
{
best_i
=
i
;
best_ppem
=
ppem
;
}
}
const
SBIXStrike
&
strike
=
sbix_table
+
sbix_table
->
strikes
[
group
];
const
SBIXStrike
&
strike
=
sbix_table
+
sbix_table
->
strikes
[
best_i
];
return
strike
.
get_glyph_blob
(
glyph_id
,
sbix_blob
,
sbix_len
,
sbix_table
->
strikes
[
group
],
sbix_table
->
strikes
[
best_i
],
x_offset
,
y_offset
,
file_type
,
num_glyphs
);
}
...
...
@@ -232,16 +239,15 @@ struct sbix
DEFINE_SIZE_STATIC
(
29
);
};
inline
bool
get_png_extents
(
hb_codepoint_t
glyph
,
unsigned
int
x_ppem
,
unsigned
int
y_ppem
,
inline
bool
get_png_extents
(
hb_font_t
*
font
,
hb_codepoint_t
glyph
,
hb_glyph_extents_t
*
extents
)
const
{
if
(
likely
(
sbix_len
==
0
))
return
false
;
int
x_offset
,
y_offset
;
hb_blob_t
*
blob
=
reference_blob_for_glyph
(
glyph
,
x_ppem
,
y_ppem
,
hb_blob_t
*
blob
=
reference_blob_for_glyph
(
font
,
glyph
,
HB_TAG
(
'p'
,
'n'
,
'g'
,
' '
),
&
x_offset
,
&
y_offset
);
...
...
src/hb-ot-color.cc
浏览文件 @
01c7d53f
...
...
@@ -318,8 +318,7 @@ hb_ot_color_glyph_reference_png (hb_font_t *font, hb_codepoint_t glyph)
hb_blob_t
*
blob
=
hb_blob_get_empty
();
if
(
_get_sbix
(
font
->
face
).
has_data
())
blob
=
_get_sbix
(
font
->
face
).
reference_blob_for_glyph
(
glyph
,
font
->
x_ppem
,
font
->
y_ppem
,
blob
=
_get_sbix
(
font
->
face
).
reference_blob_for_glyph
(
font
,
glyph
,
HB_TAG
(
'p'
,
'n'
,
'g'
,
' '
),
nullptr
,
nullptr
);
...
...
src/hb-ot-font.cc
浏览文件 @
01c7d53f
...
...
@@ -183,7 +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
=
ot_face
->
sbix
->
get_extents
(
glyph
,
font
->
x_ppem
,
font
->
y_ppem
,
extents
);
bool
ret
=
ot_face
->
sbix
->
get_extents
(
font
,
glyph
,
extents
);
if
(
!
ret
)
ret
=
ot_face
->
glyf
->
get_extents
(
glyph
,
extents
);
if
(
!
ret
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录