Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
fdce1e15
T
Third Party Harfbuzz
项目概览
OpenHarmony
/
Third Party Harfbuzz
接近 2 年 前同步成功
通知
1
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看板
提交
fdce1e15
编写于
10月 07, 2018
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[kerx] Clean up kerx and KerxTable structures
上级
71b65eb2
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
113 addition
and
58 deletion
+113
-58
src/hb-aat-layout-kerx-table.hh
src/hb-aat-layout-kerx-table.hh
+112
-57
src/hb-aat-layout-morx-table.hh
src/hb-aat-layout-morx-table.hh
+1
-1
未找到文件。
src/hb-aat-layout-kerx-table.hh
浏览文件 @
fdce1e15
...
@@ -30,7 +30,6 @@
...
@@ -30,7 +30,6 @@
#include "hb-open-type.hh"
#include "hb-open-type.hh"
#include "hb-aat-layout-common.hh"
#include "hb-aat-layout-common.hh"
#include "hb-aat-layout-ankr-table.hh"
/*
/*
* kerx -- Extended Kerning
* kerx -- Extended Kerning
...
@@ -71,6 +70,14 @@ struct KerxSubTableFormat0
...
@@ -71,6 +70,14 @@ struct KerxSubTableFormat0
// return 0;
// return 0;
// return pairs[i].get_kerning ();
// return pairs[i].get_kerning ();
// }
// }
inline
bool
apply
(
hb_aat_apply_context_t
*
c
)
const
{
TRACE_APPLY
(
this
);
/* TODO */
return_trace
(
true
);
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
{
...
@@ -96,6 +103,15 @@ struct KerxSubTableFormat0
...
@@ -96,6 +103,15 @@ struct KerxSubTableFormat0
struct
KerxSubTableFormat1
struct
KerxSubTableFormat1
{
{
inline
bool
apply
(
hb_aat_apply_context_t
*
c
)
const
{
TRACE_APPLY
(
this
);
/* TODO */
return_trace
(
true
);
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
{
TRACE_SANITIZE
(
this
);
TRACE_SANITIZE
(
this
);
...
@@ -145,6 +161,15 @@ struct KerxSubTableFormat2
...
@@ -145,6 +161,15 @@ struct KerxSubTableFormat2
return
*
v
;
return
*
v
;
}
}
inline
bool
apply
(
hb_aat_apply_context_t
*
c
)
const
{
TRACE_APPLY
(
this
);
/* TODO */
return_trace
(
true
);
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
{
TRACE_SANITIZE
(
this
);
TRACE_SANITIZE
(
this
);
...
@@ -172,6 +197,15 @@ struct KerxSubTableFormat2
...
@@ -172,6 +197,15 @@ struct KerxSubTableFormat2
struct
KerxSubTableFormat4
struct
KerxSubTableFormat4
{
{
inline
bool
apply
(
hb_aat_apply_context_t
*
c
)
const
{
TRACE_APPLY
(
this
);
/* TODO */
return_trace
(
true
);
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
{
TRACE_SANITIZE
(
this
);
TRACE_SANITIZE
(
this
);
...
@@ -199,6 +233,15 @@ struct KerxSubTableFormat4
...
@@ -199,6 +233,15 @@ struct KerxSubTableFormat4
struct
KerxSubTableFormat6
struct
KerxSubTableFormat6
{
{
inline
bool
apply
(
hb_aat_apply_context_t
*
c
)
const
{
TRACE_APPLY
(
this
);
/* TODO */
return_trace
(
true
);
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
{
TRACE_SANITIZE
(
this
);
TRACE_SANITIZE
(
this
);
...
@@ -221,47 +264,55 @@ struct KerxSubTableFormat6
...
@@ -221,47 +264,55 @@ struct KerxSubTableFormat6
DEFINE_SIZE_STATIC
(
24
);
DEFINE_SIZE_STATIC
(
24
);
};
};
enum
coverage_flags_t
{
COVERAGE_VERTICAL_FLAG
=
0x80u
,
COVERAGE_CROSSSTREAM_FLAG
=
0x40u
,
COVERAGE_VARIATION_FLAG
=
0x20u
,
COVERAGE_PROCESS_DIRECTION
=
0x10u
,
};
struct
KerxTable
struct
KerxTable
{
{
inline
bool
apply
(
hb_aat_apply_context_t
*
c
,
const
AAT
::
ankr
*
ankr
)
const
inline
unsigned
int
get_size
(
void
)
const
{
return
length
;
}
inline
unsigned
int
get_type
(
void
)
const
{
return
coverage
&
SubtableType
;
}
enum
Coverage
{
{
TRACE_APPLY
(
this
);
Vertical
=
0x80000000
,
/* Set if table has vertical kerning values. */
/* TODO */
CrossStream
=
0x40000000
,
/* Set if table has cross-stream kerning values. */
return_trace
(
false
);
Variation
=
0x20000000
,
/* Set if table has variation kerning values. */
ProcessDirection
=
0x10000000
,
/* If clear, process the glyphs forwards, that
* is, from first to last in the glyph stream.
* If we, process them from last to first.
* This flag only applies to state-table based
* 'kerx' subtables (types 1 and 4). */
Reserved
=
0x0FFFFF00
,
/* Reserved, set to zero. */
SubtableType
=
0x000000FF
,
/* Subtable type. */
};
template
<
typename
context_t
>
inline
typename
context_t
::
return_t
dispatch
(
context_t
*
c
)
const
{
unsigned
int
subtable_type
=
get_type
();
TRACE_DISPATCH
(
this
,
subtable_type
);
switch
(
subtable_type
)
{
case
0
:
return_trace
(
c
->
dispatch
(
u
.
format0
));
case
1
:
return_trace
(
c
->
dispatch
(
u
.
format1
));
case
2
:
return_trace
(
c
->
dispatch
(
u
.
format2
));
case
4
:
return_trace
(
c
->
dispatch
(
u
.
format4
));
case
6
:
return_trace
(
c
->
dispatch
(
u
.
format6
));
default:
return_trace
(
c
->
default_return_value
());
}
}
}
inline
unsigned
int
get_size
(
void
)
const
{
return
length
;
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
{
TRACE_SANITIZE
(
this
);
TRACE_SANITIZE
(
this
);
if
(
unlikely
(
!
c
->
check_struct
(
this
)))
if
(
!
length
.
sanitize
(
c
)
||
length
<
min_size
||
!
c
->
check_range
(
this
,
length
))
return_trace
(
false
);
return_trace
(
false
);
switch
(
format
)
{
return_trace
(
dispatch
(
c
));
case
0
:
return
u
.
format0
.
sanitize
(
c
);
case
1
:
return
u
.
format1
.
sanitize
(
c
);
case
2
:
return
u
.
format2
.
sanitize
(
c
);
case
4
:
return
u
.
format4
.
sanitize
(
c
);
case
6
:
return
u
.
format6
.
sanitize
(
c
);
default:
return_trace
(
false
);
}
}
}
protected:
protected:
HBUINT32
length
;
HBUINT32
length
;
HBUINT8
coverage
;
HBUINT32
coverage
;
HBUINT16
unused
;
HBUINT32
tupleCount
;
HBUINT8
format
;
HBUINT32
tupleIndex
;
union
{
union
{
KerxSubTableFormat0
format0
;
KerxSubTableFormat0
format0
;
KerxSubTableFormat1
format1
;
KerxSubTableFormat1
format1
;
...
@@ -273,7 +324,7 @@ public:
...
@@ -273,7 +324,7 @@ public:
DEFINE_SIZE_MIN
(
12
);
DEFINE_SIZE_MIN
(
12
);
};
};
struct
Subtable
GlyphCoverageArray
struct
Subtable
XXX
{
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
{
...
@@ -289,55 +340,59 @@ struct SubtableGlyphCoverageArray
...
@@ -289,55 +340,59 @@ struct SubtableGlyphCoverageArray
DEFINE_SIZE_STATIC
(
12
);
DEFINE_SIZE_STATIC
(
12
);
};
};
/*
* The 'kerx' Table
*/
struct
kerx
struct
kerx
{
{
static
const
hb_tag_t
tableTag
=
HB_AAT_TAG_kerx
;
static
const
hb_tag_t
tableTag
=
HB_AAT_TAG_kerx
;
inline
bool
apply
(
hb_aat_apply_context_t
*
c
,
const
AAT
::
ankr
*
ankr
)
const
inline
bool
has_data
(
void
)
const
{
return
version
!=
0
;
}
inline
void
apply
(
hb_aat_apply_context_t
*
c
)
const
{
{
TRACE_APPLY
(
this
);
c
->
set_lookup_index
(
0
);
const
KerxTable
&
table
=
StructAfter
<
KerxTable
>
(
*
this
);
const
KerxTable
*
table
=
&
firstTable
;
return_trace
(
table
.
apply
(
c
,
ankr
));
unsigned
int
count
=
tableCount
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
{
table
->
dispatch
(
c
);
table
=
&
StructAfter
<
KerxTable
>
(
*
table
);
}
}
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
{
TRACE_SANITIZE
(
this
);
TRACE_SANITIZE
(
this
);
if
(
unlikely
(
!
(
c
->
check_struct
(
this
))))
if
(
!
version
.
sanitize
(
c
)
||
version
<
2
||
return_trace
(
false
);
!
tableCount
.
sanitize
(
c
))
/* TODO: Something like `morx`s ChainSubtable should be done here instead */
const
KerxTable
*
table
=
&
StructAfter
<
KerxTable
>
(
*
this
);
if
(
unlikely
(
!
(
table
->
sanitize
(
c
))))
return_trace
(
false
);
return_trace
(
false
);
for
(
unsigned
int
i
=
0
;
i
<
nTables
-
1
;
++
i
)
const
KerxTable
*
table
=
&
firstTable
;
unsigned
int
count
=
tableCount
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
{
{
if
(
!
table
->
sanitize
(
c
))
return_trace
(
false
);
table
=
&
StructAfter
<
KerxTable
>
(
*
table
);
table
=
&
StructAfter
<
KerxTable
>
(
*
table
);
if
(
unlikely
(
!
(
table
->
sanitize
(
c
))))
return_trace
(
false
);
}
}
// If version is less than 3, we are done here; otherwise better to check footer also
if
(
version
<
3
)
return_trace
(
true
);
// TODO: Investigate why this just work on some fonts no matter of version
// const SubtableGlyphCoverageArray &footer =
// StructAfter<SubtableGlyphCoverageArray> (*table);
// return_trace (footer.sanitize (c));
return_trace
(
true
);
return_trace
(
true
);
}
}
protected:
protected:
HBUINT16
version
;
HBUINT16
version
;
/* The version number of the extended kerning table
HBUINT16
padding
;
* (currently 2, 3, or 4). */
HBUINT32
nTables
;
HBUINT16
unused
;
/* Set to 0. */
/*KerxTable tablesZ[VAR]; XXX ArrayOf??? */
HBUINT32
tableCount
;
/* The number of subtables included in the extended kerning
/*SubtableGlyphCoverageArray coverage_array;*/
* table. */
KerxTable
firstTable
;
/* Subtables. */
/*subtableGlyphCoverageArray*/
/* Only if version >= 3. We don't use. */
public:
public:
DEFINE_SIZE_
STATIC
(
8
);
DEFINE_SIZE_
MIN
(
8
);
};
};
}
/* namespace AAT */
}
/* namespace AAT */
...
...
src/hb-aat-layout-morx-table.hh
浏览文件 @
fdce1e15
...
@@ -940,7 +940,7 @@ struct Chain
...
@@ -940,7 +940,7 @@ struct Chain
/*
/*
* The 'mor
t'/'morx' Tables
* The 'mor
x' Table
*/
*/
struct
morx
struct
morx
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录