Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
a484e237
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看板
提交
a484e237
编写于
1月 22, 2017
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[var] Implement 'avar' table mapping
Untested!
上级
a4290905
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
60 addition
and
11 deletion
+60
-11
src/hb-ot-math.cc
src/hb-ot-math.cc
+0
-2
src/hb-ot-var-avar-table.hh
src/hb-ot-var-avar-table.hh
+45
-1
src/hb-ot-var.cc
src/hb-ot-var.cc
+15
-8
未找到文件。
src/hb-ot-math.cc
浏览文件 @
a484e237
...
...
@@ -34,9 +34,7 @@ static inline const OT::MATH&
_get_math
(
hb_face_t
*
face
)
{
if
(
unlikely
(
!
hb_ot_shaper_face_data_ensure
(
face
)))
return
OT
::
Null
(
OT
::
MATH
);
hb_ot_layout_t
*
layout
=
hb_ot_layout_from_face
(
face
);
return
*
(
layout
->
math
.
get
());
}
...
...
src/hb-ot-var-avar-table.hh
浏览文件 @
a484e237
...
...
@@ -50,7 +50,39 @@ struct AxisValueMap
DEFINE_SIZE_STATIC
(
4
);
};
typedef
ArrayOf
<
AxisValueMap
>
SegmentMaps
;
struct
SegmentMaps
:
ArrayOf
<
AxisValueMap
>
{
inline
int
map
(
int
value
)
const
{
/* The following special-cases are not part of OpenType, which requires
* that at least -1, 0, and +1 must be mapped. But we include these as
* part of a better error recovery scheme. */
if
(
!
len
)
return
value
;
if
(
value
<=
array
[
0
].
fromCoord
)
return
value
-
array
[
0
].
fromCoord
+
array
[
0
].
toCoord
;
unsigned
int
i
;
unsigned
int
count
=
len
;
for
(
i
=
1
;
i
<
count
&&
value
>
array
[
i
].
fromCoord
;
i
++
)
;
if
(
value
>=
array
[
i
].
fromCoord
)
return
value
-
array
[
i
].
fromCoord
+
array
[
i
].
toCoord
;
if
(
unlikely
(
array
[
i
-
1
].
fromCoord
==
array
[
i
].
fromCoord
))
return
array
[
i
-
1
].
toCoord
;
int
denom
=
array
[
i
].
fromCoord
-
array
[
i
-
1
].
fromCoord
;
return
array
[
i
-
1
].
toCoord
+
(
array
[
i
].
toCoord
-
array
[
i
-
1
].
toCoord
)
*
(
value
-
array
[
i
-
1
].
fromCoord
+
denom
/
2
)
/
denom
;
}
DEFINE_SIZE_ARRAY
(
2
,
array
);
};
/*
* avar — Axis Variations Table
...
...
@@ -80,6 +112,18 @@ struct avar
return_trace
(
true
);
}
inline
void
map_coords
(
int
*
coords
,
unsigned
int
coords_length
)
const
{
unsigned
int
count
=
MIN
<
unsigned
int
>
(
coords_length
,
axisCount
);
const
SegmentMaps
*
map
=
&
axisSegmentMapsZ
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
{
coords
[
i
]
=
map
->
map
(
coords
[
i
]);
map
=
&
StructAfter
<
SegmentMaps
>
(
*
map
);
}
}
protected:
FixedVersion
<>
version
;
/* Version of the avar table
* initially set to 0x00010000u */
...
...
src/hb-ot-var.cc
浏览文件 @
a484e237
...
...
@@ -33,19 +33,24 @@
HB_SHAPER_DATA_ENSURE_DECLARE
(
ot
,
face
)
/*
* fvar/avar
*/
static
inline
const
OT
::
fvar
&
_get_fvar
(
hb_face_t
*
face
)
{
if
(
unlikely
(
!
hb_ot_shaper_face_data_ensure
(
face
)))
return
OT
::
Null
(
OT
::
fvar
);
hb_ot_layout_t
*
layout
=
hb_ot_layout_from_face
(
face
);
return
*
(
layout
->
fvar
.
get
());
}
/*
* fvar/avar
*/
static
inline
const
OT
::
avar
&
_get_avar
(
hb_face_t
*
face
)
{
if
(
unlikely
(
!
hb_ot_shaper_face_data_ensure
(
face
)))
return
OT
::
Null
(
OT
::
avar
);
hb_ot_layout_t
*
layout
=
hb_ot_layout_from_face
(
face
);
return
*
(
layout
->
avar
.
get
());
}
/**
* hb_ot_var_has_data:
...
...
@@ -131,7 +136,8 @@ hb_ot_var_normalize_variations (hb_face_t *face,
coords
[
axis_index
]
=
fvar
.
normalize_axis_value
(
axis_index
,
variations
[
i
].
value
);
}
/* TODO avar */
const
OT
::
avar
&
avar
=
_get_avar
(
face
);
avar
.
map_coords
(
coords
,
coords_length
);
}
/**
...
...
@@ -149,5 +155,6 @@ hb_ot_var_normalize_coords (hb_face_t *face,
for
(
unsigned
int
i
=
0
;
i
<
coords_length
;
i
++
)
normalized_coords
[
i
]
=
fvar
.
normalize_axis_value
(
i
,
design_coords
[
i
]);
/* TODO avar */
const
OT
::
avar
&
avar
=
_get_avar
(
face
);
avar
.
map_coords
(
normalized_coords
,
coords_length
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录