Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
335a9c1f
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,发现更多精彩内容 >>
提交
335a9c1f
编写于
1月 11, 2018
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[aat] Towards implementing ContextualSubtable
上级
62348f64
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
117 addition
and
29 deletion
+117
-29
src/hb-aat-layout-common-private.hh
src/hb-aat-layout-common-private.hh
+55
-3
src/hb-aat-layout-morx-table.hh
src/hb-aat-layout-morx-table.hh
+62
-26
未找到文件。
src/hb-aat-layout-common-private.hh
浏览文件 @
335a9c1f
...
...
@@ -151,6 +151,7 @@ struct UnsizedArrayOf
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
,
unsigned
int
count
)
const
{
TRACE_SANITIZE
(
this
);
if
(
unlikely
(
!
sanitize_shallow
(
c
,
count
)))
return_trace
(
false
);
/* Note: for structs that do not reference other structs,
* we do not need to call their sanitize() as we already did
...
...
@@ -159,8 +160,34 @@ struct UnsizedArrayOf
* pointed to do have a simple sanitize(), ie. they do not
* reference other structs via offsets.
*/
(
void
)
(
false
&&
count
&&
arrayZ
->
sanitize
(
c
));
(
void
)
(
false
&&
arrayZ
[
0
].
sanitize
(
c
));
return_trace
(
true
);
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
,
unsigned
int
count
,
const
void
*
base
)
const
{
TRACE_SANITIZE
(
this
);
if
(
unlikely
(
!
sanitize_shallow
(
c
,
count
)))
return_trace
(
false
);
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
if
(
unlikely
(
!
arrayZ
[
i
].
sanitize
(
c
,
base
)))
return_trace
(
false
);
return_trace
(
true
);
}
template
<
typename
T
>
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
,
unsigned
int
count
,
const
void
*
base
,
T
user_data
)
const
{
TRACE_SANITIZE
(
this
);
if
(
unlikely
(
!
sanitize_shallow
(
c
,
count
)))
return_trace
(
false
);
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
if
(
unlikely
(
!
arrayZ
[
i
].
sanitize
(
c
,
base
,
user_data
)))
return_trace
(
false
);
return_trace
(
true
);
}
private:
inline
bool
sanitize_shallow
(
hb_sanitize_context_t
*
c
,
unsigned
int
count
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_array
(
arrayZ
,
arrayZ
[
0
].
static_size
,
count
));
}
...
...
@@ -170,6 +197,32 @@ struct UnsizedArrayOf
DEFINE_SIZE_ARRAY
(
0
,
arrayZ
);
};
/* Unsized array of offset's */
template
<
typename
Type
,
typename
OffsetType
>
struct
UnsizedOffsetArrayOf
:
UnsizedArrayOf
<
OffsetTo
<
Type
,
OffsetType
>
>
{};
/* Unsized array of offsets relative to the beginning of the array itself. */
template
<
typename
Type
,
typename
OffsetType
>
struct
UnsizedOffsetListOf
:
UnsizedOffsetArrayOf
<
Type
,
OffsetType
>
{
inline
const
Type
&
operator
[]
(
unsigned
int
i
)
const
{
return
this
+
this
->
arrayZ
[
i
];
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
,
unsigned
int
count
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
((
UnsizedOffsetArrayOf
<
Type
,
OffsetType
>::
sanitize
(
c
,
count
,
this
)));
}
template
<
typename
T
>
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
,
unsigned
int
count
,
T
user_data
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
((
UnsizedOffsetArrayOf
<
Type
,
OffsetType
>::
sanitize
(
c
,
count
,
this
,
user_data
)));
}
};
/*
* Lookup Table
...
...
@@ -507,10 +560,9 @@ struct StateTable
return
&
entries
[
entry
];
/* XXX bound check. */
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
,
unsigned
int
num_glyphs
)
const
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
true
);
return_trace
(
c
->
check_struct
(
this
));
/* XXX */
}
...
...
src/hb-aat-layout-morx-table.hh
浏览文件 @
335a9c1f
...
...
@@ -42,11 +42,17 @@ using namespace OT;
template
<
typename
Types
>
struct
RearrangementSubtable
{
enum
{
MarkFirst
=
0x8000
,
DontAdvance
=
0x4000
,
MarkLast
=
0x2000
,
Verb
=
0x000F
,
enum
Flags
{
MarkFirst
=
0x8000
,
/* If set, make the current glyph the first
* glyph to be rearranged. */
DontAdvance
=
0x4000
,
/* If set, don't advance to the next glyph
* before going to the new state. This means
* that the glyph index doesn't change, even
* if the glyph at that index has changed. */
MarkLast
=
0x2000
,
/* If set, make the current glyph the last
* glyph to be rearranged. */
Reserved
=
0x1FF0
,
/* These bits are reserved and should be set to 0. */
Verb
=
0x000F
,
/* The type of rearrangement specified. */
};
inline
bool
apply
(
hb_apply_context_t
*
c
)
const
...
...
@@ -161,7 +167,7 @@ struct RearrangementSubtable
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
machine
.
sanitize
(
c
,
0
/*XXX*/
));
return_trace
(
machine
.
sanitize
(
c
));
}
protected:
...
...
@@ -170,8 +176,27 @@ struct RearrangementSubtable
DEFINE_SIZE_MIN
(
2
);
};
template
<
typename
Types
>
struct
ContextualSubtable
{
typedef
typename
Types
::
HBUINT
HBUINT
;
enum
Flags
{
SetMark
=
0x8000
,
/* If set, make the current glyph the marked glyph. */
DontAdvance
=
0x4000
,
/* If set, don't advance to the next glyph before
* going to the new state. */
Reserved
=
0x3FFF
,
/* These bits are reserved and should be set to 0. */
};
/* XXX the following is different in mort: it's directly index to sublookups. */
struct
EntryData
{
HBUINT16
markIndex
;
/* Index of the substitution table for the
* marked glyph (use 0xFFFF for none). */
HBUINT16
currentIndex
;
/* Index of the substitution table for the
* current glyph (use 0xFFFF for none). */
};
inline
bool
apply
(
hb_apply_context_t
*
c
)
const
{
TRACE_APPLY
(
this
);
...
...
@@ -182,11 +207,19 @@ struct ContextualSubtable
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
/* TODO */
return_trace
(
false
);
return_trace
(
machine
.
sanitize
(
c
)
&&
substitutionTables
.
sanitize
(
c
,
this
,
0U
/*XXX count*/
)
);
}
protected:
StateTable
<
Types
,
EntryData
>
machine
;
OffsetTo
<
UnsizedOffsetListOf
<
Lookup
<
GlyphID
>
,
HBUINT
>
,
HBUINT
>
substitutionTables
;
public:
DEFINE_SIZE_MIN
(
2
);
};
template
<
typename
Types
>
struct
LigatureSubtable
{
inline
bool
apply
(
hb_apply_context_t
*
c
)
const
...
...
@@ -204,6 +237,7 @@ struct LigatureSubtable
}
};
template
<
typename
Types
>
struct
NoncontextualSubtable
{
inline
bool
apply
(
hb_apply_context_t
*
c
)
const
...
...
@@ -240,6 +274,7 @@ struct NoncontextualSubtable
DEFINE_SIZE_MIN
(
2
);
};
template
<
typename
Types
>
struct
InsertionSubtable
{
inline
bool
apply
(
hb_apply_context_t
*
c
)
const
...
...
@@ -334,12 +369,11 @@ struct ChainSubtable
HBUINT
coverage
;
/* Coverage flags and subtable type. */
HBUINT32
subFeatureFlags
;
/* The 32-bit mask identifying which subtable this is. */
union
{
RearrangementSubtable
<
Types
>
rearrangement
;
ContextualSubtable
contextual
;
LigatureSubtable
ligature
;
NoncontextualSubtable
noncontextual
;
InsertionSubtable
insertion
;
RearrangementSubtable
<
Types
>
rearrangement
;
ContextualSubtable
<
Types
>
contextual
;
LigatureSubtable
<
Types
>
ligature
;
NoncontextualSubtable
<
Types
>
noncontextual
;
InsertionSubtable
<
Types
>
insertion
;
}
u
;
public:
DEFINE_SIZE_MIN
(
2
*
sizeof
(
HBUINT
)
+
4
);
...
...
@@ -455,8 +489,22 @@ struct mortmorx
DEFINE_SIZE_MIN
(
8
);
};
struct
MortTypes
{
static
const
bool
extended
=
false
;
typedef
HBUINT16
HBUINT
;
typedef
HBUINT8
HBUSHORT
;
struct
ClassType
:
ClassTable
{
inline
unsigned
int
get_class
(
hb_codepoint_t
glyph_id
,
unsigned
int
num_glyphs
HB_UNUSED
)
const
{
return
ClassTable
::
get_class
(
glyph_id
);
}
};
};
struct
MorxTypes
{
static
const
bool
extended
=
true
;
typedef
HBUINT32
HBUINT
;
typedef
HBUINT16
HBUSHORT
;
struct
ClassType
:
Lookup
<
HBUINT16
>
...
...
@@ -468,18 +516,6 @@ struct MorxTypes
}
};
};
struct
MortTypes
{
typedef
HBUINT16
HBUINT
;
typedef
HBUINT8
HBUSHORT
;
struct
ClassType
:
ClassTable
{
inline
unsigned
int
get_class
(
hb_codepoint_t
glyph_id
,
unsigned
int
num_glyphs
HB_UNUSED
)
const
{
return
ClassTable
::
get_class
(
glyph_id
);
}
};
};
struct
mort
:
mortmorx
<
MortTypes
>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录