Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
abcfe9b5
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看板
提交
abcfe9b5
编写于
5月 11, 2011
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove hb_ot_layout_context_t, simplify code
上级
1ded6d8b
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
118 addition
and
126 deletion
+118
-126
src/hb-font-private.hh
src/hb-font-private.hh
+10
-2
src/hb-font.cc
src/hb-font.cc
+5
-1
src/hb-ot-layout-common-private.hh
src/hb-ot-layout-common-private.hh
+4
-4
src/hb-ot-layout-gdef-private.hh
src/hb-ot-layout-gdef-private.hh
+17
-17
src/hb-ot-layout-gpos-private.hh
src/hb-ot-layout-gpos-private.hh
+61
-60
src/hb-ot-layout-gsub-private.hh
src/hb-ot-layout-gsub-private.hh
+12
-12
src/hb-ot-layout-gsubgpos-private.hh
src/hb-ot-layout-gsubgpos-private.hh
+6
-5
src/hb-ot-layout-private.hh
src/hb-ot-layout-private.hh
+0
-13
src/hb-ot-layout.cc
src/hb-ot-layout.cc
+3
-12
未找到文件。
src/hb-font-private.hh
浏览文件 @
abcfe9b5
...
...
@@ -85,9 +85,9 @@ struct _hb_face_t {
void
*
user_data
;
hb_destroy_func_t
destroy
;
hb_blob_t
*
head_blob
;
struct
hb_ot_layout_t
*
ot_layout
;
unsigned
int
upem
;
};
...
...
@@ -112,6 +112,14 @@ struct _hb_font_t {
hb_font_funcs_t
*
klass
;
void
*
user_data
;
hb_destroy_func_t
destroy
;
/* Convert from font-space to user-space */
inline
hb_position_t
scale_x
(
int16_t
v
)
{
return
scale
(
v
,
this
->
x_scale
);
}
inline
hb_position_t
scale_y
(
int16_t
v
)
{
return
scale
(
v
,
this
->
y_scale
);
}
private:
inline
hb_position_t
scale
(
int16_t
v
,
int
scale
)
{
return
v
*
(
int64_t
)
scale
/
this
->
face
->
upem
;
}
};
...
...
src/hb-font.cc
浏览文件 @
abcfe9b5
...
...
@@ -299,7 +299,9 @@ static hb_face_t _hb_face_nil = {
NULL
,
/* user_data */
NULL
,
/* destroy */
NULL
/* ot_layout */
NULL
,
/* ot_layout */
1000
};
...
...
@@ -322,6 +324,8 @@ hb_face_create_for_tables (hb_get_table_func_t get_table,
face
->
ot_layout
=
_hb_ot_layout_create
(
face
);
face
->
upem
=
_hb_ot_layout_get_upem
(
face
);
return
face
;
}
...
...
src/hb-ot-layout-common-private.hh
浏览文件 @
abcfe9b5
...
...
@@ -526,11 +526,11 @@ struct ClassDef
struct
Device
{
inline
hb_position_t
get_x_delta
(
hb_
ot_layout_context_t
*
c
)
const
{
return
get_delta
(
c
->
font
->
x_ppem
,
c
->
font
->
x_scale
);
}
inline
hb_position_t
get_x_delta
(
hb_
font_t
*
font
)
const
{
return
get_delta
(
font
->
x_ppem
,
font
->
x_scale
);
}
inline
hb_position_t
get_y_delta
(
hb_
ot_layout_context_t
*
c
)
const
{
return
get_delta
(
c
->
font
->
y_ppem
,
c
->
font
->
y_scale
);
}
inline
hb_position_t
get_y_delta
(
hb_
font_t
*
font
)
const
{
return
get_delta
(
font
->
y_ppem
,
font
->
y_scale
);
}
inline
int
get_delta
(
unsigned
int
ppem
,
int
scale
)
const
{
...
...
src/hb-ot-layout-gdef-private.hh
浏览文件 @
abcfe9b5
...
...
@@ -96,9 +96,9 @@ struct CaretValueFormat1
friend
struct
CaretValue
;
private:
inline
int
get_caret_value
(
hb_
ot_layout_context_t
*
c
,
hb_direction_t
direction
,
hb_codepoint_t
glyph_id
HB_UNUSED
)
const
inline
int
get_caret_value
(
hb_
font_t
*
font
,
hb_direction_t
direction
,
hb_codepoint_t
glyph_id
HB_UNUSED
)
const
{
return
HB_DIRECTION_IS_HORIZONTAL
(
direction
)
?
c
->
scale_x
(
coordinate
)
:
c
->
scale_y
(
coordinate
);
return
HB_DIRECTION_IS_HORIZONTAL
(
direction
)
?
font
->
scale_x
(
coordinate
)
:
font
->
scale_y
(
coordinate
);
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
...
...
@@ -118,10 +118,10 @@ struct CaretValueFormat2
friend
struct
CaretValue
;
private:
inline
int
get_caret_value
(
hb_
ot_layout_context_t
*
c
,
hb_direction_t
direction
,
hb_codepoint_t
glyph_id
)
const
inline
int
get_caret_value
(
hb_
font_t
*
font
,
hb_direction_t
direction
,
hb_codepoint_t
glyph_id
)
const
{
hb_position_t
x
,
y
;
if
(
hb_font_get_contour_point
(
c
->
font
,
caretValuePoint
,
glyph_id
,
&
x
,
&
y
))
if
(
hb_font_get_contour_point
(
font
,
caretValuePoint
,
glyph_id
,
&
x
,
&
y
))
return
HB_DIRECTION_IS_HORIZONTAL
(
direction
)
?
x
:
y
;
else
return
0
;
...
...
@@ -143,11 +143,11 @@ struct CaretValueFormat3
{
friend
struct
CaretValue
;
inline
int
get_caret_value
(
hb_
ot_layout_context_t
*
c
,
hb_direction_t
direction
,
hb_codepoint_t
glyph_id
)
const
inline
int
get_caret_value
(
hb_
font_t
*
font
,
hb_direction_t
direction
,
hb_codepoint_t
glyph_id
)
const
{
return
HB_DIRECTION_IS_HORIZONTAL
(
direction
)
?
c
->
scale_x
(
coordinate
)
+
(
this
+
deviceTable
).
get_x_delta
(
c
)
:
c
->
scale_y
(
coordinate
)
+
(
this
+
deviceTable
).
get_y_delta
(
c
);
font
->
scale_x
(
coordinate
)
+
(
this
+
deviceTable
).
get_x_delta
(
font
)
:
font
->
scale_y
(
coordinate
)
+
(
this
+
deviceTable
).
get_y_delta
(
font
);
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
...
...
@@ -169,12 +169,12 @@ struct CaretValueFormat3
struct
CaretValue
{
inline
int
get_caret_value
(
hb_
ot_layout_context_t
*
c
,
hb_direction_t
direction
,
hb_codepoint_t
glyph_id
)
const
inline
int
get_caret_value
(
hb_
font_t
*
font
,
hb_direction_t
direction
,
hb_codepoint_t
glyph_id
)
const
{
switch
(
u
.
format
)
{
case
1
:
return
u
.
format1
.
get_caret_value
(
c
,
direction
,
glyph_id
);
case
2
:
return
u
.
format2
.
get_caret_value
(
c
,
direction
,
glyph_id
);
case
3
:
return
u
.
format3
.
get_caret_value
(
c
,
direction
,
glyph_id
);
case
1
:
return
u
.
format1
.
get_caret_value
(
font
,
direction
,
glyph_id
);
case
2
:
return
u
.
format2
.
get_caret_value
(
font
,
direction
,
glyph_id
);
case
3
:
return
u
.
format3
.
get_caret_value
(
font
,
direction
,
glyph_id
);
default:
return
0
;
}
}
...
...
@@ -203,7 +203,7 @@ struct CaretValue
struct
LigGlyph
{
inline
unsigned
int
get_lig_carets
(
hb_
ot_layout_context_t
*
c
,
inline
unsigned
int
get_lig_carets
(
hb_
font_t
*
font
,
hb_direction_t
direction
,
hb_codepoint_t
glyph_id
,
unsigned
int
start_offset
,
...
...
@@ -214,7 +214,7 @@ struct LigGlyph
const
OffsetTo
<
CaretValue
>
*
array
=
carets
.
sub_array
(
start_offset
,
caret_count
);
unsigned
int
count
=
*
caret_count
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
caret_array
[
i
]
=
(
this
+
array
[
i
]).
get_caret_value
(
c
,
direction
,
glyph_id
);
caret_array
[
i
]
=
(
this
+
array
[
i
]).
get_caret_value
(
font
,
direction
,
glyph_id
);
}
return
carets
.
len
;
...
...
@@ -236,7 +236,7 @@ struct LigGlyph
struct
LigCaretList
{
inline
unsigned
int
get_lig_carets
(
hb_
ot_layout_context_t
*
c
,
inline
unsigned
int
get_lig_carets
(
hb_
font_t
*
font
,
hb_direction_t
direction
,
hb_codepoint_t
glyph_id
,
unsigned
int
start_offset
,
...
...
@@ -251,7 +251,7 @@ struct LigCaretList
return
0
;
}
const
LigGlyph
&
lig_glyph
=
this
+
ligGlyph
[
index
];
return
lig_glyph
.
get_lig_carets
(
c
,
direction
,
glyph_id
,
start_offset
,
caret_count
,
caret_array
);
return
lig_glyph
.
get_lig_carets
(
font
,
direction
,
glyph_id
,
start_offset
,
caret_count
,
caret_array
);
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
...
...
@@ -352,13 +352,13 @@ struct GDEF
{
return
(
this
+
attachList
).
get_attach_points
(
glyph_id
,
start_offset
,
point_count
,
point_array
);
}
inline
bool
has_lig_carets
(
void
)
const
{
return
ligCaretList
!=
0
;
}
inline
unsigned
int
get_lig_carets
(
hb_
ot_layout_context_t
*
c
,
inline
unsigned
int
get_lig_carets
(
hb_
font_t
*
font
,
hb_direction_t
direction
,
hb_codepoint_t
glyph_id
,
unsigned
int
start_offset
,
unsigned
int
*
caret_count
/* IN/OUT */
,
int
*
caret_array
/* OUT */
)
const
{
return
(
this
+
ligCaretList
).
get_lig_carets
(
c
,
direction
,
glyph_id
,
start_offset
,
caret_count
,
caret_array
);
}
{
return
(
this
+
ligCaretList
).
get_lig_carets
(
font
,
direction
,
glyph_id
,
start_offset
,
caret_count
,
caret_array
);
}
inline
bool
has_mark_sets
(
void
)
const
{
return
version
>=
0x00010002
&&
markGlyphSetsDef
[
0
]
!=
0
;
}
inline
bool
mark_set_covers
(
unsigned
int
set_index
,
hb_codepoint_t
glyph_id
)
const
...
...
src/hb-ot-layout-gpos-private.hh
浏览文件 @
abcfe9b5
...
...
@@ -94,10 +94,10 @@ struct ValueFormat : USHORT
inline
unsigned
int
get_size
(
void
)
const
{
return
get_len
()
*
Value
::
static_size
;
}
void
apply_value
(
hb_
ot_layout_context_t
*
layou
t
,
const
void
*
base
,
const
Value
*
values
,
hb_glyph_position_t
&
glyph_pos
)
const
void
apply_value
(
hb_
font_t
*
fon
t
,
const
void
*
base
,
const
Value
*
values
,
hb_glyph_position_t
&
glyph_pos
)
const
{
unsigned
int
x_ppem
,
y_ppem
;
unsigned
int
format
=
*
this
;
...
...
@@ -105,30 +105,30 @@ struct ValueFormat : USHORT
if
(
!
format
)
return
;
/* design units -> fractional pixel */
if
(
format
&
xPlacement
)
glyph_pos
.
x_offset
+=
layou
t
->
scale_x
(
get_short
(
values
++
));
if
(
format
&
yPlacement
)
glyph_pos
.
y_offset
+=
layou
t
->
scale_y
(
get_short
(
values
++
));
if
(
format
&
xAdvance
)
glyph_pos
.
x_advance
+=
layou
t
->
scale_x
(
get_short
(
values
++
));
if
(
format
&
yAdvance
)
glyph_pos
.
y_advance
+=
layou
t
->
scale_y
(
get_short
(
values
++
));
if
(
format
&
xPlacement
)
glyph_pos
.
x_offset
+=
fon
t
->
scale_x
(
get_short
(
values
++
));
if
(
format
&
yPlacement
)
glyph_pos
.
y_offset
+=
fon
t
->
scale_y
(
get_short
(
values
++
));
if
(
format
&
xAdvance
)
glyph_pos
.
x_advance
+=
fon
t
->
scale_x
(
get_short
(
values
++
));
if
(
format
&
yAdvance
)
glyph_pos
.
y_advance
+=
fon
t
->
scale_y
(
get_short
(
values
++
));
if
(
!
has_device
())
return
;
x_ppem
=
layout
->
font
->
x_ppem
;
y_ppem
=
layout
->
font
->
y_ppem
;
x_ppem
=
font
->
x_ppem
;
y_ppem
=
font
->
y_ppem
;
if
(
!
x_ppem
&&
!
y_ppem
)
return
;
/* pixel -> fractional pixel */
if
(
format
&
xPlaDevice
)
{
if
(
x_ppem
)
glyph_pos
.
x_offset
+=
(
base
+
get_device
(
values
++
)).
get_x_delta
(
layou
t
);
else
values
++
;
if
(
x_ppem
)
glyph_pos
.
x_offset
+=
(
base
+
get_device
(
values
++
)).
get_x_delta
(
fon
t
);
else
values
++
;
}
if
(
format
&
yPlaDevice
)
{
if
(
y_ppem
)
glyph_pos
.
y_offset
+=
(
base
+
get_device
(
values
++
)).
get_y_delta
(
layou
t
);
else
values
++
;
if
(
y_ppem
)
glyph_pos
.
y_offset
+=
(
base
+
get_device
(
values
++
)).
get_y_delta
(
fon
t
);
else
values
++
;
}
if
(
format
&
xAdvDevice
)
{
if
(
x_ppem
)
glyph_pos
.
x_advance
+=
(
base
+
get_device
(
values
++
)).
get_x_delta
(
layou
t
);
else
values
++
;
if
(
x_ppem
)
glyph_pos
.
x_advance
+=
(
base
+
get_device
(
values
++
)).
get_x_delta
(
fon
t
);
else
values
++
;
}
if
(
format
&
yAdvDevice
)
{
if
(
y_ppem
)
glyph_pos
.
y_advance
+=
(
base
+
get_device
(
values
++
)).
get_y_delta
(
layou
t
);
else
values
++
;
if
(
y_ppem
)
glyph_pos
.
y_advance
+=
(
base
+
get_device
(
values
++
)).
get_y_delta
(
fon
t
);
else
values
++
;
}
}
...
...
@@ -209,11 +209,11 @@ struct AnchorFormat1
friend
struct
Anchor
;
private:
inline
void
get_anchor
(
hb_
ot_layout_context_t
*
layou
t
,
hb_codepoint_t
glyph_id
HB_UNUSED
,
inline
void
get_anchor
(
hb_
font_t
*
fon
t
,
hb_codepoint_t
glyph_id
HB_UNUSED
,
hb_position_t
*
x
,
hb_position_t
*
y
)
const
{
*
x
=
layou
t
->
scale_x
(
xCoordinate
);
*
y
=
layou
t
->
scale_y
(
yCoordinate
);
*
x
=
fon
t
->
scale_x
(
xCoordinate
);
*
y
=
fon
t
->
scale_y
(
yCoordinate
);
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
...
...
@@ -234,18 +234,18 @@ struct AnchorFormat2
friend
struct
Anchor
;
private:
inline
void
get_anchor
(
hb_
ot_layout_context_t
*
layou
t
,
hb_codepoint_t
glyph_id
,
inline
void
get_anchor
(
hb_
font_t
*
fon
t
,
hb_codepoint_t
glyph_id
,
hb_position_t
*
x
,
hb_position_t
*
y
)
const
{
unsigned
int
x_ppem
=
layout
->
font
->
x_ppem
;
unsigned
int
y_ppem
=
layout
->
font
->
y_ppem
;
unsigned
int
x_ppem
=
font
->
x_ppem
;
unsigned
int
y_ppem
=
font
->
y_ppem
;
hb_position_t
cx
,
cy
;
hb_bool_t
ret
=
false
;
if
(
x_ppem
||
y_ppem
)
ret
=
hb_font_get_contour_point
(
layout
->
font
,
anchorPoint
,
glyph_id
,
&
cx
,
&
cy
);
*
x
=
x_ppem
&&
ret
?
cx
:
layou
t
->
scale_x
(
xCoordinate
);
*
y
=
y_ppem
&&
ret
?
cy
:
layou
t
->
scale_y
(
yCoordinate
);
ret
=
hb_font_get_contour_point
(
font
,
anchorPoint
,
glyph_id
,
&
cx
,
&
cy
);
*
x
=
x_ppem
&&
ret
?
cx
:
fon
t
->
scale_x
(
xCoordinate
);
*
y
=
y_ppem
&&
ret
?
cy
:
fon
t
->
scale_y
(
yCoordinate
);
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
...
...
@@ -267,17 +267,17 @@ struct AnchorFormat3
friend
struct
Anchor
;
private:
inline
void
get_anchor
(
hb_
ot_layout_context_t
*
layou
t
,
hb_codepoint_t
glyph_id
HB_UNUSED
,
inline
void
get_anchor
(
hb_
font_t
*
fon
t
,
hb_codepoint_t
glyph_id
HB_UNUSED
,
hb_position_t
*
x
,
hb_position_t
*
y
)
const
{
*
x
=
layou
t
->
scale_x
(
xCoordinate
);
*
y
=
layou
t
->
scale_y
(
yCoordinate
);
*
x
=
fon
t
->
scale_x
(
xCoordinate
);
*
y
=
fon
t
->
scale_y
(
yCoordinate
);
/* pixel -> fractional pixel */
if
(
layout
->
font
->
x_ppem
)
*
x
+=
(
this
+
xDeviceTable
).
get_x_delta
(
layou
t
);
if
(
layout
->
font
->
y_ppem
)
*
y
+=
(
this
+
yDeviceTable
).
get_x_delta
(
layou
t
);
if
(
font
->
x_ppem
)
*
x
+=
(
this
+
xDeviceTable
).
get_x_delta
(
fon
t
);
if
(
font
->
y_ppem
)
*
y
+=
(
this
+
yDeviceTable
).
get_x_delta
(
fon
t
);
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
...
...
@@ -305,15 +305,15 @@ struct AnchorFormat3
struct
Anchor
{
inline
void
get_anchor
(
hb_
ot_layout_context_t
*
layou
t
,
hb_codepoint_t
glyph_id
,
inline
void
get_anchor
(
hb_
font_t
*
fon
t
,
hb_codepoint_t
glyph_id
,
hb_position_t
*
x
,
hb_position_t
*
y
)
const
{
*
x
=
*
y
=
0
;
switch
(
u
.
format
)
{
case
1
:
u
.
format1
.
get_anchor
(
layou
t
,
glyph_id
,
x
,
y
);
return
;
case
2
:
u
.
format2
.
get_anchor
(
layou
t
,
glyph_id
,
x
,
y
);
return
;
case
3
:
u
.
format3
.
get_anchor
(
layou
t
,
glyph_id
,
x
,
y
);
return
;
default:
return
;
case
1
:
u
.
format1
.
get_anchor
(
fon
t
,
glyph_id
,
x
,
y
);
return
;
case
2
:
u
.
format2
.
get_anchor
(
fon
t
,
glyph_id
,
x
,
y
);
return
;
case
3
:
u
.
format3
.
get_anchor
(
fon
t
,
glyph_id
,
x
,
y
);
return
;
default:
return
;
}
}
...
...
@@ -403,8 +403,8 @@ struct MarkArray : ArrayOf<MarkRecord> /* Array of MarkRecords--in Coverage orde
hb_position_t
mark_x
,
mark_y
,
base_x
,
base_y
;
mark_anchor
.
get_anchor
(
c
->
layou
t
,
c
->
buffer
->
info
[
c
->
buffer
->
i
].
codepoint
,
&
mark_x
,
&
mark_y
);
glyph_anchor
.
get_anchor
(
c
->
layou
t
,
c
->
buffer
->
info
[
glyph_pos
].
codepoint
,
&
base_x
,
&
base_y
);
mark_anchor
.
get_anchor
(
c
->
fon
t
,
c
->
buffer
->
info
[
c
->
buffer
->
i
].
codepoint
,
&
mark_x
,
&
mark_y
);
glyph_anchor
.
get_anchor
(
c
->
fon
t
,
c
->
buffer
->
info
[
glyph_pos
].
codepoint
,
&
base_x
,
&
base_y
);
hb_glyph_position_t
&
o
=
c
->
buffer
->
pos
[
c
->
buffer
->
i
];
o
.
x_offset
=
base_x
-
mark_x
;
...
...
@@ -436,7 +436,7 @@ struct SinglePosFormat1
if
(
likely
(
index
==
NOT_COVERED
))
return
false
;
valueFormat
.
apply_value
(
c
->
layou
t
,
this
,
values
,
c
->
buffer
->
pos
[
c
->
buffer
->
i
]);
valueFormat
.
apply_value
(
c
->
fon
t
,
this
,
values
,
c
->
buffer
->
pos
[
c
->
buffer
->
i
]);
c
->
buffer
->
i
++
;
return
true
;
...
...
@@ -478,7 +478,7 @@ struct SinglePosFormat2
if
(
likely
(
index
>=
valueCount
))
return
false
;
valueFormat
.
apply_value
(
c
->
layou
t
,
this
,
valueFormat
.
apply_value
(
c
->
fon
t
,
this
,
&
values
[
index
*
valueFormat
.
get_len
()],
c
->
buffer
->
pos
[
c
->
buffer
->
i
]);
...
...
@@ -574,8 +574,8 @@ struct PairSet
{
if
(
c
->
buffer
->
info
[
pos
].
codepoint
==
record
->
secondGlyph
)
{
valueFormats
[
0
].
apply_value
(
c
->
layou
t
,
this
,
&
record
->
values
[
0
],
c
->
buffer
->
pos
[
c
->
buffer
->
i
]);
valueFormats
[
1
].
apply_value
(
c
->
layou
t
,
this
,
&
record
->
values
[
len1
],
c
->
buffer
->
pos
[
pos
]);
valueFormats
[
0
].
apply_value
(
c
->
fon
t
,
this
,
&
record
->
values
[
0
],
c
->
buffer
->
pos
[
c
->
buffer
->
i
]);
valueFormats
[
1
].
apply_value
(
c
->
fon
t
,
this
,
&
record
->
values
[
len1
],
c
->
buffer
->
pos
[
pos
]);
if
(
len2
)
pos
++
;
c
->
buffer
->
i
=
pos
;
...
...
@@ -630,7 +630,7 @@ struct PairPosFormat1
return
false
;
unsigned
int
j
=
c
->
buffer
->
i
+
1
;
while
(
_hb_ot_layout_skip_mark
(
c
->
layout
->
face
,
&
c
->
buffer
->
info
[
j
],
c
->
lookup_props
,
NULL
))
while
(
_hb_ot_layout_skip_mark
(
c
->
face
,
&
c
->
buffer
->
info
[
j
],
c
->
lookup_props
,
NULL
))
{
if
(
unlikely
(
j
==
end
))
return
false
;
...
...
@@ -692,7 +692,7 @@ struct PairPosFormat2
return
false
;
unsigned
int
j
=
c
->
buffer
->
i
+
1
;
while
(
_hb_ot_layout_skip_mark
(
c
->
layout
->
face
,
&
c
->
buffer
->
info
[
j
],
c
->
lookup_props
,
NULL
))
while
(
_hb_ot_layout_skip_mark
(
c
->
face
,
&
c
->
buffer
->
info
[
j
],
c
->
lookup_props
,
NULL
))
{
if
(
unlikely
(
j
==
end
))
return
false
;
...
...
@@ -709,8 +709,8 @@ struct PairPosFormat2
return
false
;
const
Value
*
v
=
&
values
[
record_len
*
(
klass1
*
class2Count
+
klass2
)];
valueFormat1
.
apply_value
(
c
->
layou
t
,
this
,
v
,
c
->
buffer
->
pos
[
c
->
buffer
->
i
]);
valueFormat2
.
apply_value
(
c
->
layou
t
,
this
,
v
+
len1
,
c
->
buffer
->
pos
[
j
]);
valueFormat1
.
apply_value
(
c
->
fon
t
,
this
,
v
,
c
->
buffer
->
pos
[
c
->
buffer
->
i
]);
valueFormat2
.
apply_value
(
c
->
fon
t
,
this
,
v
+
len1
,
c
->
buffer
->
pos
[
j
]);
if
(
len2
)
j
++
;
...
...
@@ -845,7 +845,7 @@ struct CursivePosFormat1
return
false
;
unsigned
int
j
=
c
->
buffer
->
i
+
1
;
while
(
_hb_ot_layout_skip_mark
(
c
->
layout
->
face
,
&
c
->
buffer
->
info
[
j
],
c
->
lookup_props
,
NULL
))
while
(
_hb_ot_layout_skip_mark
(
c
->
face
,
&
c
->
buffer
->
info
[
j
],
c
->
lookup_props
,
NULL
))
{
if
(
unlikely
(
j
==
end
))
return
false
;
...
...
@@ -859,8 +859,8 @@ struct CursivePosFormat1
unsigned
int
i
=
c
->
buffer
->
i
;
hb_position_t
entry_x
,
entry_y
,
exit_x
,
exit_y
;
(
this
+
this_record
.
exitAnchor
).
get_anchor
(
c
->
layou
t
,
c
->
buffer
->
info
[
i
].
codepoint
,
&
exit_x
,
&
exit_y
);
(
this
+
next_record
.
entryAnchor
).
get_anchor
(
c
->
layou
t
,
c
->
buffer
->
info
[
j
].
codepoint
,
&
entry_x
,
&
entry_y
);
(
this
+
this_record
.
exitAnchor
).
get_anchor
(
c
->
fon
t
,
c
->
buffer
->
info
[
i
].
codepoint
,
&
exit_x
,
&
exit_y
);
(
this
+
next_record
.
entryAnchor
).
get_anchor
(
c
->
fon
t
,
c
->
buffer
->
info
[
j
].
codepoint
,
&
entry_x
,
&
entry_y
);
hb_direction_t
direction
=
c
->
buffer
->
props
.
direction
;
...
...
@@ -976,7 +976,7 @@ struct MarkBasePosFormat1
if
(
unlikely
(
!
j
))
return
false
;
j
--
;
}
while
(
_hb_ot_layout_skip_mark
(
c
->
layout
->
face
,
&
c
->
buffer
->
info
[
j
],
LookupFlag
::
IgnoreMarks
,
&
property
));
}
while
(
_hb_ot_layout_skip_mark
(
c
->
face
,
&
c
->
buffer
->
info
[
j
],
LookupFlag
::
IgnoreMarks
,
&
property
));
/* The following assertion is too strong, so we've disabled it. */
if
(
!
(
property
&
HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH
))
...
...
@@ -1078,7 +1078,7 @@ struct MarkLigPosFormat1
if
(
unlikely
(
!
j
))
return
false
;
j
--
;
}
while
(
_hb_ot_layout_skip_mark
(
c
->
layout
->
face
,
&
c
->
buffer
->
info
[
j
],
LookupFlag
::
IgnoreMarks
,
&
property
));
}
while
(
_hb_ot_layout_skip_mark
(
c
->
face
,
&
c
->
buffer
->
info
[
j
],
LookupFlag
::
IgnoreMarks
,
&
property
));
/* The following assertion is too strong, so we've disabled it. */
if
(
!
(
property
&
HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE
))
...
...
@@ -1197,7 +1197,7 @@ struct MarkMarkPosFormat1
if
(
unlikely
(
!
j
))
return
false
;
j
--
;
}
while
(
_hb_ot_layout_skip_mark
(
c
->
layout
->
face
,
&
c
->
buffer
->
info
[
j
],
c
->
lookup_props
,
&
property
));
}
while
(
_hb_ot_layout_skip_mark
(
c
->
face
,
&
c
->
buffer
->
info
[
j
],
c
->
lookup_props
,
&
property
));
if
(
!
(
property
&
HB_OT_LAYOUT_GLYPH_CLASS_MARK
))
return
false
;
...
...
@@ -1402,7 +1402,7 @@ struct PosLookup : Lookup
inline
const
PosLookupSubTable
&
get_subtable
(
unsigned
int
i
)
const
{
return
this
+
CastR
<
OffsetArrayOf
<
PosLookupSubTable
>
>
(
subTable
)[
i
];
}
inline
bool
apply_once
(
hb_
ot_layout_context_t
*
layou
t
,
inline
bool
apply_once
(
hb_
font_t
*
fon
t
,
hb_buffer_t
*
buffer
,
hb_mask_t
lookup_mask
,
unsigned
int
context_length
,
...
...
@@ -1411,14 +1411,15 @@ struct PosLookup : Lookup
unsigned
int
lookup_type
=
get_type
();
hb_apply_context_t
c
[
1
]
=
{{
0
}};
c
->
layout
=
layout
;
c
->
font
=
font
;
c
->
face
=
font
->
face
;
c
->
buffer
=
buffer
;
c
->
lookup_mask
=
lookup_mask
;
c
->
context_length
=
context_length
;
c
->
nesting_level_left
=
nesting_level_left
;
c
->
lookup_props
=
get_props
();
if
(
!
_hb_ot_layout_check_glyph_property
(
c
->
layout
->
face
,
&
c
->
buffer
->
info
[
c
->
buffer
->
i
],
c
->
lookup_props
,
&
c
->
property
))
if
(
!
_hb_ot_layout_check_glyph_property
(
c
->
face
,
&
c
->
buffer
->
info
[
c
->
buffer
->
i
],
c
->
lookup_props
,
&
c
->
property
))
return
false
;
for
(
unsigned
int
i
=
0
;
i
<
get_subtable_count
();
i
++
)
...
...
@@ -1428,7 +1429,7 @@ struct PosLookup : Lookup
return
false
;
}
inline
bool
apply_string
(
hb_
ot_layout_context_t
*
layou
t
,
inline
bool
apply_string
(
hb_
font_t
*
fon
t
,
hb_buffer_t
*
buffer
,
hb_mask_t
mask
)
const
{
...
...
@@ -1441,7 +1442,7 @@ struct PosLookup : Lookup
while
(
buffer
->
i
<
buffer
->
len
)
{
if
((
buffer
->
info
[
buffer
->
i
].
mask
&
mask
)
&&
apply_once
(
layou
t
,
buffer
,
mask
,
NO_CONTEXT
,
MAX_NESTING_LEVEL
))
apply_once
(
fon
t
,
buffer
,
mask
,
NO_CONTEXT
,
MAX_NESTING_LEVEL
))
ret
=
true
;
else
buffer
->
i
++
;
...
...
@@ -1471,11 +1472,11 @@ struct GPOS : GSUBGPOS
inline
const
PosLookup
&
get_lookup
(
unsigned
int
i
)
const
{
return
CastR
<
PosLookup
>
(
GSUBGPOS
::
get_lookup
(
i
));
}
inline
bool
position_lookup
(
hb_
ot_layout_context_t
*
layou
t
,
inline
bool
position_lookup
(
hb_
font_t
*
fon
t
,
hb_buffer_t
*
buffer
,
unsigned
int
lookup_index
,
hb_mask_t
mask
)
const
{
return
get_lookup
(
lookup_index
).
apply_string
(
layou
t
,
buffer
,
mask
);
}
{
return
get_lookup
(
lookup_index
).
apply_string
(
fon
t
,
buffer
,
mask
);
}
static
inline
void
position_finish
(
hb_buffer_t
*
buffer
);
...
...
@@ -1566,7 +1567,7 @@ inline bool ExtensionPos::sanitize (hb_sanitize_context_t *c)
static
inline
bool
position_lookup
(
hb_apply_context_t
*
c
,
unsigned
int
lookup_index
)
{
const
GPOS
&
gpos
=
*
(
c
->
layout
->
face
->
ot_layout
->
gpos
);
const
GPOS
&
gpos
=
*
(
c
->
face
->
ot_layout
->
gpos
);
const
PosLookup
&
l
=
gpos
.
get_lookup
(
lookup_index
);
if
(
unlikely
(
c
->
nesting_level_left
==
0
))
...
...
@@ -1575,7 +1576,7 @@ static inline bool position_lookup (hb_apply_context_t *c, unsigned int lookup_i
if
(
unlikely
(
c
->
context_length
<
1
))
return
false
;
return
l
.
apply_once
(
c
->
layou
t
,
c
->
buffer
,
c
->
lookup_mask
,
c
->
context_length
,
c
->
nesting_level_left
-
1
);
return
l
.
apply_once
(
c
->
fon
t
,
c
->
buffer
,
c
->
lookup_mask
,
c
->
context_length
,
c
->
nesting_level_left
-
1
);
}
...
...
src/hb-ot-layout-gsub-private.hh
浏览文件 @
abcfe9b5
...
...
@@ -354,7 +354,7 @@ struct Ligature
for
(
i
=
1
,
j
=
c
->
buffer
->
i
+
1
;
i
<
count
;
i
++
,
j
++
)
{
unsigned
int
property
;
while
(
_hb_ot_layout_skip_mark
(
c
->
layout
->
face
,
&
c
->
buffer
->
info
[
j
],
c
->
lookup_props
,
&
property
))
while
(
_hb_ot_layout_skip_mark
(
c
->
face
,
&
c
->
buffer
->
info
[
j
],
c
->
lookup_props
,
&
property
))
{
if
(
unlikely
(
j
+
count
-
i
==
end
))
return
false
;
...
...
@@ -392,7 +392,7 @@ struct Ligature
for
(
i
=
1
;
i
<
count
;
i
++
)
{
while
(
_hb_ot_layout_skip_mark
(
c
->
layout
->
face
,
&
c
->
buffer
->
info
[
c
->
buffer
->
i
],
c
->
lookup_props
,
NULL
))
while
(
_hb_ot_layout_skip_mark
(
c
->
face
,
&
c
->
buffer
->
info
[
c
->
buffer
->
i
],
c
->
lookup_props
,
NULL
))
{
c
->
buffer
->
info
[
c
->
buffer
->
i
].
lig_comp
()
=
i
;
c
->
buffer
->
info
[
c
->
buffer
->
i
].
lig_id
()
=
lig_id
;
...
...
@@ -762,7 +762,7 @@ struct SubstLookup : Lookup
}
inline
bool
apply_once
(
hb_
ot_layout_context_t
*
layout
,
inline
bool
apply_once
(
hb_
face_t
*
face
,
hb_buffer_t
*
buffer
,
hb_mask_t
lookup_mask
,
unsigned
int
context_length
,
...
...
@@ -771,14 +771,14 @@ struct SubstLookup : Lookup
unsigned
int
lookup_type
=
get_type
();
hb_apply_context_t
c
[
1
]
=
{{
0
}};
c
->
layout
=
layout
;
c
->
face
=
face
;
c
->
buffer
=
buffer
;
c
->
lookup_mask
=
lookup_mask
;
c
->
context_length
=
context_length
;
c
->
nesting_level_left
=
nesting_level_left
;
c
->
lookup_props
=
get_props
();
if
(
!
_hb_ot_layout_check_glyph_property
(
c
->
layout
->
face
,
&
c
->
buffer
->
info
[
c
->
buffer
->
i
],
c
->
lookup_props
,
&
c
->
property
))
if
(
!
_hb_ot_layout_check_glyph_property
(
c
->
face
,
&
c
->
buffer
->
info
[
c
->
buffer
->
i
],
c
->
lookup_props
,
&
c
->
property
))
return
false
;
if
(
unlikely
(
lookup_type
==
SubstLookupSubTable
::
Extension
))
...
...
@@ -803,7 +803,7 @@ struct SubstLookup : Lookup
return
false
;
}
inline
bool
apply_string
(
hb_
ot_layout_context_t
*
layout
,
inline
bool
apply_string
(
hb_
face_t
*
face
,
hb_buffer_t
*
buffer
,
hb_mask_t
mask
)
const
{
...
...
@@ -820,7 +820,7 @@ struct SubstLookup : Lookup
while
(
buffer
->
i
<
buffer
->
len
)
{
if
((
buffer
->
info
[
buffer
->
i
].
mask
&
mask
)
&&
apply_once
(
layout
,
buffer
,
mask
,
NO_CONTEXT
,
MAX_NESTING_LEVEL
))
apply_once
(
face
,
buffer
,
mask
,
NO_CONTEXT
,
MAX_NESTING_LEVEL
))
ret
=
true
;
else
buffer
->
next_glyph
();
...
...
@@ -836,7 +836,7 @@ struct SubstLookup : Lookup
do
{
if
((
buffer
->
info
[
buffer
->
i
].
mask
&
mask
)
&&
apply_once
(
layout
,
buffer
,
mask
,
NO_CONTEXT
,
MAX_NESTING_LEVEL
))
apply_once
(
face
,
buffer
,
mask
,
NO_CONTEXT
,
MAX_NESTING_LEVEL
))
ret
=
true
;
else
buffer
->
i
--
;
...
...
@@ -869,11 +869,11 @@ struct GSUB : GSUBGPOS
inline
const
SubstLookup
&
get_lookup
(
unsigned
int
i
)
const
{
return
CastR
<
SubstLookup
>
(
GSUBGPOS
::
get_lookup
(
i
));
}
inline
bool
substitute_lookup
(
hb_
ot_layout_context_t
*
layout
,
inline
bool
substitute_lookup
(
hb_
face_t
*
face
,
hb_buffer_t
*
buffer
,
unsigned
int
lookup_index
,
hb_mask_t
mask
)
const
{
return
get_lookup
(
lookup_index
).
apply_string
(
layout
,
buffer
,
mask
);
}
{
return
get_lookup
(
lookup_index
).
apply_string
(
face
,
buffer
,
mask
);
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
TRACE_SANITIZE
();
...
...
@@ -913,7 +913,7 @@ inline bool ExtensionSubst::is_reverse (void) const
static
inline
bool
substitute_lookup
(
hb_apply_context_t
*
c
,
unsigned
int
lookup_index
)
{
const
GSUB
&
gsub
=
*
(
c
->
layout
->
face
->
ot_layout
->
gsub
);
const
GSUB
&
gsub
=
*
(
c
->
face
->
ot_layout
->
gsub
);
const
SubstLookup
&
l
=
gsub
.
get_lookup
(
lookup_index
);
if
(
unlikely
(
c
->
nesting_level_left
==
0
))
...
...
@@ -922,7 +922,7 @@ static inline bool substitute_lookup (hb_apply_context_t *c, unsigned int lookup
if
(
unlikely
(
c
->
context_length
<
1
))
return
false
;
return
l
.
apply_once
(
c
->
layout
,
c
->
buffer
,
c
->
lookup_mask
,
c
->
context_length
,
c
->
nesting_level_left
-
1
);
return
l
.
apply_once
(
c
->
face
,
c
->
buffer
,
c
->
lookup_mask
,
c
->
context_length
,
c
->
nesting_level_left
-
1
);
}
...
...
src/hb-ot-layout-gsubgpos-private.hh
浏览文件 @
abcfe9b5
...
...
@@ -53,7 +53,8 @@ HB_BEGIN_DECLS
struct
hb_apply_context_t
{
unsigned
int
debug_depth
;
hb_ot_layout_context_t
*
layout
;
hb_font_t
*
font
;
hb_face_t
*
face
;
hb_buffer_t
*
buffer
;
hb_mask_t
lookup_mask
;
unsigned
int
context_length
;
...
...
@@ -133,7 +134,7 @@ static inline bool match_input (hb_apply_context_t *c,
for
(
i
=
1
,
j
=
c
->
buffer
->
i
+
1
;
i
<
count
;
i
++
,
j
++
)
{
while
(
_hb_ot_layout_skip_mark
(
c
->
layout
->
face
,
&
c
->
buffer
->
info
[
j
],
c
->
lookup_props
,
NULL
))
while
(
_hb_ot_layout_skip_mark
(
c
->
face
,
&
c
->
buffer
->
info
[
j
],
c
->
lookup_props
,
NULL
))
{
if
(
unlikely
(
j
+
count
-
i
==
end
))
return
false
;
...
...
@@ -160,7 +161,7 @@ static inline bool match_backtrack (hb_apply_context_t *c,
for
(
unsigned
int
i
=
0
,
j
=
c
->
buffer
->
backtrack_len
()
-
1
;
i
<
count
;
i
++
,
j
--
)
{
while
(
_hb_ot_layout_skip_mark
(
c
->
layout
->
face
,
&
c
->
buffer
->
out_info
[
j
],
c
->
lookup_props
,
NULL
))
while
(
_hb_ot_layout_skip_mark
(
c
->
face
,
&
c
->
buffer
->
out_info
[
j
],
c
->
lookup_props
,
NULL
))
{
if
(
unlikely
(
j
+
1
==
count
-
i
))
return
false
;
...
...
@@ -188,7 +189,7 @@ static inline bool match_lookahead (hb_apply_context_t *c,
for
(
i
=
0
,
j
=
c
->
buffer
->
i
+
offset
;
i
<
count
;
i
++
,
j
++
)
{
while
(
_hb_ot_layout_skip_mark
(
c
->
layout
->
face
,
&
c
->
buffer
->
info
[
j
],
c
->
lookup_props
,
NULL
))
while
(
_hb_ot_layout_skip_mark
(
c
->
face
,
&
c
->
buffer
->
info
[
j
],
c
->
lookup_props
,
NULL
))
{
if
(
unlikely
(
j
+
count
-
i
==
end
))
return
false
;
...
...
@@ -242,7 +243,7 @@ static inline bool apply_lookup (hb_apply_context_t *c,
*/
for
(
unsigned
int
i
=
0
;
i
<
count
;
/* NOP */
)
{
while
(
_hb_ot_layout_skip_mark
(
c
->
layout
->
face
,
&
c
->
buffer
->
info
[
c
->
buffer
->
i
],
c
->
lookup_props
,
NULL
))
while
(
_hb_ot_layout_skip_mark
(
c
->
face
,
&
c
->
buffer
->
info
[
c
->
buffer
->
i
],
c
->
lookup_props
,
NULL
))
{
if
(
unlikely
(
c
->
buffer
->
i
==
end
))
return
true
;
...
...
src/hb-ot-layout-private.hh
浏览文件 @
abcfe9b5
...
...
@@ -96,19 +96,6 @@ struct hb_ot_layout_t
const
struct
head
*
head
;
};
struct
hb_ot_layout_context_t
{
hb_face_t
*
face
;
hb_font_t
*
font
;
/* Convert from font-space to user-space */
inline
hb_position_t
scale_x
(
int16_t
v
)
{
return
scale
(
v
,
this
->
font
->
x_scale
);
}
inline
hb_position_t
scale_y
(
int16_t
v
)
{
return
scale
(
v
,
this
->
font
->
y_scale
);
}
private:
inline
hb_position_t
scale
(
int16_t
v
,
int
scale
)
{
return
v
*
(
int64_t
)
scale
/
_hb_ot_layout_get_upem
(
this
->
face
);
}
};
HB_INTERNAL
hb_ot_layout_t
*
_hb_ot_layout_create
(
hb_face_t
*
face
);
...
...
src/hb-ot-layout.cc
浏览文件 @
abcfe9b5
...
...
@@ -203,10 +203,7 @@ hb_ot_layout_get_ligature_carets (hb_font_t *font,
unsigned
int
*
caret_count
/* IN/OUT */
,
int
*
caret_array
/* OUT */
)
{
hb_ot_layout_context_t
c
;
c
.
font
=
font
;
c
.
face
=
font
->
face
;
return
_get_gdef
(
c
.
face
).
get_lig_carets
(
&
c
,
direction
,
glyph
,
start_offset
,
caret_count
,
caret_array
);
return
_get_gdef
(
font
->
face
).
get_lig_carets
(
font
,
direction
,
glyph
,
start_offset
,
caret_count
,
caret_array
);
}
/*
...
...
@@ -448,10 +445,7 @@ hb_ot_layout_substitute_lookup (hb_face_t *face,
unsigned
int
lookup_index
,
hb_mask_t
mask
)
{
hb_ot_layout_context_t
c
;
c
.
font
=
NULL
;
c
.
face
=
face
;
return
_get_gsub
(
face
).
substitute_lookup
(
&
c
,
buffer
,
lookup_index
,
mask
);
return
_get_gsub
(
face
).
substitute_lookup
(
face
,
buffer
,
lookup_index
,
mask
);
}
...
...
@@ -477,10 +471,7 @@ hb_ot_layout_position_lookup (hb_font_t *font,
unsigned
int
lookup_index
,
hb_mask_t
mask
)
{
hb_ot_layout_context_t
c
;
c
.
font
=
font
;
c
.
face
=
font
->
face
;
return
_get_gpos
(
c
.
face
).
position_lookup
(
&
c
,
buffer
,
lookup_index
,
mask
);
return
_get_gpos
(
font
->
face
).
position_lookup
(
font
,
buffer
,
lookup_index
,
mask
);
}
void
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录