Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
ac8cd511
T
Third Party Harfbuzz
项目概览
OpenHarmony
/
Third Party Harfbuzz
12 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
ac8cd511
编写于
10月 18, 2013
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Refactor
上级
0f3fe37f
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
145 addition
and
117 deletion
+145
-117
src/hb-ot-layout-gpos-table.hh
src/hb-ot-layout-gpos-table.hh
+65
-55
src/hb-ot-layout.cc
src/hb-ot-layout.cc
+16
-15
src/hb-ot-shape-normalize.cc
src/hb-ot-shape-normalize.cc
+16
-13
src/hb-ot-shape.cc
src/hb-ot-shape.cc
+48
-34
未找到文件。
src/hb-ot-layout-gpos-table.hh
浏览文件 @
ac8cd511
...
@@ -390,6 +390,7 @@ struct MarkArray : ArrayOf<MarkRecord> /* Array of MarkRecords--in Coverage orde
...
@@ -390,6 +390,7 @@ struct MarkArray : ArrayOf<MarkRecord> /* Array of MarkRecords--in Coverage orde
unsigned
int
glyph_pos
)
const
unsigned
int
glyph_pos
)
const
{
{
TRACE_APPLY
(
this
);
TRACE_APPLY
(
this
);
hb_buffer_t
*
buffer
=
c
->
buffer
;
const
MarkRecord
&
record
=
ArrayOf
<
MarkRecord
>::
operator
[](
mark_index
);
const
MarkRecord
&
record
=
ArrayOf
<
MarkRecord
>::
operator
[](
mark_index
);
unsigned
int
mark_class
=
record
.
klass
;
unsigned
int
mark_class
=
record
.
klass
;
...
@@ -402,15 +403,15 @@ struct MarkArray : ArrayOf<MarkRecord> /* Array of MarkRecords--in Coverage orde
...
@@ -402,15 +403,15 @@ struct MarkArray : ArrayOf<MarkRecord> /* Array of MarkRecords--in Coverage orde
hb_position_t
mark_x
,
mark_y
,
base_x
,
base_y
;
hb_position_t
mark_x
,
mark_y
,
base_x
,
base_y
;
mark_anchor
.
get_anchor
(
c
->
font
,
c
->
buffer
->
cur
().
codepoint
,
&
mark_x
,
&
mark_y
);
mark_anchor
.
get_anchor
(
c
->
font
,
buffer
->
cur
().
codepoint
,
&
mark_x
,
&
mark_y
);
glyph_anchor
.
get_anchor
(
c
->
font
,
c
->
buffer
->
info
[
glyph_pos
].
codepoint
,
&
base_x
,
&
base_y
);
glyph_anchor
.
get_anchor
(
c
->
font
,
buffer
->
info
[
glyph_pos
].
codepoint
,
&
base_x
,
&
base_y
);
hb_glyph_position_t
&
o
=
c
->
buffer
->
cur_pos
();
hb_glyph_position_t
&
o
=
buffer
->
cur_pos
();
o
.
x_offset
=
base_x
-
mark_x
;
o
.
x_offset
=
base_x
-
mark_x
;
o
.
y_offset
=
base_y
-
mark_y
;
o
.
y_offset
=
base_y
-
mark_y
;
o
.
attach_lookback
()
=
c
->
buffer
->
idx
-
glyph_pos
;
o
.
attach_lookback
()
=
buffer
->
idx
-
glyph_pos
;
c
->
buffer
->
idx
++
;
buffer
->
idx
++
;
return
TRACE_RETURN
(
true
);
return
TRACE_RETURN
(
true
);
}
}
...
@@ -439,13 +440,14 @@ struct SinglePosFormat1
...
@@ -439,13 +440,14 @@ struct SinglePosFormat1
inline
bool
apply
(
hb_apply_context_t
*
c
)
const
inline
bool
apply
(
hb_apply_context_t
*
c
)
const
{
{
TRACE_APPLY
(
this
);
TRACE_APPLY
(
this
);
unsigned
int
index
=
(
this
+
coverage
).
get_coverage
(
c
->
buffer
->
cur
().
codepoint
);
hb_buffer_t
*
buffer
=
c
->
buffer
;
unsigned
int
index
=
(
this
+
coverage
).
get_coverage
(
buffer
->
cur
().
codepoint
);
if
(
likely
(
index
==
NOT_COVERED
))
return
TRACE_RETURN
(
false
);
if
(
likely
(
index
==
NOT_COVERED
))
return
TRACE_RETURN
(
false
);
valueFormat
.
apply_value
(
c
->
font
,
c
->
direction
,
this
,
valueFormat
.
apply_value
(
c
->
font
,
c
->
direction
,
this
,
values
,
c
->
buffer
->
cur_pos
());
values
,
buffer
->
cur_pos
());
c
->
buffer
->
idx
++
;
buffer
->
idx
++
;
return
TRACE_RETURN
(
true
);
return
TRACE_RETURN
(
true
);
}
}
...
@@ -484,16 +486,17 @@ struct SinglePosFormat2
...
@@ -484,16 +486,17 @@ struct SinglePosFormat2
inline
bool
apply
(
hb_apply_context_t
*
c
)
const
inline
bool
apply
(
hb_apply_context_t
*
c
)
const
{
{
TRACE_APPLY
(
this
);
TRACE_APPLY
(
this
);
unsigned
int
index
=
(
this
+
coverage
).
get_coverage
(
c
->
buffer
->
cur
().
codepoint
);
hb_buffer_t
*
buffer
=
c
->
buffer
;
unsigned
int
index
=
(
this
+
coverage
).
get_coverage
(
buffer
->
cur
().
codepoint
);
if
(
likely
(
index
==
NOT_COVERED
))
return
TRACE_RETURN
(
false
);
if
(
likely
(
index
==
NOT_COVERED
))
return
TRACE_RETURN
(
false
);
if
(
likely
(
index
>=
valueCount
))
return
TRACE_RETURN
(
false
);
if
(
likely
(
index
>=
valueCount
))
return
TRACE_RETURN
(
false
);
valueFormat
.
apply_value
(
c
->
font
,
c
->
direction
,
this
,
valueFormat
.
apply_value
(
c
->
font
,
c
->
direction
,
this
,
&
values
[
index
*
valueFormat
.
get_len
()],
&
values
[
index
*
valueFormat
.
get_len
()],
c
->
buffer
->
cur_pos
());
buffer
->
cur_pos
());
c
->
buffer
->
idx
++
;
buffer
->
idx
++
;
return
TRACE_RETURN
(
true
);
return
TRACE_RETURN
(
true
);
}
}
...
@@ -588,6 +591,7 @@ struct PairSet
...
@@ -588,6 +591,7 @@ struct PairSet
unsigned
int
pos
)
const
unsigned
int
pos
)
const
{
{
TRACE_APPLY
(
this
);
TRACE_APPLY
(
this
);
hb_buffer_t
*
buffer
=
c
->
buffer
;
unsigned
int
len1
=
valueFormats
[
0
].
get_len
();
unsigned
int
len1
=
valueFormats
[
0
].
get_len
();
unsigned
int
len2
=
valueFormats
[
1
].
get_len
();
unsigned
int
len2
=
valueFormats
[
1
].
get_len
();
unsigned
int
record_size
=
USHORT
::
static_size
*
(
1
+
len1
+
len2
);
unsigned
int
record_size
=
USHORT
::
static_size
*
(
1
+
len1
+
len2
);
...
@@ -597,15 +601,15 @@ struct PairSet
...
@@ -597,15 +601,15 @@ struct PairSet
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
{
{
/* TODO bsearch */
/* TODO bsearch */
if
(
c
->
buffer
->
info
[
pos
].
codepoint
==
record
->
secondGlyph
)
if
(
buffer
->
info
[
pos
].
codepoint
==
record
->
secondGlyph
)
{
{
valueFormats
[
0
].
apply_value
(
c
->
font
,
c
->
direction
,
this
,
valueFormats
[
0
].
apply_value
(
c
->
font
,
c
->
direction
,
this
,
&
record
->
values
[
0
],
c
->
buffer
->
cur_pos
());
&
record
->
values
[
0
],
buffer
->
cur_pos
());
valueFormats
[
1
].
apply_value
(
c
->
font
,
c
->
direction
,
this
,
valueFormats
[
1
].
apply_value
(
c
->
font
,
c
->
direction
,
this
,
&
record
->
values
[
len1
],
c
->
buffer
->
pos
[
pos
]);
&
record
->
values
[
len1
],
buffer
->
pos
[
pos
]);
if
(
len2
)
if
(
len2
)
pos
++
;
pos
++
;
c
->
buffer
->
idx
=
pos
;
buffer
->
idx
=
pos
;
return
TRACE_RETURN
(
true
);
return
TRACE_RETURN
(
true
);
}
}
record
=
&
StructAtOffset
<
PairValueRecord
>
(
record
,
record_size
);
record
=
&
StructAtOffset
<
PairValueRecord
>
(
record
,
record_size
);
...
@@ -659,10 +663,11 @@ struct PairPosFormat1
...
@@ -659,10 +663,11 @@ struct PairPosFormat1
inline
bool
apply
(
hb_apply_context_t
*
c
)
const
inline
bool
apply
(
hb_apply_context_t
*
c
)
const
{
{
TRACE_APPLY
(
this
);
TRACE_APPLY
(
this
);
hb_apply_context_t
::
skipping_forward_iterator_t
skippy_iter
(
c
,
c
->
buffer
->
idx
,
1
);
hb_buffer_t
*
buffer
=
c
->
buffer
;
hb_apply_context_t
::
skipping_forward_iterator_t
skippy_iter
(
c
,
buffer
->
idx
,
1
);
if
(
skippy_iter
.
has_no_chance
())
return
TRACE_RETURN
(
false
);
if
(
skippy_iter
.
has_no_chance
())
return
TRACE_RETURN
(
false
);
unsigned
int
index
=
(
this
+
coverage
).
get_coverage
(
c
->
buffer
->
cur
().
codepoint
);
unsigned
int
index
=
(
this
+
coverage
).
get_coverage
(
buffer
->
cur
().
codepoint
);
if
(
likely
(
index
==
NOT_COVERED
))
return
TRACE_RETURN
(
false
);
if
(
likely
(
index
==
NOT_COVERED
))
return
TRACE_RETURN
(
false
);
if
(
!
skippy_iter
.
next
())
return
TRACE_RETURN
(
false
);
if
(
!
skippy_iter
.
next
())
return
TRACE_RETURN
(
false
);
...
@@ -729,10 +734,11 @@ struct PairPosFormat2
...
@@ -729,10 +734,11 @@ struct PairPosFormat2
inline
bool
apply
(
hb_apply_context_t
*
c
)
const
inline
bool
apply
(
hb_apply_context_t
*
c
)
const
{
{
TRACE_APPLY
(
this
);
TRACE_APPLY
(
this
);
hb_apply_context_t
::
skipping_forward_iterator_t
skippy_iter
(
c
,
c
->
buffer
->
idx
,
1
);
hb_buffer_t
*
buffer
=
c
->
buffer
;
hb_apply_context_t
::
skipping_forward_iterator_t
skippy_iter
(
c
,
buffer
->
idx
,
1
);
if
(
skippy_iter
.
has_no_chance
())
return
TRACE_RETURN
(
false
);
if
(
skippy_iter
.
has_no_chance
())
return
TRACE_RETURN
(
false
);
unsigned
int
index
=
(
this
+
coverage
).
get_coverage
(
c
->
buffer
->
cur
().
codepoint
);
unsigned
int
index
=
(
this
+
coverage
).
get_coverage
(
buffer
->
cur
().
codepoint
);
if
(
likely
(
index
==
NOT_COVERED
))
return
TRACE_RETURN
(
false
);
if
(
likely
(
index
==
NOT_COVERED
))
return
TRACE_RETURN
(
false
);
if
(
!
skippy_iter
.
next
())
return
TRACE_RETURN
(
false
);
if
(
!
skippy_iter
.
next
())
return
TRACE_RETURN
(
false
);
...
@@ -741,19 +747,19 @@ struct PairPosFormat2
...
@@ -741,19 +747,19 @@ struct PairPosFormat2
unsigned
int
len2
=
valueFormat2
.
get_len
();
unsigned
int
len2
=
valueFormat2
.
get_len
();
unsigned
int
record_len
=
len1
+
len2
;
unsigned
int
record_len
=
len1
+
len2
;
unsigned
int
klass1
=
(
this
+
classDef1
).
get_class
(
c
->
buffer
->
cur
().
codepoint
);
unsigned
int
klass1
=
(
this
+
classDef1
).
get_class
(
buffer
->
cur
().
codepoint
);
unsigned
int
klass2
=
(
this
+
classDef2
).
get_class
(
c
->
buffer
->
info
[
skippy_iter
.
idx
].
codepoint
);
unsigned
int
klass2
=
(
this
+
classDef2
).
get_class
(
buffer
->
info
[
skippy_iter
.
idx
].
codepoint
);
if
(
unlikely
(
klass1
>=
class1Count
||
klass2
>=
class2Count
))
return
TRACE_RETURN
(
false
);
if
(
unlikely
(
klass1
>=
class1Count
||
klass2
>=
class2Count
))
return
TRACE_RETURN
(
false
);
const
Value
*
v
=
&
values
[
record_len
*
(
klass1
*
class2Count
+
klass2
)];
const
Value
*
v
=
&
values
[
record_len
*
(
klass1
*
class2Count
+
klass2
)];
valueFormat1
.
apply_value
(
c
->
font
,
c
->
direction
,
this
,
valueFormat1
.
apply_value
(
c
->
font
,
c
->
direction
,
this
,
v
,
c
->
buffer
->
cur_pos
());
v
,
buffer
->
cur_pos
());
valueFormat2
.
apply_value
(
c
->
font
,
c
->
direction
,
this
,
valueFormat2
.
apply_value
(
c
->
font
,
c
->
direction
,
this
,
v
+
len1
,
c
->
buffer
->
pos
[
skippy_iter
.
idx
]);
v
+
len1
,
buffer
->
pos
[
skippy_iter
.
idx
]);
c
->
buffer
->
idx
=
skippy_iter
.
idx
;
buffer
->
idx
=
skippy_iter
.
idx
;
if
(
len2
)
if
(
len2
)
c
->
buffer
->
idx
++
;
buffer
->
idx
++
;
return
TRACE_RETURN
(
true
);
return
TRACE_RETURN
(
true
);
}
}
...
@@ -875,29 +881,30 @@ struct CursivePosFormat1
...
@@ -875,29 +881,30 @@ struct CursivePosFormat1
inline
bool
apply
(
hb_apply_context_t
*
c
)
const
inline
bool
apply
(
hb_apply_context_t
*
c
)
const
{
{
TRACE_APPLY
(
this
);
TRACE_APPLY
(
this
);
hb_buffer_t
*
buffer
=
c
->
buffer
;
/* We don't handle mark glyphs here. */
/* We don't handle mark glyphs here. */
if
(
unlikely
(
_hb_glyph_info_is_mark
(
&
c
->
buffer
->
cur
())))
return
TRACE_RETURN
(
false
);
if
(
unlikely
(
_hb_glyph_info_is_mark
(
&
buffer
->
cur
())))
return
TRACE_RETURN
(
false
);
hb_apply_context_t
::
skipping_forward_iterator_t
skippy_iter
(
c
,
c
->
buffer
->
idx
,
1
);
hb_apply_context_t
::
skipping_forward_iterator_t
skippy_iter
(
c
,
buffer
->
idx
,
1
);
if
(
skippy_iter
.
has_no_chance
())
return
TRACE_RETURN
(
false
);
if
(
skippy_iter
.
has_no_chance
())
return
TRACE_RETURN
(
false
);
const
EntryExitRecord
&
this_record
=
entryExitRecord
[(
this
+
coverage
).
get_coverage
(
c
->
buffer
->
cur
().
codepoint
)];
const
EntryExitRecord
&
this_record
=
entryExitRecord
[(
this
+
coverage
).
get_coverage
(
buffer
->
cur
().
codepoint
)];
if
(
!
this_record
.
exitAnchor
)
return
TRACE_RETURN
(
false
);
if
(
!
this_record
.
exitAnchor
)
return
TRACE_RETURN
(
false
);
if
(
!
skippy_iter
.
next
())
return
TRACE_RETURN
(
false
);
if
(
!
skippy_iter
.
next
())
return
TRACE_RETURN
(
false
);
const
EntryExitRecord
&
next_record
=
entryExitRecord
[(
this
+
coverage
).
get_coverage
(
c
->
buffer
->
info
[
skippy_iter
.
idx
].
codepoint
)];
const
EntryExitRecord
&
next_record
=
entryExitRecord
[(
this
+
coverage
).
get_coverage
(
buffer
->
info
[
skippy_iter
.
idx
].
codepoint
)];
if
(
!
next_record
.
entryAnchor
)
return
TRACE_RETURN
(
false
);
if
(
!
next_record
.
entryAnchor
)
return
TRACE_RETURN
(
false
);
unsigned
int
i
=
c
->
buffer
->
idx
;
unsigned
int
i
=
buffer
->
idx
;
unsigned
int
j
=
skippy_iter
.
idx
;
unsigned
int
j
=
skippy_iter
.
idx
;
hb_position_t
entry_x
,
entry_y
,
exit_x
,
exit_y
;
hb_position_t
entry_x
,
entry_y
,
exit_x
,
exit_y
;
(
this
+
this_record
.
exitAnchor
).
get_anchor
(
c
->
font
,
c
->
buffer
->
info
[
i
].
codepoint
,
&
exit_x
,
&
exit_y
);
(
this
+
this_record
.
exitAnchor
).
get_anchor
(
c
->
font
,
buffer
->
info
[
i
].
codepoint
,
&
exit_x
,
&
exit_y
);
(
this
+
next_record
.
entryAnchor
).
get_anchor
(
c
->
font
,
c
->
buffer
->
info
[
j
].
codepoint
,
&
entry_x
,
&
entry_y
);
(
this
+
next_record
.
entryAnchor
).
get_anchor
(
c
->
font
,
buffer
->
info
[
j
].
codepoint
,
&
entry_x
,
&
entry_y
);
hb_glyph_position_t
*
pos
=
c
->
buffer
->
pos
;
hb_glyph_position_t
*
pos
=
buffer
->
pos
;
hb_position_t
d
;
hb_position_t
d
;
/* Main-direction adjustment */
/* Main-direction adjustment */
...
@@ -950,7 +957,7 @@ struct CursivePosFormat1
...
@@ -950,7 +957,7 @@ struct CursivePosFormat1
pos
[
j
].
x_offset
=
exit_x
-
entry_x
;
pos
[
j
].
x_offset
=
exit_x
-
entry_x
;
}
}
c
->
buffer
->
idx
=
j
;
buffer
->
idx
=
j
;
return
TRACE_RETURN
(
true
);
return
TRACE_RETURN
(
true
);
}
}
...
@@ -1022,23 +1029,24 @@ struct MarkBasePosFormat1
...
@@ -1022,23 +1029,24 @@ struct MarkBasePosFormat1
inline
bool
apply
(
hb_apply_context_t
*
c
)
const
inline
bool
apply
(
hb_apply_context_t
*
c
)
const
{
{
TRACE_APPLY
(
this
);
TRACE_APPLY
(
this
);
unsigned
int
mark_index
=
(
this
+
markCoverage
).
get_coverage
(
c
->
buffer
->
cur
().
codepoint
);
hb_buffer_t
*
buffer
=
c
->
buffer
;
unsigned
int
mark_index
=
(
this
+
markCoverage
).
get_coverage
(
buffer
->
cur
().
codepoint
);
if
(
likely
(
mark_index
==
NOT_COVERED
))
return
TRACE_RETURN
(
false
);
if
(
likely
(
mark_index
==
NOT_COVERED
))
return
TRACE_RETURN
(
false
);
/* now we search backwards for a non-mark glyph */
/* now we search backwards for a non-mark glyph */
hb_apply_context_t
::
skipping_backward_iterator_t
skippy_iter
(
c
,
c
->
buffer
->
idx
,
1
);
hb_apply_context_t
::
skipping_backward_iterator_t
skippy_iter
(
c
,
buffer
->
idx
,
1
);
skippy_iter
.
set_lookup_props
(
LookupFlag
::
IgnoreMarks
);
skippy_iter
.
set_lookup_props
(
LookupFlag
::
IgnoreMarks
);
do
{
do
{
if
(
!
skippy_iter
.
prev
())
return
TRACE_RETURN
(
false
);
if
(
!
skippy_iter
.
prev
())
return
TRACE_RETURN
(
false
);
/* We only want to attach to the first of a MultipleSubst sequence. Reject others. */
/* We only want to attach to the first of a MultipleSubst sequence. Reject others. */
if
(
0
==
_hb_glyph_info_get_lig_comp
(
&
c
->
buffer
->
info
[
skippy_iter
.
idx
]))
break
;
if
(
0
==
_hb_glyph_info_get_lig_comp
(
&
buffer
->
info
[
skippy_iter
.
idx
]))
break
;
skippy_iter
.
reject
();
skippy_iter
.
reject
();
}
while
(
1
);
}
while
(
1
);
/* Checking that matched glyph is actually a base glyph by GDEF is too strong; disabled */
/* Checking that matched glyph is actually a base glyph by GDEF is too strong; disabled */
if
(
!
_hb_glyph_info_is_base_glyph
(
&
c
->
buffer
->
info
[
skippy_iter
.
idx
]))
{
/*return TRACE_RETURN (false);*/
}
if
(
!
_hb_glyph_info_is_base_glyph
(
&
buffer
->
info
[
skippy_iter
.
idx
]))
{
/*return TRACE_RETURN (false);*/
}
unsigned
int
base_index
=
(
this
+
baseCoverage
).
get_coverage
(
c
->
buffer
->
info
[
skippy_iter
.
idx
].
codepoint
);
unsigned
int
base_index
=
(
this
+
baseCoverage
).
get_coverage
(
buffer
->
info
[
skippy_iter
.
idx
].
codepoint
);
if
(
base_index
==
NOT_COVERED
)
return
TRACE_RETURN
(
false
);
if
(
base_index
==
NOT_COVERED
)
return
TRACE_RETURN
(
false
);
return
TRACE_RETURN
((
this
+
markArray
).
apply
(
c
,
mark_index
,
base_index
,
this
+
baseArray
,
classCount
,
skippy_iter
.
idx
));
return
TRACE_RETURN
((
this
+
markArray
).
apply
(
c
,
mark_index
,
base_index
,
this
+
baseArray
,
classCount
,
skippy_iter
.
idx
));
...
@@ -1125,19 +1133,20 @@ struct MarkLigPosFormat1
...
@@ -1125,19 +1133,20 @@ struct MarkLigPosFormat1
inline
bool
apply
(
hb_apply_context_t
*
c
)
const
inline
bool
apply
(
hb_apply_context_t
*
c
)
const
{
{
TRACE_APPLY
(
this
);
TRACE_APPLY
(
this
);
unsigned
int
mark_index
=
(
this
+
markCoverage
).
get_coverage
(
c
->
buffer
->
cur
().
codepoint
);
hb_buffer_t
*
buffer
=
c
->
buffer
;
unsigned
int
mark_index
=
(
this
+
markCoverage
).
get_coverage
(
buffer
->
cur
().
codepoint
);
if
(
likely
(
mark_index
==
NOT_COVERED
))
return
TRACE_RETURN
(
false
);
if
(
likely
(
mark_index
==
NOT_COVERED
))
return
TRACE_RETURN
(
false
);
/* now we search backwards for a non-mark glyph */
/* now we search backwards for a non-mark glyph */
hb_apply_context_t
::
skipping_backward_iterator_t
skippy_iter
(
c
,
c
->
buffer
->
idx
,
1
);
hb_apply_context_t
::
skipping_backward_iterator_t
skippy_iter
(
c
,
buffer
->
idx
,
1
);
skippy_iter
.
set_lookup_props
(
LookupFlag
::
IgnoreMarks
);
skippy_iter
.
set_lookup_props
(
LookupFlag
::
IgnoreMarks
);
if
(
!
skippy_iter
.
prev
())
return
TRACE_RETURN
(
false
);
if
(
!
skippy_iter
.
prev
())
return
TRACE_RETURN
(
false
);
/* Checking that matched glyph is actually a ligature by GDEF is too strong; disabled */
/* Checking that matched glyph is actually a ligature by GDEF is too strong; disabled */
if
(
!
_hb_glyph_info_is_ligature
(
&
c
->
buffer
->
info
[
skippy_iter
.
idx
]))
{
/*return TRACE_RETURN (false);*/
}
if
(
!
_hb_glyph_info_is_ligature
(
&
buffer
->
info
[
skippy_iter
.
idx
]))
{
/*return TRACE_RETURN (false);*/
}
unsigned
int
j
=
skippy_iter
.
idx
;
unsigned
int
j
=
skippy_iter
.
idx
;
unsigned
int
lig_index
=
(
this
+
ligatureCoverage
).
get_coverage
(
c
->
buffer
->
info
[
j
].
codepoint
);
unsigned
int
lig_index
=
(
this
+
ligatureCoverage
).
get_coverage
(
buffer
->
info
[
j
].
codepoint
);
if
(
lig_index
==
NOT_COVERED
)
return
TRACE_RETURN
(
false
);
if
(
lig_index
==
NOT_COVERED
)
return
TRACE_RETURN
(
false
);
const
LigatureArray
&
lig_array
=
this
+
ligatureArray
;
const
LigatureArray
&
lig_array
=
this
+
ligatureArray
;
...
@@ -1152,11 +1161,11 @@ struct MarkLigPosFormat1
...
@@ -1152,11 +1161,11 @@ struct MarkLigPosFormat1
* can directly use the component index. If not, we attach the mark
* can directly use the component index. If not, we attach the mark
* glyph to the last component of the ligature. */
* glyph to the last component of the ligature. */
unsigned
int
comp_index
;
unsigned
int
comp_index
;
unsigned
int
lig_id
=
_hb_glyph_info_get_lig_id
(
&
c
->
buffer
->
info
[
j
]);
unsigned
int
lig_id
=
_hb_glyph_info_get_lig_id
(
&
buffer
->
info
[
j
]);
unsigned
int
mark_id
=
_hb_glyph_info_get_lig_id
(
&
c
->
buffer
->
cur
());
unsigned
int
mark_id
=
_hb_glyph_info_get_lig_id
(
&
buffer
->
cur
());
unsigned
int
mark_comp
=
_hb_glyph_info_get_lig_comp
(
&
c
->
buffer
->
cur
());
unsigned
int
mark_comp
=
_hb_glyph_info_get_lig_comp
(
&
buffer
->
cur
());
if
(
lig_id
&&
lig_id
==
mark_id
&&
mark_comp
>
0
)
if
(
lig_id
&&
lig_id
==
mark_id
&&
mark_comp
>
0
)
comp_index
=
MIN
(
comp_count
,
_hb_glyph_info_get_lig_comp
(
&
c
->
buffer
->
cur
()))
-
1
;
comp_index
=
MIN
(
comp_count
,
_hb_glyph_info_get_lig_comp
(
&
buffer
->
cur
()))
-
1
;
else
else
comp_index
=
comp_count
-
1
;
comp_index
=
comp_count
-
1
;
...
@@ -1240,22 +1249,23 @@ struct MarkMarkPosFormat1
...
@@ -1240,22 +1249,23 @@ struct MarkMarkPosFormat1
inline
bool
apply
(
hb_apply_context_t
*
c
)
const
inline
bool
apply
(
hb_apply_context_t
*
c
)
const
{
{
TRACE_APPLY
(
this
);
TRACE_APPLY
(
this
);
unsigned
int
mark1_index
=
(
this
+
mark1Coverage
).
get_coverage
(
c
->
buffer
->
cur
().
codepoint
);
hb_buffer_t
*
buffer
=
c
->
buffer
;
unsigned
int
mark1_index
=
(
this
+
mark1Coverage
).
get_coverage
(
buffer
->
cur
().
codepoint
);
if
(
likely
(
mark1_index
==
NOT_COVERED
))
return
TRACE_RETURN
(
false
);
if
(
likely
(
mark1_index
==
NOT_COVERED
))
return
TRACE_RETURN
(
false
);
/* now we search backwards for a suitable mark glyph until a non-mark glyph */
/* now we search backwards for a suitable mark glyph until a non-mark glyph */
hb_apply_context_t
::
skipping_backward_iterator_t
skippy_iter
(
c
,
c
->
buffer
->
idx
,
1
);
hb_apply_context_t
::
skipping_backward_iterator_t
skippy_iter
(
c
,
buffer
->
idx
,
1
);
skippy_iter
.
set_lookup_props
(
c
->
lookup_props
&
~
LookupFlag
::
IgnoreFlags
);
skippy_iter
.
set_lookup_props
(
c
->
lookup_props
&
~
LookupFlag
::
IgnoreFlags
);
if
(
!
skippy_iter
.
prev
())
return
TRACE_RETURN
(
false
);
if
(
!
skippy_iter
.
prev
())
return
TRACE_RETURN
(
false
);
if
(
!
_hb_glyph_info_is_mark
(
&
c
->
buffer
->
info
[
skippy_iter
.
idx
]))
{
return
TRACE_RETURN
(
false
);
}
if
(
!
_hb_glyph_info_is_mark
(
&
buffer
->
info
[
skippy_iter
.
idx
]))
{
return
TRACE_RETURN
(
false
);
}
unsigned
int
j
=
skippy_iter
.
idx
;
unsigned
int
j
=
skippy_iter
.
idx
;
unsigned
int
id1
=
_hb_glyph_info_get_lig_id
(
&
c
->
buffer
->
cur
());
unsigned
int
id1
=
_hb_glyph_info_get_lig_id
(
&
buffer
->
cur
());
unsigned
int
id2
=
_hb_glyph_info_get_lig_id
(
&
c
->
buffer
->
info
[
j
]);
unsigned
int
id2
=
_hb_glyph_info_get_lig_id
(
&
buffer
->
info
[
j
]);
unsigned
int
comp1
=
_hb_glyph_info_get_lig_comp
(
&
c
->
buffer
->
cur
());
unsigned
int
comp1
=
_hb_glyph_info_get_lig_comp
(
&
buffer
->
cur
());
unsigned
int
comp2
=
_hb_glyph_info_get_lig_comp
(
&
c
->
buffer
->
info
[
j
]);
unsigned
int
comp2
=
_hb_glyph_info_get_lig_comp
(
&
buffer
->
info
[
j
]);
if
(
likely
(
id1
==
id2
))
{
if
(
likely
(
id1
==
id2
))
{
if
(
id1
==
0
)
/* Marks belonging to the same base. */
if
(
id1
==
0
)
/* Marks belonging to the same base. */
...
@@ -1273,7 +1283,7 @@ struct MarkMarkPosFormat1
...
@@ -1273,7 +1283,7 @@ struct MarkMarkPosFormat1
return
TRACE_RETURN
(
false
);
return
TRACE_RETURN
(
false
);
good:
good:
unsigned
int
mark2_index
=
(
this
+
mark2Coverage
).
get_coverage
(
c
->
buffer
->
info
[
j
].
codepoint
);
unsigned
int
mark2_index
=
(
this
+
mark2Coverage
).
get_coverage
(
buffer
->
info
[
j
].
codepoint
);
if
(
mark2_index
==
NOT_COVERED
)
return
TRACE_RETURN
(
false
);
if
(
mark2_index
==
NOT_COVERED
)
return
TRACE_RETURN
(
false
);
return
TRACE_RETURN
((
this
+
mark1Array
).
apply
(
c
,
mark1_index
,
mark2_index
,
this
+
mark2Array
,
classCount
,
j
));
return
TRACE_RETURN
((
this
+
mark1Array
).
apply
(
c
,
mark1_index
,
mark2_index
,
this
+
mark2Array
,
classCount
,
j
));
...
...
src/hb-ot-layout.cc
浏览文件 @
ac8cd511
...
@@ -825,8 +825,9 @@ apply_string (OT::hb_apply_context_t *c,
...
@@ -825,8 +825,9 @@ apply_string (OT::hb_apply_context_t *c,
bool
ret
=
false
;
bool
ret
=
false
;
OT
::
hb_is_inplace_context_t
inplace_c
(
c
->
face
);
OT
::
hb_is_inplace_context_t
inplace_c
(
c
->
face
);
bool
inplace
=
lookup
.
is_inplace
(
&
inplace_c
);
bool
inplace
=
lookup
.
is_inplace
(
&
inplace_c
);
hb_buffer_t
*
buffer
=
c
->
buffer
;
if
(
unlikely
(
!
c
->
buffer
->
len
||
!
c
->
lookup_mask
))
if
(
unlikely
(
!
buffer
->
len
||
!
c
->
lookup_mask
))
return
false
;
return
false
;
c
->
set_lookup
(
lookup
);
c
->
set_lookup
(
lookup
);
...
@@ -835,43 +836,43 @@ apply_string (OT::hb_apply_context_t *c,
...
@@ -835,43 +836,43 @@ apply_string (OT::hb_apply_context_t *c,
{
{
/* in/out forward substitution/positioning */
/* in/out forward substitution/positioning */
if
(
Proxy
::
table_index
==
0
)
if
(
Proxy
::
table_index
==
0
)
c
->
buffer
->
clear_output
();
buffer
->
clear_output
();
c
->
buffer
->
idx
=
0
;
buffer
->
idx
=
0
;
while
(
c
->
buffer
->
idx
<
c
->
buffer
->
len
)
while
(
buffer
->
idx
<
buffer
->
len
)
{
{
if
(
accel
.
digest
.
may_have
(
c
->
buffer
->
cur
().
codepoint
)
&&
if
(
accel
.
digest
.
may_have
(
buffer
->
cur
().
codepoint
)
&&
(
c
->
buffer
->
cur
().
mask
&
c
->
lookup_mask
)
&&
(
buffer
->
cur
().
mask
&
c
->
lookup_mask
)
&&
apply_once
(
c
,
lookup
))
apply_once
(
c
,
lookup
))
ret
=
true
;
ret
=
true
;
else
else
c
->
buffer
->
next_glyph
();
buffer
->
next_glyph
();
}
}
if
(
ret
)
if
(
ret
)
{
{
if
(
!
inplace
)
if
(
!
inplace
)
c
->
buffer
->
swap_buffers
();
buffer
->
swap_buffers
();
else
else
assert
(
!
c
->
buffer
->
has_separate_output
());
assert
(
!
buffer
->
has_separate_output
());
}
}
}
}
else
else
{
{
/* in-place backward substitution/positioning */
/* in-place backward substitution/positioning */
if
(
Proxy
::
table_index
==
0
)
if
(
Proxy
::
table_index
==
0
)
c
->
buffer
->
remove_output
();
buffer
->
remove_output
();
c
->
buffer
->
idx
=
c
->
buffer
->
len
-
1
;
buffer
->
idx
=
buffer
->
len
-
1
;
do
do
{
{
if
(
accel
.
digest
.
may_have
(
c
->
buffer
->
cur
().
codepoint
)
&&
if
(
accel
.
digest
.
may_have
(
buffer
->
cur
().
codepoint
)
&&
(
c
->
buffer
->
cur
().
mask
&
c
->
lookup_mask
)
&&
(
buffer
->
cur
().
mask
&
c
->
lookup_mask
)
&&
apply_once
(
c
,
lookup
))
apply_once
(
c
,
lookup
))
ret
=
true
;
ret
=
true
;
/* The reverse lookup doesn't "advance" cursor (for good reason). */
/* The reverse lookup doesn't "advance" cursor (for good reason). */
c
->
buffer
->
idx
--
;
buffer
->
idx
--
;
}
}
while
((
int
)
c
->
buffer
->
idx
>=
0
);
while
((
int
)
buffer
->
idx
>=
0
);
}
}
return
ret
;
return
ret
;
...
...
src/hb-ot-shape-normalize.cc
浏览文件 @
ac8cd511
...
@@ -132,17 +132,19 @@ static inline unsigned int
...
@@ -132,17 +132,19 @@ static inline unsigned int
decompose
(
const
hb_ot_shape_normalize_context_t
*
c
,
bool
shortest
,
hb_codepoint_t
ab
)
decompose
(
const
hb_ot_shape_normalize_context_t
*
c
,
bool
shortest
,
hb_codepoint_t
ab
)
{
{
hb_codepoint_t
a
,
b
,
a_glyph
,
b_glyph
;
hb_codepoint_t
a
,
b
,
a_glyph
,
b_glyph
;
hb_buffer_t
*
const
buffer
=
c
->
buffer
;
hb_font_t
*
const
font
=
c
->
font
;
if
(
!
c
->
decompose
(
c
,
ab
,
&
a
,
&
b
)
||
if
(
!
c
->
decompose
(
c
,
ab
,
&
a
,
&
b
)
||
(
b
&&
!
c
->
font
->
get_glyph
(
b
,
0
,
&
b_glyph
)))
(
b
&&
!
font
->
get_glyph
(
b
,
0
,
&
b_glyph
)))
return
0
;
return
0
;
bool
has_a
=
c
->
font
->
get_glyph
(
a
,
0
,
&
a_glyph
);
bool
has_a
=
font
->
get_glyph
(
a
,
0
,
&
a_glyph
);
if
(
shortest
&&
has_a
)
{
if
(
shortest
&&
has_a
)
{
/* Output a and b */
/* Output a and b */
output_char
(
c
->
buffer
,
a
,
a_glyph
);
output_char
(
buffer
,
a
,
a_glyph
);
if
(
likely
(
b
))
{
if
(
likely
(
b
))
{
output_char
(
c
->
buffer
,
b
,
b_glyph
);
output_char
(
buffer
,
b
,
b_glyph
);
return
2
;
return
2
;
}
}
return
1
;
return
1
;
...
@@ -151,16 +153,16 @@ decompose (const hb_ot_shape_normalize_context_t *c, bool shortest, hb_codepoint
...
@@ -151,16 +153,16 @@ decompose (const hb_ot_shape_normalize_context_t *c, bool shortest, hb_codepoint
unsigned
int
ret
;
unsigned
int
ret
;
if
((
ret
=
decompose
(
c
,
shortest
,
a
)))
{
if
((
ret
=
decompose
(
c
,
shortest
,
a
)))
{
if
(
b
)
{
if
(
b
)
{
output_char
(
c
->
buffer
,
b
,
b_glyph
);
output_char
(
buffer
,
b
,
b_glyph
);
return
ret
+
1
;
return
ret
+
1
;
}
}
return
ret
;
return
ret
;
}
}
if
(
has_a
)
{
if
(
has_a
)
{
output_char
(
c
->
buffer
,
a
,
a_glyph
);
output_char
(
buffer
,
a
,
a_glyph
);
if
(
likely
(
b
))
{
if
(
likely
(
b
))
{
output_char
(
c
->
buffer
,
b
,
b_glyph
);
output_char
(
buffer
,
b
,
b_glyph
);
return
2
;
return
2
;
}
}
return
1
;
return
1
;
...
@@ -214,34 +216,35 @@ static inline void
...
@@ -214,34 +216,35 @@ static inline void
handle_variation_selector_cluster
(
const
hb_ot_shape_normalize_context_t
*
c
,
unsigned
int
end
)
handle_variation_selector_cluster
(
const
hb_ot_shape_normalize_context_t
*
c
,
unsigned
int
end
)
{
{
hb_buffer_t
*
const
buffer
=
c
->
buffer
;
hb_buffer_t
*
const
buffer
=
c
->
buffer
;
hb_font_t
*
const
font
=
c
->
font
;
for
(;
buffer
->
idx
<
end
-
1
;)
{
for
(;
buffer
->
idx
<
end
-
1
;)
{
if
(
unlikely
(
buffer
->
unicode
->
is_variation_selector
(
buffer
->
cur
(
+
1
).
codepoint
)))
{
if
(
unlikely
(
buffer
->
unicode
->
is_variation_selector
(
buffer
->
cur
(
+
1
).
codepoint
)))
{
/* The next two lines are some ugly lines... But work. */
/* The next two lines are some ugly lines... But work. */
if
(
c
->
font
->
get_glyph
(
buffer
->
cur
().
codepoint
,
buffer
->
cur
(
+
1
).
codepoint
,
&
buffer
->
cur
().
glyph_index
()))
if
(
font
->
get_glyph
(
buffer
->
cur
().
codepoint
,
buffer
->
cur
(
+
1
).
codepoint
,
&
buffer
->
cur
().
glyph_index
()))
{
{
buffer
->
replace_glyphs
(
2
,
1
,
&
buffer
->
cur
().
codepoint
);
buffer
->
replace_glyphs
(
2
,
1
,
&
buffer
->
cur
().
codepoint
);
}
}
else
else
{
{
/* Just pass on the two characters separately, let GSUB do its magic. */
/* Just pass on the two characters separately, let GSUB do its magic. */
set_glyph
(
buffer
->
cur
(),
c
->
font
);
set_glyph
(
buffer
->
cur
(),
font
);
buffer
->
next_glyph
();
buffer
->
next_glyph
();
set_glyph
(
buffer
->
cur
(),
c
->
font
);
set_glyph
(
buffer
->
cur
(),
font
);
buffer
->
next_glyph
();
buffer
->
next_glyph
();
}
}
/* Skip any further variation selectors. */
/* Skip any further variation selectors. */
while
(
buffer
->
idx
<
end
&&
unlikely
(
buffer
->
unicode
->
is_variation_selector
(
buffer
->
cur
().
codepoint
)))
while
(
buffer
->
idx
<
end
&&
unlikely
(
buffer
->
unicode
->
is_variation_selector
(
buffer
->
cur
().
codepoint
)))
{
{
set_glyph
(
buffer
->
cur
(),
c
->
font
);
set_glyph
(
buffer
->
cur
(),
font
);
buffer
->
next_glyph
();
buffer
->
next_glyph
();
}
}
}
else
{
}
else
{
set_glyph
(
buffer
->
cur
(),
c
->
font
);
set_glyph
(
buffer
->
cur
(),
font
);
buffer
->
next_glyph
();
buffer
->
next_glyph
();
}
}
}
}
if
(
likely
(
buffer
->
idx
<
end
))
{
if
(
likely
(
buffer
->
idx
<
end
))
{
set_glyph
(
buffer
->
cur
(),
c
->
font
);
set_glyph
(
buffer
->
cur
(),
font
);
buffer
->
next_glyph
();
buffer
->
next_glyph
();
}
}
}
}
...
...
src/hb-ot-shape.cc
浏览文件 @
ac8cd511
...
@@ -290,16 +290,18 @@ hb_ot_mirror_chars (hb_ot_shape_context_t *c)
...
@@ -290,16 +290,18 @@ hb_ot_mirror_chars (hb_ot_shape_context_t *c)
if
(
HB_DIRECTION_IS_FORWARD
(
c
->
target_direction
))
if
(
HB_DIRECTION_IS_FORWARD
(
c
->
target_direction
))
return
;
return
;
hb_unicode_funcs_t
*
unicode
=
c
->
buffer
->
unicode
;
hb_buffer_t
*
buffer
=
c
->
buffer
;
hb_unicode_funcs_t
*
unicode
=
buffer
->
unicode
;
hb_mask_t
rtlm_mask
=
c
->
plan
->
map
.
get_1_mask
(
HB_TAG
(
'r'
,
't'
,
'l'
,
'm'
));
hb_mask_t
rtlm_mask
=
c
->
plan
->
map
.
get_1_mask
(
HB_TAG
(
'r'
,
't'
,
'l'
,
'm'
));
unsigned
int
count
=
c
->
buffer
->
len
;
unsigned
int
count
=
buffer
->
len
;
hb_glyph_info_t
*
info
=
buffer
->
info
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
{
hb_codepoint_t
codepoint
=
unicode
->
mirroring
(
c
->
buffer
->
info
[
i
].
codepoint
);
hb_codepoint_t
codepoint
=
unicode
->
mirroring
(
info
[
i
].
codepoint
);
if
(
likely
(
codepoint
==
c
->
buffer
->
info
[
i
].
codepoint
))
if
(
likely
(
codepoint
==
info
[
i
].
codepoint
))
c
->
buffer
->
info
[
i
].
mask
|=
rtlm_mask
;
info
[
i
].
mask
|=
rtlm_mask
;
else
else
c
->
buffer
->
info
[
i
].
codepoint
=
codepoint
;
info
[
i
].
codepoint
=
codepoint
;
}
}
}
}
...
@@ -307,12 +309,13 @@ static inline void
...
@@ -307,12 +309,13 @@ static inline void
hb_ot_shape_setup_masks
(
hb_ot_shape_context_t
*
c
)
hb_ot_shape_setup_masks
(
hb_ot_shape_context_t
*
c
)
{
{
hb_ot_map_t
*
map
=
&
c
->
plan
->
map
;
hb_ot_map_t
*
map
=
&
c
->
plan
->
map
;
hb_buffer_t
*
buffer
=
c
->
buffer
;
hb_mask_t
global_mask
=
map
->
get_global_mask
();
hb_mask_t
global_mask
=
map
->
get_global_mask
();
c
->
buffer
->
reset_masks
(
global_mask
);
buffer
->
reset_masks
(
global_mask
);
if
(
c
->
plan
->
shaper
->
setup_masks
)
if
(
c
->
plan
->
shaper
->
setup_masks
)
c
->
plan
->
shaper
->
setup_masks
(
c
->
plan
,
c
->
buffer
,
c
->
font
);
c
->
plan
->
shaper
->
setup_masks
(
c
->
plan
,
buffer
,
c
->
font
);
for
(
unsigned
int
i
=
0
;
i
<
c
->
num_user_features
;
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
c
->
num_user_features
;
i
++
)
{
{
...
@@ -320,7 +323,7 @@ hb_ot_shape_setup_masks (hb_ot_shape_context_t *c)
...
@@ -320,7 +323,7 @@ hb_ot_shape_setup_masks (hb_ot_shape_context_t *c)
if
(
!
(
feature
->
start
==
0
&&
feature
->
end
==
(
unsigned
int
)
-
1
))
{
if
(
!
(
feature
->
start
==
0
&&
feature
->
end
==
(
unsigned
int
)
-
1
))
{
unsigned
int
shift
;
unsigned
int
shift
;
hb_mask_t
mask
=
map
->
get_mask
(
feature
->
tag
,
&
shift
);
hb_mask_t
mask
=
map
->
get_mask
(
feature
->
tag
,
&
shift
);
c
->
buffer
->
set_masks
(
feature
->
value
<<
shift
,
mask
,
feature
->
start
,
feature
->
end
);
buffer
->
set_masks
(
feature
->
value
<<
shift
,
mask
,
feature
->
start
,
feature
->
end
);
}
}
}
}
}
}
...
@@ -338,9 +341,10 @@ static inline void
...
@@ -338,9 +341,10 @@ static inline void
hb_synthesize_glyph_classes
(
hb_ot_shape_context_t
*
c
)
hb_synthesize_glyph_classes
(
hb_ot_shape_context_t
*
c
)
{
{
unsigned
int
count
=
c
->
buffer
->
len
;
unsigned
int
count
=
c
->
buffer
->
len
;
hb_glyph_info_t
*
info
=
c
->
buffer
->
info
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
_hb_glyph_info_set_glyph_props
(
&
c
->
buffer
->
info
[
i
],
_hb_glyph_info_set_glyph_props
(
&
info
[
i
],
_hb_glyph_info_get_general_category
(
&
c
->
buffer
->
info
[
i
])
_hb_glyph_info_get_general_category
(
&
info
[
i
])
==
HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK
?
==
HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK
?
HB_OT_LAYOUT_GLYPH_PROPS_MARK
:
HB_OT_LAYOUT_GLYPH_PROPS_MARK
:
HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH
);
HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH
);
...
@@ -349,37 +353,41 @@ hb_synthesize_glyph_classes (hb_ot_shape_context_t *c)
...
@@ -349,37 +353,41 @@ hb_synthesize_glyph_classes (hb_ot_shape_context_t *c)
static
inline
void
static
inline
void
hb_ot_substitute_default
(
hb_ot_shape_context_t
*
c
)
hb_ot_substitute_default
(
hb_ot_shape_context_t
*
c
)
{
{
hb_buffer_t
*
buffer
=
c
->
buffer
;
if
(
c
->
plan
->
shaper
->
preprocess_text
)
if
(
c
->
plan
->
shaper
->
preprocess_text
)
c
->
plan
->
shaper
->
preprocess_text
(
c
->
plan
,
c
->
buffer
,
c
->
font
);
c
->
plan
->
shaper
->
preprocess_text
(
c
->
plan
,
buffer
,
c
->
font
);
hb_ot_mirror_chars
(
c
);
hb_ot_mirror_chars
(
c
);
HB_BUFFER_ALLOCATE_VAR
(
c
->
buffer
,
glyph_index
);
HB_BUFFER_ALLOCATE_VAR
(
buffer
,
glyph_index
);
_hb_ot_shape_normalize
(
c
->
plan
,
c
->
buffer
,
c
->
font
);
_hb_ot_shape_normalize
(
c
->
plan
,
buffer
,
c
->
font
);
hb_ot_shape_setup_masks
(
c
);
hb_ot_shape_setup_masks
(
c
);
/* This is unfortunate to go here, but necessary... */
/* This is unfortunate to go here, but necessary... */
if
(
!
hb_ot_layout_has_positioning
(
c
->
face
))
if
(
!
hb_ot_layout_has_positioning
(
c
->
face
))
_hb_ot_shape_fallback_position_recategorize_marks
(
c
->
plan
,
c
->
font
,
c
->
buffer
);
_hb_ot_shape_fallback_position_recategorize_marks
(
c
->
plan
,
c
->
font
,
buffer
);
hb_ot_map_glyphs_fast
(
c
->
buffer
);
hb_ot_map_glyphs_fast
(
buffer
);
HB_BUFFER_DEALLOCATE_VAR
(
c
->
buffer
,
glyph_index
);
HB_BUFFER_DEALLOCATE_VAR
(
buffer
,
glyph_index
);
}
}
static
inline
void
static
inline
void
hb_ot_substitute_complex
(
hb_ot_shape_context_t
*
c
)
hb_ot_substitute_complex
(
hb_ot_shape_context_t
*
c
)
{
{
hb_ot_layout_substitute_start
(
c
->
font
,
c
->
buffer
);
hb_buffer_t
*
buffer
=
c
->
buffer
;
hb_ot_layout_substitute_start
(
c
->
font
,
buffer
);
if
(
!
hb_ot_layout_has_glyph_classes
(
c
->
face
))
if
(
!
hb_ot_layout_has_glyph_classes
(
c
->
face
))
hb_synthesize_glyph_classes
(
c
);
hb_synthesize_glyph_classes
(
c
);
c
->
plan
->
substitute
(
c
->
font
,
c
->
buffer
);
c
->
plan
->
substitute
(
c
->
font
,
buffer
);
hb_ot_layout_substitute_finish
(
c
->
font
,
c
->
buffer
);
hb_ot_layout_substitute_finish
(
c
->
font
,
buffer
);
return
;
return
;
}
}
...
@@ -420,17 +428,20 @@ zero_mark_widths_by_gdef (hb_buffer_t *buffer)
...
@@ -420,17 +428,20 @@ zero_mark_widths_by_gdef (hb_buffer_t *buffer)
static
inline
void
static
inline
void
hb_ot_position_default
(
hb_ot_shape_context_t
*
c
)
hb_ot_position_default
(
hb_ot_shape_context_t
*
c
)
{
{
hb_direction_t
direction
=
c
->
buffer
->
props
.
direction
;
unsigned
int
count
=
c
->
buffer
->
len
;
unsigned
int
count
=
c
->
buffer
->
len
;
hb_glyph_info_t
*
info
=
c
->
buffer
->
info
;
hb_glyph_position_t
*
pos
=
c
->
buffer
->
pos
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
{
{
c
->
font
->
get_glyph_advance_for_direction
(
c
->
buffer
->
info
[
i
].
codepoint
,
c
->
font
->
get_glyph_advance_for_direction
(
info
[
i
].
codepoint
,
c
->
buffer
->
props
.
direction
,
direction
,
&
c
->
buffer
->
pos
[
i
].
x_advance
,
&
pos
[
i
].
x_advance
,
&
c
->
buffer
->
pos
[
i
].
y_advance
);
&
pos
[
i
].
y_advance
);
c
->
font
->
subtract_glyph_origin_for_direction
(
c
->
buffer
->
info
[
i
].
codepoint
,
c
->
font
->
subtract_glyph_origin_for_direction
(
info
[
i
].
codepoint
,
c
->
buffer
->
props
.
direction
,
direction
,
&
c
->
buffer
->
pos
[
i
].
x_offset
,
&
pos
[
i
].
x_offset
,
&
c
->
buffer
->
pos
[
i
].
y_offset
);
&
pos
[
i
].
y_offset
);
}
}
}
}
...
@@ -462,22 +473,25 @@ hb_ot_position_complex (hb_ot_shape_context_t *c)
...
@@ -462,22 +473,25 @@ hb_ot_position_complex (hb_ot_shape_context_t *c)
if
(
hb_ot_layout_has_positioning
(
c
->
face
))
if
(
hb_ot_layout_has_positioning
(
c
->
face
))
{
{
hb_glyph_info_t
*
info
=
c
->
buffer
->
info
;
hb_glyph_position_t
*
pos
=
c
->
buffer
->
pos
;
/* Change glyph origin to what GPOS expects, apply GPOS, change it back. */
/* Change glyph origin to what GPOS expects, apply GPOS, change it back. */
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
{
c
->
font
->
add_glyph_origin_for_direction
(
c
->
buffer
->
info
[
i
].
codepoint
,
c
->
font
->
add_glyph_origin_for_direction
(
info
[
i
].
codepoint
,
HB_DIRECTION_LTR
,
HB_DIRECTION_LTR
,
&
c
->
buffer
->
pos
[
i
].
x_offset
,
&
pos
[
i
].
x_offset
,
&
c
->
buffer
->
pos
[
i
].
y_offset
);
&
pos
[
i
].
y_offset
);
}
}
c
->
plan
->
position
(
c
->
font
,
c
->
buffer
);
c
->
plan
->
position
(
c
->
font
,
c
->
buffer
);
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
{
c
->
font
->
subtract_glyph_origin_for_direction
(
c
->
buffer
->
info
[
i
].
codepoint
,
c
->
font
->
subtract_glyph_origin_for_direction
(
info
[
i
].
codepoint
,
HB_DIRECTION_LTR
,
HB_DIRECTION_LTR
,
&
c
->
buffer
->
pos
[
i
].
x_offset
,
&
pos
[
i
].
x_offset
,
&
c
->
buffer
->
pos
[
i
].
y_offset
);
&
pos
[
i
].
y_offset
);
}
}
ret
=
true
;
ret
=
true
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录