Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
188ee6e5
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看板
提交
188ee6e5
编写于
1月 10, 2018
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Calculate anchor positions in float, then round
Hoping to reduce rounding error, to make tests happier... No luck.
上级
0b28e119
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
28 addition
and
22 deletion
+28
-22
src/hb-font-private.hh
src/hb-font-private.hh
+6
-0
src/hb-ot-layout-gpos-table.hh
src/hb-ot-layout-gpos-table.hh
+22
-22
未找到文件。
src/hb-font-private.hh
浏览文件 @
188ee6e5
...
...
@@ -128,6 +128,8 @@ struct hb_font_t {
inline
hb_position_t
em_scale_y
(
int16_t
v
)
{
return
em_scale
(
v
,
y_scale
);
}
inline
hb_position_t
em_scalef_x
(
float
v
)
{
return
em_scalef
(
v
,
this
->
x_scale
);
}
inline
hb_position_t
em_scalef_y
(
float
v
)
{
return
em_scalef
(
v
,
this
->
y_scale
);
}
inline
float
em_fscale_x
(
int16_t
v
)
{
return
em_fscale
(
v
,
x_scale
);
}
inline
float
em_fscale_y
(
int16_t
v
)
{
return
em_fscale
(
v
,
y_scale
);
}
inline
hb_position_t
em_scale_dir
(
int16_t
v
,
hb_direction_t
direction
)
{
return
em_scale
(
v
,
dir_scale
(
direction
));
}
...
...
@@ -543,6 +545,10 @@ struct hb_font_t {
{
return
(
hb_position_t
)
round
(
v
*
scale
/
face
->
get_upem
());
}
inline
float
em_fscale
(
int16_t
v
,
int
scale
)
{
return
(
float
)
v
*
scale
/
face
->
get_upem
();
}
};
#define HB_SHAPER_DATA_CREATE_FUNC_EXTRA_ARGS
...
...
src/hb-ot-layout-gpos-table.hh
浏览文件 @
188ee6e5
...
...
@@ -233,11 +233,11 @@ struct ValueFormat : HBUINT16
struct
AnchorFormat1
{
inline
void
get_anchor
(
hb_apply_context_t
*
c
,
hb_codepoint_t
glyph_id
HB_UNUSED
,
hb_position_t
*
x
,
hb_position_
t
*
y
)
const
float
*
x
,
floa
t
*
y
)
const
{
hb_font_t
*
font
=
c
->
font
;
*
x
=
font
->
em_scale_x
(
xCoordinate
);
*
y
=
font
->
em_scale_y
(
yCoordinate
);
*
x
=
font
->
em_
f
scale_x
(
xCoordinate
);
*
y
=
font
->
em_
f
scale_y
(
yCoordinate
);
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
...
...
@@ -257,7 +257,7 @@ struct AnchorFormat1
struct
AnchorFormat2
{
inline
void
get_anchor
(
hb_apply_context_t
*
c
,
hb_codepoint_t
glyph_id
,
hb_position_t
*
x
,
hb_position_
t
*
y
)
const
float
*
x
,
floa
t
*
y
)
const
{
hb_font_t
*
font
=
c
->
font
;
unsigned
int
x_ppem
=
font
->
x_ppem
;
...
...
@@ -267,8 +267,8 @@ struct AnchorFormat2
ret
=
(
x_ppem
||
y_ppem
)
&&
font
->
get_glyph_contour_point_for_origin
(
glyph_id
,
anchorPoint
,
HB_DIRECTION_LTR
,
&
cx
,
&
cy
);
*
x
=
ret
&&
x_ppem
?
cx
:
font
->
em_scale_x
(
xCoordinate
);
*
y
=
ret
&&
y_ppem
?
cy
:
font
->
em_scale_y
(
yCoordinate
);
*
x
=
ret
&&
x_ppem
?
cx
:
font
->
em_
f
scale_x
(
xCoordinate
);
*
y
=
ret
&&
y_ppem
?
cy
:
font
->
em_
f
scale_y
(
yCoordinate
);
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
...
...
@@ -289,11 +289,11 @@ struct AnchorFormat2
struct
AnchorFormat3
{
inline
void
get_anchor
(
hb_apply_context_t
*
c
,
hb_codepoint_t
glyph_id
HB_UNUSED
,
hb_position_t
*
x
,
hb_position_
t
*
y
)
const
float
*
x
,
floa
t
*
y
)
const
{
hb_font_t
*
font
=
c
->
font
;
*
x
=
font
->
em_scale_x
(
xCoordinate
);
*
y
=
font
->
em_scale_y
(
yCoordinate
);
*
x
=
font
->
em_
f
scale_x
(
xCoordinate
);
*
y
=
font
->
em_
f
scale_y
(
yCoordinate
);
if
(
font
->
x_ppem
||
font
->
num_coords
)
*
x
+=
(
this
+
xDeviceTable
).
get_x_delta
(
font
,
c
->
var_store
);
...
...
@@ -326,7 +326,7 @@ struct AnchorFormat3
struct
Anchor
{
inline
void
get_anchor
(
hb_apply_context_t
*
c
,
hb_codepoint_t
glyph_id
,
hb_position_t
*
x
,
hb_position_
t
*
y
)
const
float
*
x
,
floa
t
*
y
)
const
{
*
x
=
*
y
=
0
;
switch
(
u
.
format
)
{
...
...
@@ -430,15 +430,15 @@ struct MarkArray : ArrayOf<MarkRecord> /* Array of MarkRecords--in Coverage orde
* return false such that the subsequent subtables have a chance at it. */
if
(
unlikely
(
!
found
))
return_trace
(
false
);
hb_position_
t
mark_x
,
mark_y
,
base_x
,
base_y
;
floa
t
mark_x
,
mark_y
,
base_x
,
base_y
;
buffer
->
unsafe_to_break
(
glyph_pos
,
buffer
->
idx
);
mark_anchor
.
get_anchor
(
c
,
buffer
->
cur
().
codepoint
,
&
mark_x
,
&
mark_y
);
glyph_anchor
.
get_anchor
(
c
,
buffer
->
info
[
glyph_pos
].
codepoint
,
&
base_x
,
&
base_y
);
hb_glyph_position_t
&
o
=
buffer
->
cur_pos
();
o
.
x_offset
=
base_x
-
mark_x
;
o
.
y_offset
=
base_y
-
mark_y
;
o
.
x_offset
=
round
(
base_x
-
mark_x
)
;
o
.
y_offset
=
round
(
base_y
-
mark_y
)
;
o
.
attach_type
()
=
ATTACH_TYPE_MARK
;
o
.
attach_chain
()
=
(
int
)
glyph_pos
-
(
int
)
buffer
->
idx
;
buffer
->
scratch_flags
|=
HB_BUFFER_SCRATCH_FLAG_HAS_GPOS_ATTACHMENT
;
...
...
@@ -919,7 +919,7 @@ struct CursivePosFormat1
unsigned
int
j
=
skippy_iter
.
idx
;
buffer
->
unsafe_to_break
(
i
,
j
);
hb_position_
t
entry_x
,
entry_y
,
exit_x
,
exit_y
;
floa
t
entry_x
,
entry_y
,
exit_x
,
exit_y
;
(
this
+
this_record
.
exitAnchor
).
get_anchor
(
c
,
buffer
->
info
[
i
].
codepoint
,
&
exit_x
,
&
exit_y
);
(
this
+
next_record
.
entryAnchor
).
get_anchor
(
c
,
buffer
->
info
[
j
].
codepoint
,
&
entry_x
,
&
entry_y
);
...
...
@@ -929,32 +929,32 @@ struct CursivePosFormat1
/* Main-direction adjustment */
switch
(
c
->
direction
)
{
case
HB_DIRECTION_LTR
:
pos
[
i
].
x_advance
=
exit_x
+
pos
[
i
].
x_offset
;
pos
[
i
].
x_advance
=
round
(
exit_x
)
+
pos
[
i
].
x_offset
;
d
=
entry_x
+
pos
[
j
].
x_offset
;
d
=
round
(
entry_x
)
+
pos
[
j
].
x_offset
;
pos
[
j
].
x_advance
-=
d
;
pos
[
j
].
x_offset
-=
d
;
break
;
case
HB_DIRECTION_RTL
:
d
=
exit_x
+
pos
[
i
].
x_offset
;
d
=
round
(
exit_x
)
+
pos
[
i
].
x_offset
;
pos
[
i
].
x_advance
-=
d
;
pos
[
i
].
x_offset
-=
d
;
pos
[
j
].
x_advance
=
entry_x
+
pos
[
j
].
x_offset
;
pos
[
j
].
x_advance
=
round
(
entry_x
)
+
pos
[
j
].
x_offset
;
break
;
case
HB_DIRECTION_TTB
:
pos
[
i
].
y_advance
=
exit_y
+
pos
[
i
].
y_offset
;
pos
[
i
].
y_advance
=
round
(
exit_y
)
+
pos
[
i
].
y_offset
;
d
=
entry_y
+
pos
[
j
].
y_offset
;
d
=
round
(
entry_y
)
+
pos
[
j
].
y_offset
;
pos
[
j
].
y_advance
-=
d
;
pos
[
j
].
y_offset
-=
d
;
break
;
case
HB_DIRECTION_BTT
:
d
=
exit_y
+
pos
[
i
].
y_offset
;
d
=
round
(
exit_y
)
+
pos
[
i
].
y_offset
;
pos
[
i
].
y_advance
-=
d
;
pos
[
i
].
y_offset
-=
d
;
pos
[
j
].
y_advance
=
entry_y
;
pos
[
j
].
y_advance
=
round
(
entry_y
)
;
break
;
case
HB_DIRECTION_INVALID
:
default:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录