Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
e6f283ed
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看板
提交
e6f283ed
编写于
1月 19, 2018
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[aat] Implement LigatureSubtable
We form the Zapfino ligature now. Yay! No further testing done.
上级
f07ce661
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
115 addition
and
18 deletion
+115
-18
src/hb-aat-layout-common-private.hh
src/hb-aat-layout-common-private.hh
+16
-9
src/hb-aat-layout-morx-table.hh
src/hb-aat-layout-morx-table.hh
+99
-9
未找到文件。
src/hb-aat-layout-common-private.hh
浏览文件 @
e6f283ed
...
@@ -627,23 +627,26 @@ struct StateTableDriver
...
@@ -627,23 +627,26 @@ struct StateTableDriver
inline
void
drive
(
context_t
*
c
)
inline
void
drive
(
context_t
*
c
)
{
{
hb_glyph_info_t
*
info
=
buffer
->
info
;
hb_glyph_info_t
*
info
=
buffer
->
info
;
unsigned
int
count
=
buffer
->
len
;
if
(
!
c
->
in_place
)
buffer
->
clear_output
();
unsigned
int
state
=
0
;
unsigned
int
state
=
0
;
bool
last_was_dont_advance
=
false
;
bool
last_was_dont_advance
=
false
;
for
(
buffer
->
idx
=
0
;
buffer
->
idx
<=
count
;)
for
(
buffer
->
idx
=
0
;;)
{
{
if
(
!
state
)
if
(
!
state
)
last_zero
=
buffer
->
idx
;
last_zero
=
buffer
->
idx
;
unsigned
int
klass
=
buffer
->
idx
<
count
?
unsigned
int
klass
=
buffer
->
idx
<
buffer
->
len
?
machine
.
get_class
(
info
[
buffer
->
idx
].
codepoint
,
num_glyphs
)
:
machine
.
get_class
(
info
[
buffer
->
idx
].
codepoint
,
num_glyphs
)
:
0
/* End of text */
;
0
/* End of text */
;
const
Entry
<
EntryData
>
*
entry
=
machine
.
get_entryZ
(
state
,
klass
);
const
Entry
<
EntryData
>
*
entry
=
machine
.
get_entryZ
(
state
,
klass
);
if
(
unlikely
(
!
entry
))
if
(
unlikely
(
!
entry
))
break
;
break
;
c
->
transition
(
this
,
entry
);
if
(
unlikely
(
!
c
->
transition
(
this
,
entry
)))
break
;
if
(
entry
->
flags
&
context_t
::
DontAdvance
)
if
(
entry
->
flags
&
context_t
::
DontAdvance
)
{
{
...
@@ -655,7 +658,7 @@ struct StateTableDriver
...
@@ -655,7 +658,7 @@ struct StateTableDriver
dont_advance_set
=
hb_set_create
();
dont_advance_set
=
hb_set_create
();
}
}
unsigned
int
key
=
info
[
buffer
->
idx
].
codepoint
|
(
state
<<
16
);
unsigned
int
key
=
info
[
buffer
->
idx
].
codepoint
^
(
state
<<
16
);
if
(
likely
(
!
dont_advance_set
->
has
(
key
)))
if
(
likely
(
!
dont_advance_set
->
has
(
key
)))
{
{
dont_advance_set
->
add
(
key
);
dont_advance_set
->
add
(
key
);
...
@@ -667,16 +670,20 @@ struct StateTableDriver
...
@@ -667,16 +670,20 @@ struct StateTableDriver
else
else
last_was_dont_advance
=
false
;
last_was_dont_advance
=
false
;
state
=
entry
->
newState
;
if
(
buffer
->
idx
==
buffer
->
len
)
break
;
if
(
!
last_was_dont_advance
)
if
(
!
last_was_dont_advance
)
buffer
->
next_glyph
();
buffer
->
next_glyph
();
state
=
entry
->
newState
;
}
}
if
(
!
c
->
in_place
)
if
(
!
c
->
in_place
)
{
{
for
(
buffer
->
idx
=
0
;
buffer
->
idx
<=
count
;)
for
(
;
buffer
->
idx
<
buffer
->
len
;)
buffer
->
next_glyph
();
buffer
->
next_glyph
();
buffer
->
swap_buffers
();
}
}
}
}
...
...
src/hb-aat-layout-morx-table.hh
浏览文件 @
e6f283ed
...
@@ -61,7 +61,7 @@ struct RearrangementSubtable
...
@@ -61,7 +61,7 @@ struct RearrangementSubtable
start
(
0
),
end
(
0
),
start
(
0
),
end
(
0
),
last_zero_before_start
(
0
)
{}
last_zero_before_start
(
0
)
{}
inline
void
transition
(
StateTableDriver
<
void
>
*
driver
,
inline
bool
transition
(
StateTableDriver
<
void
>
*
driver
,
const
Entry
<
void
>
*
entry
)
const
Entry
<
void
>
*
entry
)
{
{
hb_buffer_t
*
buffer
=
driver
->
buffer
;
hb_buffer_t
*
buffer
=
driver
->
buffer
;
...
@@ -138,6 +138,8 @@ struct RearrangementSubtable
...
@@ -138,6 +138,8 @@ struct RearrangementSubtable
}
}
}
}
}
}
return
true
;
}
}
public:
public:
...
@@ -200,7 +202,7 @@ struct ContextualSubtable
...
@@ -200,7 +202,7 @@ struct ContextualSubtable
last_zero_before_mark
(
0
),
last_zero_before_mark
(
0
),
subs
(
table
+
table
->
substitutionTables
)
{}
subs
(
table
+
table
->
substitutionTables
)
{}
inline
void
transition
(
StateTableDriver
<
EntryData
>
*
driver
,
inline
bool
transition
(
StateTableDriver
<
EntryData
>
*
driver
,
const
Entry
<
EntryData
>
*
entry
)
const
Entry
<
EntryData
>
*
entry
)
{
{
hb_buffer_t
*
buffer
=
driver
->
buffer
;
hb_buffer_t
*
buffer
=
driver
->
buffer
;
...
@@ -235,6 +237,8 @@ struct ContextualSubtable
...
@@ -235,6 +237,8 @@ struct ContextualSubtable
ret
=
true
;
ret
=
true
;
}
}
}
}
return
true
;
}
}
public:
public:
...
@@ -309,28 +313,113 @@ struct LigatureSubtable
...
@@ -309,28 +313,113 @@ struct LigatureSubtable
* group. */
* group. */
Reserved
=
0x1FFF
,
/* These bits are reserved and should be set to 0. */
Reserved
=
0x1FFF
,
/* These bits are reserved and should be set to 0. */
};
};
enum
LigActionFlags
{
LigActionLast
=
0x80000000
,
/* This is the last action in the list. This also
* implies storage. */
LigActionStore
=
0x40000000
,
/* Store the ligature at the current cumulated index
* in the ligature table in place of the marked
* (i.e. currently-popped) glyph. */
LigActionOffset
=
0x3FFFFFFF
,
/* A 30-bit value which is sign-extended to 32-bits
* and added to the glyph ID, resulting in an index
* into the component table. */
};
inline
driver_context_t
(
const
LigatureSubtable
*
table
)
:
inline
driver_context_t
(
const
LigatureSubtable
*
table
,
ret
(
false
)
{}
hb_aat_apply_context_t
*
c_
)
:
ret
(
false
),
c
(
c_
),
ligAction
(
table
+
table
->
ligAction
),
component
(
table
+
table
->
component
),
ligature
(
table
+
table
->
ligature
),
match_length
(
0
)
{}
inline
void
transition
(
StateTableDriver
<
EntryData
>
*
driver
,
inline
bool
transition
(
StateTableDriver
<
EntryData
>
*
driver
,
const
Entry
<
EntryData
>
*
entry
)
const
Entry
<
EntryData
>
*
entry
)
{
{
hb_buffer_t
*
buffer
=
driver
->
buffer
;
hb_buffer_t
*
buffer
=
driver
->
buffer
;
unsigned
int
flags
=
entry
->
flags
;
if
(
flags
&
SetComponent
)
{
if
(
unlikely
(
match_length
>=
ARRAY_LENGTH
(
match_positions
)))
return
false
;
/* Never mark same index twice, in case DontAdvance was used... */
if
(
match_length
&&
match_positions
[
match_length
-
1
]
==
buffer
->
out_len
)
match_length
--
;
match_positions
[
match_length
++
]
=
buffer
->
out_len
;
}
if
(
flags
&
PerformAction
)
{
unsigned
int
end
=
buffer
->
out_len
;
unsigned
int
action_idx
=
entry
->
data
.
ligActionIndex
;
unsigned
int
action
;
unsigned
int
ligature_idx
=
0
;
do
{
if
(
unlikely
(
!
match_length
))
return
false
;
buffer
->
move_to
(
match_positions
[
match_length
-
1
]);
/* TODO */
const
HBUINT32
&
actionData
=
ligAction
[
action_idx
];
if
(
unlikely
(
!
actionData
.
sanitize
(
&
c
->
sanitizer
)))
return
false
;
action
=
actionData
;
uint32_t
uoffset
=
action
&
LigActionOffset
;
if
(
uoffset
&
0x20000000
)
uoffset
+=
0xC0000000
;
int32_t
offset
=
(
int32_t
)
uoffset
;
unsigned
int
component_idx
=
buffer
->
cur
().
codepoint
+
offset
;
const
HBUINT16
&
componentData
=
component
[
component_idx
];
if
(
unlikely
(
!
componentData
.
sanitize
(
&
c
->
sanitizer
)))
return
false
;
ligature_idx
+=
componentData
;
if
(
action
&
(
LigActionStore
|
LigActionLast
))
{
const
GlyphID
&
ligatureData
=
ligature
[
ligature_idx
];
if
(
unlikely
(
!
ligatureData
.
sanitize
(
&
c
->
sanitizer
)))
return
false
;
hb_codepoint_t
lig
=
ligatureData
;
buffer
->
replace_glyph
(
lig
);
//ligature_idx = 0; // XXX Yes or no?
}
else
{
buffer
->
skip_glyph
();
end
--
;
}
match_length
--
;
action_idx
++
;
}
while
(
!
(
action
&
LigActionLast
));
buffer
->
move_to
(
end
);
}
return
true
;
}
}
public:
public:
bool
ret
;
bool
ret
;
private:
private:
hb_aat_apply_context_t
*
c
;
const
UnsizedArrayOf
<
HBUINT32
>
&
ligAction
;
const
UnsizedArrayOf
<
HBUINT16
>
&
component
;
const
UnsizedArrayOf
<
GlyphID
>
&
ligature
;
unsigned
int
match_length
;
unsigned
int
match_positions
[
HB_MAX_CONTEXT_LENGTH
];
};
};
inline
bool
apply
(
hb_aat_apply_context_t
*
c
)
const
inline
bool
apply
(
hb_aat_apply_context_t
*
c
)
const
{
{
TRACE_APPLY
(
this
);
TRACE_APPLY
(
this
);
driver_context_t
dc
(
this
);
driver_context_t
dc
(
this
,
c
);
StateTableDriver
<
EntryData
>
driver
(
machine
,
c
->
buffer
,
c
->
face
);
StateTableDriver
<
EntryData
>
driver
(
machine
,
c
->
buffer
,
c
->
face
);
driver
.
drive
(
&
dc
);
driver
.
drive
(
&
dc
);
...
@@ -341,8 +430,9 @@ struct LigatureSubtable
...
@@ -341,8 +430,9 @@ struct LigatureSubtable
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
{
TRACE_SANITIZE
(
this
);
TRACE_SANITIZE
(
this
);
/* The main sanitization is done at run-time. */
/* The rest of array sanitizations are done at run-time. */
return
machine
.
sanitize
(
c
);
return
c
->
check_struct
(
this
)
&&
machine
.
sanitize
(
c
)
&&
ligAction
&&
component
&&
ligature
;
return_trace
(
true
);
return_trace
(
true
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录