Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
bb3899a5
T
Third Party Harfbuzz
项目概览
OpenHarmony
/
Third Party Harfbuzz
10 个月 前同步成功
通知
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,体验更适合开发者的 AI 搜索 >>
提交
bb3899a5
编写于
5月 05, 2009
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[GSUB] Implement ligature substitutions
上级
38b011a2
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
93 addition
and
22 deletion
+93
-22
src/Makefile.am
src/Makefile.am
+2
-0
src/hb-ot-layout-gsub-private.h
src/hb-ot-layout-gsub-private.h
+91
-22
未找到文件。
src/Makefile.am
浏览文件 @
bb3899a5
...
@@ -57,6 +57,8 @@ harfbuzz_dump_LDADD = \
...
@@ -57,6 +57,8 @@ harfbuzz_dump_LDADD = \
$(libharfbuzz_1_la_LIBADD)
\
$(libharfbuzz_1_la_LIBADD)
\
libharfbuzz-1.la
libharfbuzz-1.la
main_SOURCES
=
\
main.cc
main_LDADD
=
\
main_LDADD
=
\
$(GLIB_LIBS)
$(GLIB_LIBS)
...
...
src/hb-ot-layout-gsub-private.h
浏览文件 @
bb3899a5
...
@@ -44,7 +44,7 @@
...
@@ -44,7 +44,7 @@
hb_ot_layout_t *layout, \
hb_ot_layout_t *layout, \
hb_buffer_t *buffer, \
hb_buffer_t *buffer, \
unsigned int context_length, \
unsigned int context_length, \
unsigned int nesting_level_left, \
unsigned int nesting_level_left
HB_GNUC_UNUSED
, \
unsigned int lookup_flag
unsigned int lookup_flag
#define SUBTABLE_SUBSTITUTE_ARGS \
#define SUBTABLE_SUBSTITUTE_ARGS \
layout, \
layout, \
...
@@ -135,8 +135,6 @@ struct SingleSubst {
...
@@ -135,8 +135,6 @@ struct SingleSubst {
inline
bool
substitute
(
SUBTABLE_SUBSTITUTE_ARGS_DEF
)
const
{
inline
bool
substitute
(
SUBTABLE_SUBSTITUTE_ARGS_DEF
)
const
{
HB_UNUSED
(
nesting_level_left
);
if
(
HB_UNLIKELY
(
context_length
<
1
))
if
(
HB_UNLIKELY
(
context_length
<
1
))
return
false
;
return
false
;
...
@@ -205,8 +203,6 @@ struct MultipleSubstFormat1 {
...
@@ -205,8 +203,6 @@ struct MultipleSubstFormat1 {
inline
bool
substitute
(
SUBTABLE_SUBSTITUTE_ARGS_DEF
)
const
{
inline
bool
substitute
(
SUBTABLE_SUBSTITUTE_ARGS_DEF
)
const
{
HB_UNUSED
(
nesting_level_left
);
if
(
HB_UNLIKELY
(
context_length
<
1
))
if
(
HB_UNLIKELY
(
context_length
<
1
))
return
false
;
return
false
;
...
@@ -307,8 +303,6 @@ struct AlternateSubstFormat1 {
...
@@ -307,8 +303,6 @@ struct AlternateSubstFormat1 {
inline
bool
substitute
(
SUBTABLE_SUBSTITUTE_ARGS_DEF
)
const
{
inline
bool
substitute
(
SUBTABLE_SUBSTITUTE_ARGS_DEF
)
const
{
HB_UNUSED
(
nesting_level_left
);
if
(
HB_UNLIKELY
(
context_length
<
1
))
if
(
HB_UNLIKELY
(
context_length
<
1
))
return
false
;
return
false
;
...
@@ -392,7 +386,77 @@ DEFINE_NULL (AlternateSubst, 2);
...
@@ -392,7 +386,77 @@ DEFINE_NULL (AlternateSubst, 2);
struct
Ligature
{
struct
Ligature
{
/* TODO */
friend
struct
LigatureSet
;
private:
DEFINE_ARRAY_TYPE
(
GlyphID
,
component
,
(
compCount
?
compCount
-
1
:
0
));
inline
bool
substitute_ligature
(
SUBTABLE_SUBSTITUTE_ARGS_DEF
,
bool
is_mark
)
const
{
unsigned
int
i
,
j
;
unsigned
int
property
;
unsigned
int
count
=
compCount
;
if
(
HB_UNLIKELY
(
buffer
->
in_pos
+
count
>
buffer
->
in_length
||
context_length
<
count
))
return
false
;
/* Not enough glyphs in input or context */
for
(
i
=
1
,
j
=
buffer
->
in_pos
+
1
;
i
<
count
;
i
++
,
j
++
)
{
while
(
!
_hb_ot_layout_check_glyph_property
(
layout
,
IN_ITEM
(
j
),
lookup_flag
,
&
property
))
{
if
(
HB_UNLIKELY
(
j
+
count
-
i
==
buffer
->
in_length
))
return
false
;
j
++
;
}
if
(
!
(
property
==
HB_OT_LAYOUT_GLYPH_CLASS_MARK
||
property
&
LookupFlag
::
MarkAttachmentType
))
is_mark
=
FALSE
;
if
(
HB_LIKELY
(
IN_GLYPH
(
j
)
!=
(
*
this
)[
i
-
1
]))
return
false
;
}
if
(
_hb_ot_layout_has_new_glyph_classes
(
layout
)
)
/* this is just a guess ... */
hb_ot_layout_set_glyph_class
(
layout
,
ligGlyph
,
is_mark
?
HB_OT_LAYOUT_GLYPH_CLASS_MARK
:
HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE
);
if
(
j
==
buffer
->
in_pos
+
i
)
/* No input glyphs skipped */
/* We don't use a new ligature ID if there are no skipped
glyphs and the ligature already has an ID. */
_hb_buffer_add_output_glyph_ids
(
buffer
,
i
,
1
,
&
ligGlyph
,
0xFFFF
,
IN_LIGID
(
buffer
->
in_pos
)
?
0xFFFF
:
_hb_buffer_allocate_ligid
(
buffer
));
else
{
unsigned
int
lig_id
=
_hb_buffer_allocate_ligid
(
buffer
);
_hb_buffer_add_output_glyph
(
buffer
,
ligGlyph
,
0xFFFF
,
lig_id
);
/* Now we must do a second loop to copy the skipped glyphs to
`out' and assign component values to it. We start with the
glyph after the first component. Glyphs between component
i and i+1 belong to component i. Together with the lig_id
value it is later possible to check whether a specific
component value really belongs to a given ligature. */
for
(
i
=
0
;
i
<
count
-
1
;
i
++
)
{
while
(
!
_hb_ot_layout_check_glyph_property
(
layout
,
IN_CURITEM
(),
lookup_flag
,
&
property
))
_hb_buffer_add_output_glyph
(
buffer
,
IN_CURGLYPH
(),
i
,
lig_id
);
(
buffer
->
in_pos
)
++
;
}
/* XXX We should possibly reassign lig_id and component for any
* components of a previous ligature that s now being removed as part of
* this ligature. */
}
return
true
;
}
private:
private:
GlyphID
ligGlyph
;
/* GlyphID of ligature to substitute */
GlyphID
ligGlyph
;
/* GlyphID of ligature to substitute */
...
@@ -404,7 +468,23 @@ struct Ligature {
...
@@ -404,7 +468,23 @@ struct Ligature {
DEFINE_NULL_ASSERT_SIZE
(
Ligature
,
4
);
DEFINE_NULL_ASSERT_SIZE
(
Ligature
,
4
);
struct
LigatureSet
{
struct
LigatureSet
{
/* TODO */
friend
struct
LigatureSubstFormat1
;
private:
DEFINE_OFFSET_ARRAY_TYPE
(
Ligature
,
ligature
,
ligatureCount
);
inline
bool
substitute_ligature
(
SUBTABLE_SUBSTITUTE_ARGS_DEF
,
bool
is_mark
)
const
{
unsigned
int
num_ligs
=
get_len
();
for
(
unsigned
int
i
=
0
;
i
<
num_ligs
;
i
++
)
{
const
Ligature
&
lig
=
(
*
this
)[
i
];
if
(
lig
.
substitute_ligature
(
SUBTABLE_SUBSTITUTE_ARGS
,
is_mark
))
return
true
;
}
return
false
;
}
private:
private:
USHORT
ligatureCount
;
/* Number of Ligature tables */
USHORT
ligatureCount
;
/* Number of Ligature tables */
...
@@ -427,8 +507,6 @@ struct LigatureSubstFormat1 {
...
@@ -427,8 +507,6 @@ struct LigatureSubstFormat1 {
inline
bool
substitute
(
SUBTABLE_SUBSTITUTE_ARGS_DEF
)
const
{
inline
bool
substitute
(
SUBTABLE_SUBSTITUTE_ARGS_DEF
)
const
{
HB_UNUSED
(
nesting_level_left
);
unsigned
int
property
;
unsigned
int
property
;
if
(
!
_hb_ot_layout_check_glyph_property
(
layout
,
IN_CURITEM
(),
lookup_flag
,
&
property
))
if
(
!
_hb_ot_layout_check_glyph_property
(
layout
,
IN_CURITEM
(),
lookup_flag
,
&
property
))
return
false
;
return
false
;
...
@@ -437,20 +515,11 @@ struct LigatureSubstFormat1 {
...
@@ -437,20 +515,11 @@ struct LigatureSubstFormat1 {
unsigned
int
index
=
get_glyph_coverage
(
glyph_id
);
unsigned
int
index
=
get_glyph_coverage
(
glyph_id
);
const
LigatureSet
&
lig_set
=
(
*
this
)[
index
];
bool
first_is_mark
=
(
property
==
HB_OT_LAYOUT_GLYPH_CLASS_MARK
||
bool
first_is_mark
=
(
property
==
HB_OT_LAYOUT_GLYPH_CLASS_MARK
||
property
&
LookupFlag
::
MarkAttachmentType
);
property
&
LookupFlag
::
MarkAttachmentType
);
unsigned
int
num_sets
=
get_len
();
const
LigatureSet
&
lig_set
=
(
*
this
)[
index
];
for
(
unsigned
int
i
=
0
;
i
<
num_sets
;
i
++
)
{
return
lig_set
.
substitute_ligature
(
SUBTABLE_SUBSTITUTE_ARGS
,
first_is_mark
);
const
LigatureSet
&
lig_set
=
(
*
this
)[
i
];
}
return
false
;
}
}
private:
private:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录