Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
422c0c36
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
422c0c36
编写于
1月 20, 2017
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[var] Flesh out a bit
上级
b8376b10
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
67 addition
and
15 deletion
+67
-15
src/hb-ot-var-fvar-table.hh
src/hb-ot-var-fvar-table.hh
+58
-14
src/hb-ot-var.h
src/hb-ot-var.h
+9
-1
未找到文件。
src/hb-ot-var-fvar-table.hh
浏览文件 @
422c0c36
...
...
@@ -63,7 +63,7 @@ struct AxisRecord
return_trace
(
c
->
check_struct
(
this
));
}
p
rotected
:
p
ublic
:
Tag
axisTag
;
/* Tag identifying the design variation for the axis. */
Fixed
minValue
;
/* The minimum coordinate value for the axis. */
Fixed
defaultValue
;
/* The default coordinate value for the axis. */
...
...
@@ -89,23 +89,67 @@ struct fvar
{
TRACE_SANITIZE
(
this
);
return_trace
(
version
.
sanitize
(
c
)
&&
likely
(
version
.
major
==
1
)
/*&&
mathConstants.sanitize (c, this) &&
mathGlyphInfo.sanitize (c, this) &&
mathVariants.sanitize (c, this)*/
);
likely
(
version
.
major
==
1
)
&&
c
->
check_struct
(
this
)
&&
instanceSize
>=
axisCount
*
4
+
4
&&
axisSize
<=
1024
&&
/* Arbitrary, just to simplify overflow checks. */
instanceSize
<=
1024
&&
/* Arbitrary, just to simplify overflow checks. */
c
->
check_range
(
this
,
things
)
&&
c
->
check_range
(
&
StructAtOffset
<
char
>
(
this
,
things
),
axisCount
*
axisSize
+
instanceCount
*
instanceSize
));
}
#if 0
inline hb_position_t get_constant (hb_ot_math_constant_t constant,
hb_font_t *font) const
{ return (this+mathConstants).get_value (constant, font); }
inline
const
AxisRecord
*
get_axes
(
void
)
const
{
return
&
StructAtOffset
<
AxisRecord
>
(
this
,
things
);
}
inline
const
InstanceRecord
*
get_instances
(
void
)
const
{
return
&
StructAtOffset
<
InstanceRecord
>
(
get_axes
()
+
axisCount
,
0
);
}
inline const MathGlyphInfo &get_math_glyph_info (void) const
{ return this+mathGlyphInfo; }
inline
unsigned
int
get_axis_count
(
void
)
const
{
return
axisCount
;
}
inline
bool
find_axis
(
hb_tag_t
tag
,
unsigned
int
*
index
,
hb_ot_var_axis_t
*
info
)
const
{
const
AxisRecord
*
axes
=
get_axes
();
unsigned
int
count
=
get_axis_count
();
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
if
(
axes
[
i
].
axisTag
==
tag
)
{
if
(
index
)
*
index
=
i
;
if
(
info
)
{
const
AxisRecord
&
axis
=
axes
[
i
];
info
->
tag
=
axis
.
axisTag
;
info
->
name_id
=
axis
.
axisNameID
;
info
->
default_value
=
axis
.
defaultValue
/
65536.
;
/* Ensure order, to simplify client math. */
info
->
min_value
=
MIN
<
float
>
(
info
->
default_value
,
axis
.
minValue
/
65536.
);
info
->
max_value
=
MAX
<
float
>
(
info
->
default_value
,
axis
.
maxValue
/
65536.
);
}
return
true
;
}
if
(
index
)
*
index
=
HB_OT_VAR_NO_AXIS_INDEX
;
return
false
;
}
inline const MathVariants &get_math_variants (void) const
{ return this+mathVariants; }
#endif
inline
int
normalize_axis_value
(
hb_tag_t
tag
,
float
v
,
unsigned
int
*
axis_index
)
const
{
hb_ot_var_axis_t
axis
;
if
(
!
find_axis
(
tag
,
axis_index
,
&
axis
))
return
0
;
v
=
MAX
(
MIN
(
v
,
axis
.
max_value
),
axis
.
min_value
);
/* Clamp. */
if
(
v
==
axis
.
default_value
)
return
0
;
else
if
(
v
<
axis
.
default_value
)
v
=
(
v
-
axis
.
default_value
)
/
(
axis
.
default_value
-
axis
.
min_value
);
else
v
=
(
v
-
axis
.
default_value
)
/
(
axis
.
max_value
-
axis
.
default_value
);
return
(
int
)
(
v
*
16384.
+
(
v
>=
0.
?
.5
:
-
.5
));
}
protected:
FixedVersion
<>
version
;
/* Version of the fvar table
...
...
src/hb-ot-var.h
浏览文件 @
422c0c36
...
...
@@ -53,15 +53,23 @@ typedef struct hb_ot_var_axis_t {
hb_tag_t
tag
;
unsigned
int
name_id
;
float
min_value
;
float
def_value
;
float
def
ault
_value
;
float
max_value
;
}
hb_ot_var_axis_t
;
HB_EXTERN
hb_bool_t
hb_ot_var_has_data
(
hb_face_t
*
face
);
#define HB_OT_VAR_NO_AXIS_INDEX 0xFFFFFFFFu
#if 0
HB_EXTERN hb_bool_t
hb_ot_var_find_axis (hb_face_t *face,
hb_tag_t axis_tag,
unsigned int *axis_index,
hb_ot_var_axis_t *axis_info);
HB_EXTERN unsigned int
Xhb_ot_var_get_axes (hb_face_t *face,
unsigned int start_offset,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录