Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
f94b0aa6
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,发现更多精彩内容 >>
提交
f94b0aa6
编写于
4月 23, 2012
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add "closure" operation stubs to GSUB
Filling in.
上级
7d50d502
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
293 addition
and
4 deletion
+293
-4
src/hb-ot-layout-gsub-table.hh
src/hb-ot-layout-gsub-table.hh
+179
-0
src/hb-ot-layout-gsubgpos-private.hh
src/hb-ot-layout-gsubgpos-private.hh
+106
-4
src/hb-ot-layout.cc
src/hb-ot-layout.cc
+8
-0
未找到文件。
src/hb-ot-layout-gsub-table.hh
浏览文件 @
f94b0aa6
...
...
@@ -39,6 +39,13 @@ struct SingleSubstFormat1
private:
inline
bool
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
/* TODO FILLME */
return
false
;
}
inline
bool
would_apply
(
hb_codepoint_t
glyph_id
)
const
{
return
(
this
+
coverage
)
(
glyph_id
)
!=
NOT_COVERED
;
...
...
@@ -83,6 +90,13 @@ struct SingleSubstFormat2
private:
inline
bool
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
/* TODO FILLME */
return
false
;
}
inline
bool
would_apply
(
hb_codepoint_t
glyph_id
)
const
{
return
(
this
+
coverage
)
(
glyph_id
)
!=
NOT_COVERED
;
...
...
@@ -129,6 +143,16 @@ struct SingleSubst
private:
inline
bool
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
switch
(
u
.
format
)
{
case
1
:
return
u
.
format1
.
closure
(
c
);
case
2
:
return
u
.
format2
.
closure
(
c
);
default:
return
false
;
}
}
inline
bool
would_apply
(
hb_codepoint_t
glyph_id
)
const
{
switch
(
u
.
format
)
{
...
...
@@ -172,6 +196,14 @@ struct Sequence
friend
struct
MultipleSubstFormat1
;
private:
inline
bool
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
/* TODO FILLME */
return
false
;
}
inline
bool
apply
(
hb_apply_context_t
*
c
)
const
{
TRACE_APPLY
();
...
...
@@ -204,6 +236,13 @@ struct MultipleSubstFormat1
private:
inline
bool
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
/* TODO FILLME */
return
false
;
}
inline
bool
would_apply
(
hb_codepoint_t
glyph_id
)
const
{
return
(
this
+
coverage
)
(
glyph_id
)
!=
NOT_COVERED
;
...
...
@@ -244,6 +283,15 @@ struct MultipleSubst
private:
inline
bool
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
switch
(
u
.
format
)
{
case
1
:
return
u
.
format1
.
closure
(
c
);
default:
return
false
;
}
}
inline
bool
would_apply
(
hb_codepoint_t
glyph_id
)
const
{
switch
(
u
.
format
)
{
...
...
@@ -287,6 +335,13 @@ struct AlternateSubstFormat1
private:
inline
bool
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
/* TODO FILLME */
return
false
;
}
inline
bool
would_apply
(
hb_codepoint_t
glyph_id
)
const
{
return
(
this
+
coverage
)
(
glyph_id
)
!=
NOT_COVERED
;
...
...
@@ -347,6 +402,15 @@ struct AlternateSubst
private:
inline
bool
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
switch
(
u
.
format
)
{
case
1
:
return
u
.
format1
.
closure
(
c
);
default:
return
false
;
}
}
inline
bool
would_apply
(
hb_codepoint_t
glyph_id
)
const
{
switch
(
u
.
format
)
{
...
...
@@ -387,6 +451,13 @@ struct Ligature
private:
inline
bool
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
/* TODO FILLME */
return
false
;
}
inline
bool
would_apply
(
hb_codepoint_t
second
)
const
{
return
component
.
len
==
2
&&
component
[
1
]
==
second
;
...
...
@@ -482,6 +553,13 @@ struct LigatureSet
private:
inline
bool
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
/* TODO FILLME */
return
false
;
}
inline
bool
would_apply
(
hb_codepoint_t
second
)
const
{
unsigned
int
num_ligs
=
ligature
.
len
;
...
...
@@ -528,6 +606,13 @@ struct LigatureSubstFormat1
private:
inline
bool
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
/* TODO FILLME */
return
false
;
}
inline
bool
would_apply
(
hb_codepoint_t
first
,
hb_codepoint_t
second
)
const
{
unsigned
int
index
;
...
...
@@ -572,6 +657,15 @@ struct LigatureSubst
private:
inline
bool
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
switch
(
u
.
format
)
{
case
1
:
return
u
.
format1
.
closure
(
c
);
default:
return
false
;
}
}
inline
bool
would_apply
(
hb_codepoint_t
first
,
hb_codepoint_t
second
)
const
{
switch
(
u
.
format
)
{
...
...
@@ -607,12 +701,20 @@ struct LigatureSubst
static
inline
bool
substitute_lookup
(
hb_apply_context_t
*
c
,
unsigned
int
lookup_index
);
static
inline
bool
closure_lookup
(
hb_closure_context_t
*
c
,
unsigned
int
lookup_index
);
struct
ContextSubst
:
Context
{
friend
struct
SubstLookupSubTable
;
private:
inline
bool
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
return
Context
::
closure
(
c
,
closure_lookup
);
}
inline
bool
apply
(
hb_apply_context_t
*
c
)
const
{
TRACE_APPLY
();
...
...
@@ -625,6 +727,13 @@ struct ChainContextSubst : ChainContext
friend
struct
SubstLookupSubTable
;
private:
inline
bool
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
return
ChainContext
::
closure
(
c
,
closure_lookup
);
}
inline
bool
apply
(
hb_apply_context_t
*
c
)
const
{
TRACE_APPLY
();
...
...
@@ -646,6 +755,13 @@ struct ExtensionSubst : Extension
return
StructAtOffset
<
SubstLookupSubTable
>
(
this
,
offset
);
}
inline
bool
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
/* TODO FILLME */
return
false
;
}
inline
bool
would_apply
(
hb_codepoint_t
glyph_id
)
const
;
inline
bool
would_apply
(
hb_codepoint_t
first
,
hb_codepoint_t
second
)
const
;
...
...
@@ -662,6 +778,14 @@ struct ReverseChainSingleSubstFormat1
friend
struct
ReverseChainSingleSubst
;
private:
inline
bool
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
/* TODO FILLME */
return
false
;
}
inline
bool
apply
(
hb_apply_context_t
*
c
)
const
{
TRACE_APPLY
();
...
...
@@ -728,6 +852,16 @@ struct ReverseChainSingleSubst
friend
struct
SubstLookupSubTable
;
private:
inline
bool
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
switch
(
u
.
format
)
{
case
1
:
return
u
.
format1
.
closure
(
c
);
default:
return
false
;
}
}
inline
bool
apply
(
hb_apply_context_t
*
c
)
const
{
TRACE_APPLY
();
...
...
@@ -774,6 +908,23 @@ struct SubstLookupSubTable
ReverseChainSingle
=
8
};
inline
bool
closure
(
hb_closure_context_t
*
c
,
unsigned
int
lookup_type
)
const
{
TRACE_CLOSURE
();
switch
(
lookup_type
)
{
case
Single
:
return
u
.
single
.
closure
(
c
);
case
Multiple
:
return
u
.
multiple
.
closure
(
c
);
case
Alternate
:
return
u
.
alternate
.
closure
(
c
);
case
Ligature
:
return
u
.
ligature
.
closure
(
c
);
case
Context
:
return
u
.
c
.
closure
(
c
);
case
ChainContext
:
return
u
.
chainContext
.
closure
(
c
);
case
Extension
:
return
u
.
extension
.
closure
(
c
);
case
ReverseChainSingle
:
return
u
.
reverseChainContextSingle
.
closure
(
c
);
default:
return
false
;
}
}
inline
bool
would_apply
(
hb_codepoint_t
glyph_id
,
unsigned
int
lookup_type
)
const
{
...
...
@@ -860,6 +1011,15 @@ struct SubstLookup : Lookup
return
lookup_type_is_reverse
(
type
);
}
inline
bool
closure
(
hb_closure_context_t
*
c
)
const
{
unsigned
int
lookup_type
=
get_type
();
unsigned
int
count
=
get_subtable_count
();
bool
ret
=
false
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
ret
=
get_subtable
(
i
).
closure
(
c
,
lookup_type
)
||
ret
;
return
ret
;
}
inline
bool
would_apply
(
hb_codepoint_t
glyph_id
)
const
{
...
...
@@ -984,6 +1144,10 @@ struct GSUB : GSUBGPOS
static
inline
void
substitute_start
(
hb_buffer_t
*
buffer
);
static
inline
void
substitute_finish
(
hb_buffer_t
*
buffer
);
inline
bool
closure_lookup
(
hb_closure_context_t
*
c
,
unsigned
int
lookup_index
)
const
{
return
get_lookup
(
lookup_index
).
closure
(
c
);
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
TRACE_SANITIZE
();
if
(
unlikely
(
!
GSUBGPOS
::
sanitize
(
c
)))
return
false
;
...
...
@@ -1048,6 +1212,21 @@ inline bool ExtensionSubst::is_reverse (void) const
return
SubstLookup
::
lookup_type_is_reverse
(
type
);
}
static
inline
bool
closure_lookup
(
hb_closure_context_t
*
c
,
unsigned
int
lookup_index
)
{
const
GSUB
&
gsub
=
*
(
c
->
face
->
ot_layout
->
gsub
);
const
SubstLookup
&
l
=
gsub
.
get_lookup
(
lookup_index
);
if
(
unlikely
(
c
->
nesting_level_left
==
0
))
return
false
;
c
->
nesting_level_left
--
;
bool
ret
=
l
.
closure
(
c
);
c
->
nesting_level_left
++
;
return
ret
;
}
static
inline
bool
substitute_lookup
(
hb_apply_context_t
*
c
,
unsigned
int
lookup_index
)
{
const
GSUB
&
gsub
=
*
(
c
->
face
->
ot_layout
->
gsub
);
...
...
src/hb-ot-layout-gsubgpos-private.hh
浏览文件 @
f94b0aa6
...
...
@@ -31,6 +31,8 @@
#include "hb-buffer-private.hh"
#include "hb-ot-layout-gdef-table.hh"
#include "hb-ot-layout-closure.h"
/* buffer var allocations */
...
...
@@ -45,6 +47,35 @@ static inline uint8_t allocate_lig_id (hb_buffer_t *buffer) {
#ifndef HB_DEBUG_CLOSURE
#define HB_DEBUG_CLOSURE (HB_DEBUG+0)
#endif
#define TRACE_CLOSURE() \
hb_auto_trace_t<HB_DEBUG_CLOSURE> trace (&c->debug_depth, "CLOSURE", this, NULL, HB_FUNC);
struct
hb_closure_context_t
{
hb_face_t
*
face
;
hb_glyph_map_t
*
glyphs
;
unsigned
int
nesting_level_left
;
unsigned
int
debug_depth
;
hb_closure_context_t
(
hb_face_t
*
face_
,
hb_glyph_map_t
*
glyphs_
,
unsigned
int
nesting_level_left_
=
MAX_NESTING_LEVEL
)
:
face
(
face_
),
glyphs
(
glyphs_
),
nesting_level_left
(
nesting_level_left_
),
debug_depth
(
0
)
{}
};
typedef
bool
(
*
closure_lookup_func_t
)
(
hb_closure_context_t
*
c
,
unsigned
int
lookup_index
);
#ifndef HB_DEBUG_APPLY
#define HB_DEBUG_APPLY (HB_DEBUG+0)
#endif
...
...
@@ -56,7 +87,6 @@ static inline uint8_t allocate_lig_id (hb_buffer_t *buffer) {
struct
hb_apply_context_t
{
unsigned
int
debug_depth
;
hb_font_t
*
font
;
hb_face_t
*
face
;
hb_buffer_t
*
buffer
;
...
...
@@ -66,6 +96,7 @@ struct hb_apply_context_t
unsigned
int
nesting_level_left
;
unsigned
int
lookup_props
;
unsigned
int
property
;
/* propety of first glyph */
unsigned
int
debug_depth
;
hb_apply_context_t
(
hb_font_t
*
font_
,
...
...
@@ -81,7 +112,7 @@ struct hb_apply_context_t
context_length
(
context_length_
),
nesting_level_left
(
nesting_level_left_
),
lookup_props
(
l
.
get_props
()),
property
(
0
)
{}
property
(
0
)
,
debug_depth
(
0
)
{}
hb_apply_context_t
(
const
hb_apply_context_t
&
c
,
const
Lookup
&
l
)
{
*
this
=
c
;
...
...
@@ -478,6 +509,14 @@ struct ContextFormat1
friend
struct
Context
;
private:
inline
bool
closure
(
hb_closure_context_t
*
c
,
closure_lookup_func_t
closure_func
)
const
{
TRACE_CLOSURE
();
/* TODO FILLME */
return
false
;
}
inline
bool
apply
(
hb_apply_context_t
*
c
,
apply_lookup_func_t
apply_func
)
const
{
TRACE_APPLY
();
...
...
@@ -517,6 +556,14 @@ struct ContextFormat2
friend
struct
Context
;
private:
inline
bool
closure
(
hb_closure_context_t
*
c
,
closure_lookup_func_t
closure_func
)
const
{
TRACE_CLOSURE
();
/* TODO FILLME */
return
false
;
}
inline
bool
apply
(
hb_apply_context_t
*
c
,
apply_lookup_func_t
apply_func
)
const
{
TRACE_APPLY
();
...
...
@@ -562,6 +609,14 @@ struct ContextFormat3
friend
struct
Context
;
private:
inline
bool
closure
(
hb_closure_context_t
*
c
,
closure_lookup_func_t
closure_func
)
const
{
TRACE_CLOSURE
();
/* TODO FILLME */
return
false
;
}
inline
bool
apply
(
hb_apply_context_t
*
c
,
apply_lookup_func_t
apply_func
)
const
{
TRACE_APPLY
();
...
...
@@ -608,6 +663,18 @@ struct ContextFormat3
struct
Context
{
protected:
inline
bool
closure
(
hb_closure_context_t
*
c
,
closure_lookup_func_t
closure_func
)
const
{
TRACE_CLOSURE
();
switch
(
u
.
format
)
{
case
1
:
return
u
.
format1
.
closure
(
c
,
closure_func
);
case
2
:
return
u
.
format2
.
closure
(
c
,
closure_func
);
case
3
:
return
u
.
format3
.
closure
(
c
,
closure_func
);
default:
return
false
;
}
}
inline
bool
apply
(
hb_apply_context_t
*
c
,
apply_lookup_func_t
apply_func
)
const
{
TRACE_APPLY
();
...
...
@@ -765,6 +832,14 @@ struct ChainContextFormat1
friend
struct
ChainContext
;
private:
inline
bool
closure
(
hb_closure_context_t
*
c
,
closure_lookup_func_t
closure_func
)
const
{
TRACE_CLOSURE
();
/* TODO FILLME */
return
false
;
}
inline
bool
apply
(
hb_apply_context_t
*
c
,
apply_lookup_func_t
apply_func
)
const
{
TRACE_APPLY
();
...
...
@@ -803,6 +878,14 @@ struct ChainContextFormat2
friend
struct
ChainContext
;
private:
inline
bool
closure
(
hb_closure_context_t
*
c
,
closure_lookup_func_t
closure_func
)
const
{
TRACE_CLOSURE
();
/* TODO FILLME */
return
false
;
}
inline
bool
apply
(
hb_apply_context_t
*
c
,
apply_lookup_func_t
apply_func
)
const
{
TRACE_APPLY
();
...
...
@@ -864,6 +947,13 @@ struct ChainContextFormat3
private:
inline
bool
closure
(
hb_closure_context_t
*
c
,
closure_lookup_func_t
closure_func
)
const
{
TRACE_CLOSURE
();
/* TODO FILLME */
return
false
;
}
inline
bool
apply
(
hb_apply_context_t
*
c
,
apply_lookup_func_t
apply_func
)
const
{
TRACE_APPLY
();
...
...
@@ -922,6 +1012,18 @@ struct ChainContextFormat3
struct
ChainContext
{
protected:
inline
bool
closure
(
hb_closure_context_t
*
c
,
closure_lookup_func_t
closure_func
)
const
{
TRACE_CLOSURE
();
switch
(
u
.
format
)
{
case
1
:
return
u
.
format1
.
closure
(
c
,
closure_func
);
case
2
:
return
u
.
format2
.
closure
(
c
,
closure_func
);
case
3
:
return
u
.
format3
.
closure
(
c
,
closure_func
);
default:
return
false
;
}
}
inline
bool
apply
(
hb_apply_context_t
*
c
,
apply_lookup_func_t
apply_func
)
const
{
TRACE_APPLY
();
...
...
src/hb-ot-layout.cc
浏览文件 @
f94b0aa6
...
...
@@ -469,6 +469,14 @@ hb_ot_layout_substitute_finish (hb_buffer_t *buffer HB_UNUSED)
GSUB
::
substitute_finish
(
buffer
);
}
hb_bool_t
hb_ot_layout_closure_lookup
(
hb_face_t
*
face
,
hb_glyph_map_t
*
glyphs
,
unsigned
int
lookup_index
)
{
hb_closure_context_t
c
(
face
,
glyphs
);
return
_get_gsub
(
face
).
closure_lookup
(
&
c
,
lookup_index
);
}
/*
* GPOS
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录