Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
785982bf
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,发现更多精彩内容 >>
提交
785982bf
编写于
1月 20, 2017
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[var] Flesh out some more
上级
422c0c36
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
104 addition
and
27 deletion
+104
-27
src/Makefile.am
src/Makefile.am
+2
-0
src/hb-ot-var-fvar-table.hh
src/hb-ot-var-fvar-table.hh
+50
-19
src/hb-ot-var.cc
src/hb-ot-var.cc
+38
-1
src/hb-ot-var.h
src/hb-ot-var.h
+14
-7
未找到文件。
src/Makefile.am
浏览文件 @
785982bf
...
@@ -299,6 +299,8 @@ test_buffer_serialize_SOURCES = test-buffer-serialize.cc
...
@@ -299,6 +299,8 @@ test_buffer_serialize_SOURCES = test-buffer-serialize.cc
test_buffer_serialize_CPPFLAGS
=
$(HBCFLAGS)
test_buffer_serialize_CPPFLAGS
=
$(HBCFLAGS)
test_buffer_serialize_LDADD
=
libharfbuzz.la
$(HBLIBS)
test_buffer_serialize_LDADD
=
libharfbuzz.la
$(HBLIBS)
check
:
harfbuzz.def
#
For check-defs.sh
dist_check_SCRIPTS
=
\
dist_check_SCRIPTS
=
\
check-c-linkage-decls.sh
\
check-c-linkage-decls.sh
\
check-defs.sh
\
check-defs.sh
\
...
...
src/hb-ot-var-fvar-table.hh
浏览文件 @
785982bf
...
@@ -99,27 +99,17 @@ struct fvar
...
@@ -99,27 +99,17 @@ struct fvar
axisCount
*
axisSize
+
instanceCount
*
instanceSize
));
axisCount
*
axisSize
+
instanceCount
*
instanceSize
));
}
}
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
unsigned
int
get_axis_count
(
void
)
const
inline
unsigned
int
get_axis_count
(
void
)
const
{
return
axisCount
;
}
{
return
axisCount
;
}
inline
bool
find_axis
(
hb_tag_t
tag
,
unsigned
int
*
index
,
hb_ot_var_axis_t
*
info
)
const
inline
bool
get_axis
(
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
)
if
(
unlikely
(
index
>=
axisCount
))
*
index
=
i
;
return
false
;
if
(
info
)
if
(
info
)
{
{
const
AxisRecord
&
axis
=
axes
[
i
];
const
AxisRecord
&
axis
=
get_axes
()[
index
];
info
->
tag
=
axis
.
axisTag
;
info
->
tag
=
axis
.
axisTag
;
info
->
name_id
=
axis
.
axisNameID
;
info
->
name_id
=
axis
.
axisNameID
;
info
->
default_value
=
axis
.
defaultValue
/
65536.
;
info
->
default_value
=
axis
.
defaultValue
/
65536.
;
...
@@ -127,17 +117,51 @@ struct fvar
...
@@ -127,17 +117,51 @@ struct fvar
info
->
min_value
=
MIN
<
float
>
(
info
->
default_value
,
axis
.
minValue
/
65536.
);
info
->
min_value
=
MIN
<
float
>
(
info
->
default_value
,
axis
.
minValue
/
65536.
);
info
->
max_value
=
MAX
<
float
>
(
info
->
default_value
,
axis
.
maxValue
/
65536.
);
info
->
max_value
=
MAX
<
float
>
(
info
->
default_value
,
axis
.
maxValue
/
65536.
);
}
}
return
true
;
return
true
;
}
}
inline
unsigned
int
get_axis_infos
(
unsigned
int
start_offset
,
unsigned
int
*
axes_count
/* IN/OUT */
,
hb_ot_var_axis_t
*
axes_array
/* OUT */
)
const
{
if
(
axes_count
)
{
unsigned
int
count
=
axisCount
;
start_offset
=
MIN
(
start_offset
,
count
);
count
-=
start_offset
;
axes_array
+=
start_offset
;
count
=
MIN
(
count
,
*
axes_count
);
*
axes_count
=
count
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
get_axis
(
start_offset
+
i
,
axes_array
+
i
);
}
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
;
return
get_axis
(
i
,
info
);
}
if
(
index
)
if
(
index
)
*
index
=
HB_OT_VAR_NO_AXIS_INDEX
;
*
index
=
HB_OT_VAR_NO_AXIS_INDEX
;
return
false
;
return
false
;
}
}
inline
int
normalize_axis_value
(
hb_tag_t
tag
,
float
v
,
unsigned
int
*
axis_index
)
const
inline
int
normalize_axis_value
(
unsigned
int
axis_index
,
float
v
)
const
{
{
hb_ot_var_axis_t
axis
;
hb_ot_var_axis_t
axis
;
if
(
!
find_axis
(
tag
,
axis_index
,
&
axis
))
if
(
!
get_axis
(
axis_index
,
&
axis
))
return
0
;
return
0
;
v
=
MAX
(
MIN
(
v
,
axis
.
max_value
),
axis
.
min_value
);
/* Clamp. */
v
=
MAX
(
MIN
(
v
,
axis
.
max_value
),
axis
.
min_value
);
/* Clamp. */
...
@@ -151,6 +175,13 @@ struct fvar
...
@@ -151,6 +175,13 @@ struct fvar
return
(
int
)
(
v
*
16384.
+
(
v
>=
0.
?
.5
:
-
.5
));
return
(
int
)
(
v
*
16384.
+
(
v
>=
0.
?
.5
:
-
.5
));
}
}
protected:
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
);
}
protected:
protected:
FixedVersion
<>
version
;
/* Version of the fvar table
FixedVersion
<>
version
;
/* Version of the fvar table
* initially set to 0x00010000u */
* initially set to 0x00010000u */
...
...
src/hb-ot-var.cc
浏览文件 @
785982bf
...
@@ -43,7 +43,7 @@ _get_fvar (hb_face_t *face)
...
@@ -43,7 +43,7 @@ _get_fvar (hb_face_t *face)
}
}
/*
/*
*
OT::f
var
*
fvar/a
var
*/
*/
/**
/**
...
@@ -51,6 +51,7 @@ _get_fvar (hb_face_t *face)
...
@@ -51,6 +51,7 @@ _get_fvar (hb_face_t *face)
* @face: #hb_face_t to test
* @face: #hb_face_t to test
*
*
* This function allows to verify the presence of OpenType variation data on the face.
* This function allows to verify the presence of OpenType variation data on the face.
* Alternatively, use hb_ot_var_get_axis_count().
*
*
* Return value: true if face has a `fvar' table and false otherwise
* Return value: true if face has a `fvar' table and false otherwise
*
*
...
@@ -61,3 +62,39 @@ hb_ot_var_has_data (hb_face_t *face)
...
@@ -61,3 +62,39 @@ hb_ot_var_has_data (hb_face_t *face)
{
{
return
&
_get_fvar
(
face
)
!=
&
OT
::
Null
(
OT
::
fvar
);
return
&
_get_fvar
(
face
)
!=
&
OT
::
Null
(
OT
::
fvar
);
}
}
unsigned
int
hb_ot_var_get_axis_count
(
hb_face_t
*
face
)
{
const
OT
::
fvar
&
fvar
=
_get_fvar
(
face
);
return
fvar
.
get_axis_count
();
}
unsigned
int
hb_ot_var_get_axes
(
hb_face_t
*
face
,
unsigned
int
start_offset
,
unsigned
int
*
axes_count
/* IN/OUT */
,
hb_ot_var_axis_t
*
axes_array
/* OUT */
)
{
const
OT
::
fvar
&
fvar
=
_get_fvar
(
face
);
return
fvar
.
get_axis_infos
(
start_offset
,
axes_count
,
axes_array
);
}
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
)
{
const
OT
::
fvar
&
fvar
=
_get_fvar
(
face
);
return
fvar
.
find_axis
(
axis_tag
,
axis_index
,
axis_info
);
}
HB_EXTERN
int
hb_ot_var_normalize_axis_value
(
hb_face_t
*
face
,
unsigned
int
axis_index
,
float
v
)
{
const
OT
::
fvar
&
fvar
=
_get_fvar
(
face
);
return
fvar
.
normalize_axis_value
(
axis_index
,
v
);
}
src/hb-ot-var.h
浏览文件 @
785982bf
...
@@ -62,7 +62,14 @@ hb_ot_var_has_data (hb_face_t *face);
...
@@ -62,7 +62,14 @@ hb_ot_var_has_data (hb_face_t *face);
#define HB_OT_VAR_NO_AXIS_INDEX 0xFFFFFFFFu
#define HB_OT_VAR_NO_AXIS_INDEX 0xFFFFFFFFu
#if 0
HB_EXTERN
unsigned
int
hb_ot_var_get_axis_count
(
hb_face_t
*
face
);
HB_EXTERN
unsigned
int
hb_ot_var_get_axes
(
hb_face_t
*
face
,
unsigned
int
start_offset
,
unsigned
int
*
axes_count
/* IN/OUT */
,
hb_ot_var_axis_t
*
axes_array
/* OUT */
);
HB_EXTERN
hb_bool_t
HB_EXTERN
hb_bool_t
hb_ot_var_find_axis
(
hb_face_t
*
face
,
hb_ot_var_find_axis
(
hb_face_t
*
face
,
...
@@ -70,13 +77,13 @@ hb_ot_var_find_axis (hb_face_t *face,
...
@@ -70,13 +77,13 @@ hb_ot_var_find_axis (hb_face_t *face,
unsigned
int
*
axis_index
,
unsigned
int
*
axis_index
,
hb_ot_var_axis_t
*
axis_info
);
hb_ot_var_axis_t
*
axis_info
);
HB_EXTERN unsigned int
Xhb_ot_var_get_axes (hb_face_t *face,
unsigned int start_offset,
unsigned int *axes_count /* IN/OUT */,
hb_ot_var_axis_t *axes_array /* OUT */);
/* TODO Add "find_axis", etc API? Are they needed at all? */
HB_EXTERN
int
hb_ot_var_normalize_axis_value
(
hb_face_t
*
face
,
unsigned
int
axis_index
,
float
v
);
#if 0
HB_EXTERN unsigned int
HB_EXTERN unsigned int
Xhb_ot_var_get_named_instances (hb_face_t *face, ... );
Xhb_ot_var_get_named_instances (hb_face_t *face, ... );
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录