Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
55520d2a
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,发现更多精彩内容 >>
提交
55520d2a
编写于
6月 10, 2009
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
XX
上级
f53d434b
变更
12
显示空白变更内容
内联
并排
Showing
12 changed file
with
187 addition
and
174 deletion
+187
-174
src/Makefile.am
src/Makefile.am
+2
-0
src/hb-buffer.c
src/hb-buffer.c
+9
-0
src/hb-buffer.h
src/hb-buffer.h
+14
-0
src/hb-common.h
src/hb-common.h
+3
-0
src/hb-ot-layout-gdef-private.h
src/hb-ot-layout-gdef-private.h
+16
-16
src/hb-ot-layout-gpos-private.h
src/hb-ot-layout-gpos-private.h
+54
-54
src/hb-ot-layout-gsub-private.h
src/hb-ot-layout-gsub-private.h
+23
-23
src/hb-ot-layout-gsubgpos-private.h
src/hb-ot-layout-gsubgpos-private.h
+34
-34
src/hb-ot-layout-private.h
src/hb-ot-layout-private.h
+16
-12
src/hb-ot-layout.cc
src/hb-ot-layout.cc
+0
-30
src/hb-ot-layout.h
src/hb-ot-layout.h
+0
-5
src/hb-private.h
src/hb-private.h
+16
-0
未找到文件。
src/Makefile.am
浏览文件 @
55520d2a
...
...
@@ -11,6 +11,8 @@ CXX = gcc -g -O2 -fno-rtti -fno-exceptions -Wabi -Wpadded -Wcast-align
noinst_LTLIBRARIES
=
libharfbuzz-1.la
HBSOURCES
=
\
hb-common.c
\
hb-common-private.h
\
hb-buffer.c
\
hb-buffer-private.h
\
hb-private.h
\
...
...
src/hb-buffer.c
浏览文件 @
55520d2a
...
...
@@ -163,6 +163,15 @@ hb_buffer_add_glyph (hb_buffer_t *buffer,
buffer
->
in_length
++
;
}
void
hb_buffer_set_direction
(
hb_buffer_t
*
buffer
,
hb_direction_t
direction
)
{
buffer
->
direction
=
direction
;
}
/* HarfBuzz-Internal API */
HB_INTERNAL
void
...
...
src/hb-buffer.h
浏览文件 @
55520d2a
...
...
@@ -32,6 +32,13 @@
HB_BEGIN_DECLS
typedef
enum
_hb_direction_t
{
HB_DIRECTION_LTR
,
HB_DIRECTION_RTL
,
HB_DIRECTION_TTB
,
HB_DIRECTION_BTT
}
hb_direction_t
;
/* XXX Hide structs? */
typedef
struct
_hb_glyph_info_t
{
...
...
@@ -72,6 +79,8 @@ typedef struct _hb_buffer_t {
hb_glyph_info_t
*
out_string
;
hb_glyph_info_t
*
alt_string
;
hb_glyph_position_t
*
positions
;
hb_direction_t
direction
;
unsigned
int
max_lig_id
;
}
hb_buffer_t
;
...
...
@@ -90,6 +99,11 @@ hb_buffer_add_glyph (hb_buffer_t *buffer,
unsigned
int
properties
,
unsigned
int
cluster
);
void
hb_buffer_set_direction
(
hb_buffer_t
*
buffer
,
hb_direction_t
direction
);
HB_END_DECLS
#endif
/* HB_BUFFER_H */
src/hb-common.h
浏览文件 @
55520d2a
...
...
@@ -50,4 +50,7 @@ typedef uint32_t hb_codepoint_t;
typedef
int32_t
hb_position_t
;
typedef
int32_t
hb_16dot16_t
;
typedef
struct
_hb_face_t
hb_face_t
;
typedef
struct
_hb_font_t
hb_font_t
;
#endif
/* HB_COMMON_H */
src/hb-ot-layout-gdef-private.h
浏览文件 @
55520d2a
...
...
@@ -90,10 +90,10 @@ struct CaretValueFormat1
friend
struct
CaretValue
;
private:
inline
int
get_caret_value
(
hb_ot_layout_
t
*
layou
t
,
hb_codepoint_t
glyph_id
)
const
inline
int
get_caret_value
(
hb_ot_layout_
context_t
*
contex
t
,
hb_codepoint_t
glyph_id
)
const
{
/* XXX vertical */
return
layout
->
gpos_info
.
x_scale
*
coordinate
/
0x10000
;
return
context
->
font
->
x_scale
*
coordinate
/
0x10000
;
}
private:
...
...
@@ -107,7 +107,7 @@ struct CaretValueFormat2
friend
struct
CaretValue
;
private:
inline
int
get_caret_value
(
hb_ot_layout_
t
*
layou
t
,
hb_codepoint_t
glyph_id
)
const
inline
int
get_caret_value
(
hb_ot_layout_
context_t
*
contex
t
,
hb_codepoint_t
glyph_id
)
const
{
return
/* TODO contour point */
0
;
}
...
...
@@ -122,11 +122,11 @@ struct CaretValueFormat3
{
friend
struct
CaretValue
;
inline
int
get_caret_value
(
hb_ot_layout_
t
*
layou
t
,
hb_codepoint_t
glyph_id
)
const
inline
int
get_caret_value
(
hb_ot_layout_
context_t
*
contex
t
,
hb_codepoint_t
glyph_id
)
const
{
/* XXX vertical */
return
layout
->
gpos_info
.
x_scale
*
coordinate
/
0x10000
+
(
this
+
deviceTable
).
get_delta
(
layout
->
gpos_info
.
x_ppem
)
<<
6
;
return
context
->
font
->
x_scale
*
coordinate
/
0x10000
+
(
this
+
deviceTable
).
get_delta
(
context
->
font
->
x_ppem
)
<<
6
;
}
private:
...
...
@@ -142,12 +142,12 @@ ASSERT_SIZE (CaretValueFormat3, 6);
struct
CaretValue
{
/* XXX we need access to a load-contour-point vfunc here */
int
get_caret_value
(
hb_ot_layout_
t
*
layou
t
,
hb_codepoint_t
glyph_id
)
const
int
get_caret_value
(
hb_ot_layout_
context_t
*
contex
t
,
hb_codepoint_t
glyph_id
)
const
{
switch
(
u
.
format
)
{
case
1
:
return
u
.
format1
->
get_caret_value
(
layou
t
,
glyph_id
);
case
2
:
return
u
.
format2
->
get_caret_value
(
layou
t
,
glyph_id
);
case
3
:
return
u
.
format3
->
get_caret_value
(
layou
t
,
glyph_id
);
case
1
:
return
u
.
format1
->
get_caret_value
(
contex
t
,
glyph_id
);
case
2
:
return
u
.
format2
->
get_caret_value
(
contex
t
,
glyph_id
);
case
3
:
return
u
.
format3
->
get_caret_value
(
contex
t
,
glyph_id
);
default:
return
0
;
}
}
...
...
@@ -164,7 +164,7 @@ ASSERT_SIZE (CaretValue, 2);
struct
LigGlyph
{
inline
void
get_lig_carets
(
hb_ot_layout_
t
*
layou
t
,
inline
void
get_lig_carets
(
hb_ot_layout_
context_t
*
contex
t
,
hb_codepoint_t
glyph_id
,
unsigned
int
*
caret_count
/* IN/OUT */
,
int
*
caret_array
/* OUT */
)
const
...
...
@@ -172,7 +172,7 @@ struct LigGlyph
unsigned
int
count
=
MIN
(
carets
.
len
,
*
caret_count
);
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
caret_array
[
i
]
=
(
this
+
carets
[
i
]).
get_caret_value
(
layou
t
,
glyph_id
);
caret_array
[
i
]
=
(
this
+
carets
[
i
]).
get_caret_value
(
contex
t
,
glyph_id
);
*
caret_count
=
carets
.
len
;
}
...
...
@@ -187,7 +187,7 @@ ASSERT_SIZE (LigGlyph, 2);
struct
LigCaretList
{
inline
bool
get_lig_carets
(
hb_ot_layout_
t
*
layou
t
,
inline
bool
get_lig_carets
(
hb_ot_layout_
context_t
*
contex
t
,
hb_codepoint_t
glyph_id
,
unsigned
int
*
caret_count
/* IN/OUT */
,
int
*
caret_array
/* OUT */
)
const
...
...
@@ -199,7 +199,7 @@ struct LigCaretList
return
false
;
}
const
LigGlyph
&
lig_glyph
=
this
+
ligGlyph
[
index
];
lig_glyph
.
get_lig_carets
(
layou
t
,
glyph_id
,
caret_count
,
caret_array
);
lig_glyph
.
get_lig_carets
(
contex
t
,
glyph_id
,
caret_count
,
caret_array
);
return
true
;
}
...
...
@@ -279,11 +279,11 @@ struct GDEF
{
return
(
this
+
attachList
).
get_attach_points
(
glyph_id
,
point_count
,
point_array
);
}
inline
bool
has_lig_carets
()
const
{
return
ligCaretList
!=
0
;
}
inline
bool
get_lig_carets
(
hb_ot_layout_
t
*
layou
t
,
inline
bool
get_lig_carets
(
hb_ot_layout_
context_t
*
contex
t
,
hb_codepoint_t
glyph_id
,
unsigned
int
*
caret_count
/* IN/OUT */
,
int
*
caret_array
/* OUT */
)
const
{
return
(
this
+
ligCaretList
).
get_lig_carets
(
layou
t
,
glyph_id
,
caret_count
,
caret_array
);
}
{
return
(
this
+
ligCaretList
).
get_lig_carets
(
contex
t
,
glyph_id
,
caret_count
,
caret_array
);
}
inline
bool
has_mark_sets
()
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.h
浏览文件 @
55520d2a
...
...
@@ -55,7 +55,7 @@ struct ValueFormat : USHORT
inline
unsigned
int
get_len
()
const
{
return
_hb_popcount32
((
unsigned
int
)
*
this
);
}
const
void
apply_value
(
hb_ot_layout_
t
*
layou
t
,
const
void
apply_value
(
hb_ot_layout_
context_t
*
contex
t
,
const
char
*
base
,
const
Value
*
values
,
hb_glyph_position_t
*
glyph_pos
)
const
...
...
@@ -97,8 +97,8 @@ struct ValueRecord {
};
#endif
x_scale
=
layout
->
gpos_info
.
x_scale
;
y_scale
=
layout
->
gpos_info
.
y_scale
;
x_scale
=
context
->
font
->
x_scale
;
y_scale
=
context
->
font
->
y_scale
;
/* design units -> fractional pixel */
if
(
format
&
xPlacement
)
glyph_pos
->
x_pos
+=
x_scale
*
*
(
SHORT
*
)
values
++
/
0x10000
;
...
...
@@ -109,10 +109,10 @@ struct ValueRecord {
if
(
format
&
yAdvance
)
glyph_pos
->
y_advance
+=
y_scale
*
*
(
SHORT
*
)
values
++
/
0x10000
;
if
(
HB_LIKELY
(
!
layout
->
gpos_info
.
dvi
))
if
(
HB_LIKELY
(
!
context
->
font
->
dvi
))
{
x_ppem
=
layout
->
gpos_info
.
x_ppem
;
y_ppem
=
layout
->
gpos_info
.
y_ppem
;
x_ppem
=
context
->
font
->
x_ppem
;
y_ppem
=
context
->
font
->
y_ppem
;
/* pixel -> fractional pixel */
if
(
format
&
xPlaDevice
)
glyph_pos
->
x_pos
+=
(
base
+*
(
OffsetTo
<
Device
>*
)
values
++
).
get_delta
(
x_ppem
)
<<
6
;
...
...
@@ -133,11 +133,11 @@ struct AnchorFormat1
friend
struct
Anchor
;
private:
inline
void
get_anchor
(
hb_ot_layout_
t
*
layou
t
,
hb_codepoint_t
glyph_id
,
inline
void
get_anchor
(
hb_ot_layout_
context_t
*
contex
t
,
hb_codepoint_t
glyph_id
,
hb_position_t
*
x
,
hb_position_t
*
y
)
const
{
*
x
=
layout
->
gpos_info
.
x_scale
*
xCoordinate
/
0x10000
;
*
y
=
layout
->
gpos_info
.
y_scale
*
yCoordinate
/
0x10000
;
*
x
=
context
->
font
->
x_scale
*
xCoordinate
/
0x10000
;
*
y
=
context
->
font
->
y_scale
*
yCoordinate
/
0x10000
;
}
private:
...
...
@@ -152,12 +152,12 @@ struct AnchorFormat2
friend
struct
Anchor
;
private:
inline
void
get_anchor
(
hb_ot_layout_
t
*
layou
t
,
hb_codepoint_t
glyph_id
,
inline
void
get_anchor
(
hb_ot_layout_
context_t
*
contex
t
,
hb_codepoint_t
glyph_id
,
hb_position_t
*
x
,
hb_position_t
*
y
)
const
{
/* TODO Contour */
*
x
=
layout
->
gpos_info
.
x_scale
*
xCoordinate
/
0x10000
;
*
y
=
layout
->
gpos_info
.
y_scale
*
yCoordinate
/
0x10000
;
*
x
=
context
->
font
->
x_scale
*
xCoordinate
/
0x10000
;
*
y
=
context
->
font
->
y_scale
*
yCoordinate
/
0x10000
;
}
private:
...
...
@@ -173,16 +173,16 @@ struct AnchorFormat3
friend
struct
Anchor
;
private:
inline
void
get_anchor
(
hb_ot_layout_
t
*
layou
t
,
hb_codepoint_t
glyph_id
,
inline
void
get_anchor
(
hb_ot_layout_
context_t
*
contex
t
,
hb_codepoint_t
glyph_id
,
hb_position_t
*
x
,
hb_position_t
*
y
)
const
{
*
x
=
layout
->
gpos_info
.
x_scale
*
xCoordinate
/
0x10000
;
*
y
=
layout
->
gpos_info
.
y_scale
*
yCoordinate
/
0x10000
;
*
x
=
context
->
font
->
x_scale
*
xCoordinate
/
0x10000
;
*
y
=
context
->
font
->
y_scale
*
yCoordinate
/
0x10000
;
if
(
!
layout
->
gpos_info
.
dvi
)
if
(
!
context
->
font
->
dvi
)
{
*
x
+=
(
this
+
xDeviceTable
).
get_delta
(
layout
->
gpos_info
.
x_ppem
)
<<
6
;
*
y
+=
(
this
+
yDeviceTable
).
get_delta
(
layout
->
gpos_info
.
y_ppem
)
<<
6
;
*
x
+=
(
this
+
xDeviceTable
).
get_delta
(
context
->
font
->
x_ppem
)
<<
6
;
*
y
+=
(
this
+
yDeviceTable
).
get_delta
(
context
->
font
->
y_ppem
)
<<
6
;
}
}
...
...
@@ -203,14 +203,14 @@ ASSERT_SIZE (AnchorFormat3, 10);
struct
Anchor
{
inline
void
get_anchor
(
hb_ot_layout_
t
*
layou
t
,
hb_codepoint_t
glyph_id
,
inline
void
get_anchor
(
hb_ot_layout_
context_t
*
contex
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
;
case
1
:
u
.
format1
->
get_anchor
(
contex
t
,
glyph_id
,
x
,
y
);
return
;
case
2
:
u
.
format2
->
get_anchor
(
contex
t
,
glyph_id
,
x
,
y
);
return
;
case
3
:
u
.
format3
->
get_anchor
(
contex
t
,
glyph_id
,
x
,
y
);
return
;
default:
return
;
}
}
...
...
@@ -263,7 +263,7 @@ struct SinglePosFormat1
if
(
HB_LIKELY
(
index
==
NOT_COVERED
))
return
false
;
valueFormat
.
apply_value
(
layou
t
,
(
const
char
*
)
this
,
values
,
CURPOSITION
());
valueFormat
.
apply_value
(
contex
t
,
(
const
char
*
)
this
,
values
,
CURPOSITION
());
buffer
->
in_pos
++
;
return
true
;
...
...
@@ -296,7 +296,7 @@ struct SinglePosFormat2
if
(
HB_LIKELY
(
index
>=
valueCount
))
return
false
;
valueFormat
.
apply_value
(
layou
t
,
(
const
char
*
)
this
,
valueFormat
.
apply_value
(
contex
t
,
(
const
char
*
)
this
,
values
+
index
*
valueFormat
.
get_len
(),
CURPOSITION
());
...
...
@@ -382,7 +382,7 @@ struct PairPosFormat1
return
false
;
unsigned
int
j
=
buffer
->
in_pos
+
1
;
while
(
_hb_ot_layout_skip_mark
(
layout
,
IN_INFO
(
j
),
lookup_flag
,
NULL
))
while
(
_hb_ot_layout_skip_mark
(
context
->
layout
,
IN_INFO
(
j
),
lookup_flag
,
NULL
))
{
if
(
HB_UNLIKELY
(
j
==
end
))
return
false
;
...
...
@@ -401,8 +401,8 @@ struct PairPosFormat1
{
if
(
IN_GLYPH
(
j
)
==
record
->
secondGlyph
)
{
valueFormat1
.
apply_value
(
layou
t
,
(
const
char
*
)
this
,
record
->
values
,
CURPOSITION
());
valueFormat2
.
apply_value
(
layou
t
,
(
const
char
*
)
this
,
record
->
values
+
len1
,
POSITION
(
j
));
valueFormat1
.
apply_value
(
contex
t
,
(
const
char
*
)
this
,
record
->
values
,
CURPOSITION
());
valueFormat2
.
apply_value
(
contex
t
,
(
const
char
*
)
this
,
record
->
values
+
len1
,
POSITION
(
j
));
if
(
len2
)
j
++
;
buffer
->
in_pos
=
j
;
...
...
@@ -447,7 +447,7 @@ struct PairPosFormat2
return
false
;
unsigned
int
j
=
buffer
->
in_pos
+
1
;
while
(
_hb_ot_layout_skip_mark
(
layout
,
IN_INFO
(
j
),
lookup_flag
,
NULL
))
while
(
_hb_ot_layout_skip_mark
(
context
->
layout
,
IN_INFO
(
j
),
lookup_flag
,
NULL
))
{
if
(
HB_UNLIKELY
(
j
==
end
))
return
false
;
...
...
@@ -464,8 +464,8 @@ struct PairPosFormat2
return
false
;
const
Value
*
v
=
values
+
record_len
*
(
klass1
*
class2Count
+
klass2
);
valueFormat1
.
apply_value
(
layou
t
,
(
const
char
*
)
this
,
v
,
CURPOSITION
());
valueFormat2
.
apply_value
(
layou
t
,
(
const
char
*
)
this
,
v
+
len1
,
POSITION
(
j
));
valueFormat1
.
apply_value
(
contex
t
,
(
const
char
*
)
this
,
v
,
CURPOSITION
());
valueFormat2
.
apply_value
(
contex
t
,
(
const
char
*
)
this
,
v
+
len1
,
POSITION
(
j
));
if
(
len2
)
j
++
;
...
...
@@ -665,7 +665,7 @@ struct CursivePosFormat1
Since horizontal advance widths or vertical advance heights
can be used alone but not together, no ambiguity occurs. */
struct
hb_ot_layout_
t
::
gpos_info_t
*
gpi
=
&
layout
->
gpos_info
;
struct
hb_ot_layout_
context_t
::
info_t
::
gpos_t
*
gpi
=
&
context
->
info
.
gpos
;
hb_codepoint_t
last_pos
=
gpi
->
last
;
gpi
->
last
=
HB_OT_LAYOUT_GPOS_NO_LAST
;
...
...
@@ -683,11 +683,11 @@ struct CursivePosFormat1
goto
end
;
hb_position_t
entry_x
,
entry_y
;
(
this
+
record
.
entryAnchor
).
get_anchor
(
layou
t
,
IN_CURGLYPH
(),
&
entry_x
,
&
entry_y
);
(
this
+
record
.
entryAnchor
).
get_anchor
(
contex
t
,
IN_CURGLYPH
(),
&
entry_x
,
&
entry_y
);
/* TODO vertical */
if
(
gpi
->
r2l
)
if
(
buffer
->
direction
==
HB_DIRECTION_RTL
)
{
POSITION
(
buffer
->
in_pos
)
->
x_advance
=
entry_x
-
gpi
->
anchor_x
;
POSITION
(
buffer
->
in_pos
)
->
new_advance
=
TRUE
;
...
...
@@ -713,7 +713,7 @@ struct CursivePosFormat1
if
(
record
.
exitAnchor
)
{
gpi
->
last
=
buffer
->
in_pos
;
(
this
+
record
.
exitAnchor
).
get_anchor
(
layou
t
,
IN_CURGLYPH
(),
&
gpi
->
anchor_x
,
&
gpi
->
anchor_y
);
(
this
+
record
.
exitAnchor
).
get_anchor
(
contex
t
,
IN_CURGLYPH
(),
&
gpi
->
anchor_x
,
&
gpi
->
anchor_y
);
}
buffer
->
in_pos
++
;
...
...
@@ -782,7 +782,7 @@ struct MarkBasePosFormat1
/* now we search backwards for a non-mark glyph */
unsigned
int
count
=
buffer
->
in_pos
;
unsigned
int
i
=
1
,
j
=
count
-
1
;
while
(
_hb_ot_layout_skip_mark
(
layout
,
IN_INFO
(
j
),
LookupFlag
::
IgnoreMarks
,
&
property
))
while
(
_hb_ot_layout_skip_mark
(
context
->
layout
,
IN_INFO
(
j
),
LookupFlag
::
IgnoreMarks
,
&
property
))
{
if
(
HB_UNLIKELY
(
i
==
count
))
return
false
;
...
...
@@ -809,9 +809,9 @@ struct MarkBasePosFormat1
hb_position_t
mark_x
,
mark_y
,
base_x
,
base_y
;
mark_anchor
.
get_anchor
(
layou
t
,
IN_CURGLYPH
(),
&
mark_x
,
&
mark_y
);
mark_anchor
.
get_anchor
(
contex
t
,
IN_CURGLYPH
(),
&
mark_x
,
&
mark_y
);
unsigned
int
index
=
base_index
*
classCount
+
mark_class
;
(
&
base_array
+
base_array
.
matrix
[
index
]).
get_anchor
(
layou
t
,
IN_GLYPH
(
j
),
&
base_x
,
&
base_y
);
(
&
base_array
+
base_array
.
matrix
[
index
]).
get_anchor
(
contex
t
,
IN_GLYPH
(
j
),
&
base_x
,
&
base_y
);
hb_glyph_position_t
*
o
=
POSITION
(
buffer
->
in_pos
);
o
->
x_pos
=
base_x
-
mark_x
;
...
...
@@ -900,7 +900,7 @@ struct MarkLigPosFormat1
/* now we search backwards for a non-mark glyph */
unsigned
int
count
=
buffer
->
in_pos
;
unsigned
int
i
=
1
,
j
=
count
-
1
;
while
(
_hb_ot_layout_skip_mark
(
layout
,
IN_INFO
(
j
),
LookupFlag
::
IgnoreMarks
,
&
property
))
while
(
_hb_ot_layout_skip_mark
(
context
->
layout
,
IN_INFO
(
j
),
LookupFlag
::
IgnoreMarks
,
&
property
))
{
if
(
HB_UNLIKELY
(
i
==
count
))
return
false
;
...
...
@@ -946,9 +946,9 @@ struct MarkLigPosFormat1
hb_position_t
mark_x
,
mark_y
,
lig_x
,
lig_y
;
mark_anchor
.
get_anchor
(
layou
t
,
IN_CURGLYPH
(),
&
mark_x
,
&
mark_y
);
mark_anchor
.
get_anchor
(
contex
t
,
IN_CURGLYPH
(),
&
mark_x
,
&
mark_y
);
unsigned
int
index
=
comp_index
*
classCount
+
mark_class
;
(
&
lig_attach
+
lig_attach
.
matrix
[
index
]).
get_anchor
(
layou
t
,
IN_GLYPH
(
j
),
&
lig_x
,
&
lig_y
);
(
&
lig_attach
+
lig_attach
.
matrix
[
index
]).
get_anchor
(
contex
t
,
IN_GLYPH
(
j
),
&
lig_x
,
&
lig_y
);
hb_glyph_position_t
*
o
=
POSITION
(
buffer
->
in_pos
);
o
->
x_pos
=
lig_x
-
mark_x
;
...
...
@@ -1031,7 +1031,7 @@ struct MarkMarkPosFormat1
/* now we search backwards for a suitable mark glyph until a non-mark glyph */
unsigned
int
count
=
buffer
->
in_pos
;
unsigned
int
i
=
1
,
j
=
count
-
1
;
while
(
_hb_ot_layout_skip_mark
(
layout
,
IN_INFO
(
j
),
lookup_flag
,
&
property
))
while
(
_hb_ot_layout_skip_mark
(
context
->
layout
,
IN_INFO
(
j
),
lookup_flag
,
&
property
))
{
if
(
HB_UNLIKELY
(
i
==
count
))
return
false
;
...
...
@@ -1061,9 +1061,9 @@ struct MarkMarkPosFormat1
hb_position_t
mark1_x
,
mark1_y
,
mark2_x
,
mark2_y
;
mark1_anchor
.
get_anchor
(
layou
t
,
IN_CURGLYPH
(),
&
mark1_x
,
&
mark1_y
);
mark1_anchor
.
get_anchor
(
contex
t
,
IN_CURGLYPH
(),
&
mark1_x
,
&
mark1_y
);
unsigned
int
index
=
mark2_index
*
classCount
+
mark1_class
;
(
&
mark2_array
+
mark2_array
.
matrix
[
index
]).
get_anchor
(
layou
t
,
IN_GLYPH
(
j
),
&
mark2_x
,
&
mark2_y
);
(
&
mark2_array
+
mark2_array
.
matrix
[
index
]).
get_anchor
(
contex
t
,
IN_GLYPH
(
j
),
&
mark2_x
,
&
mark2_y
);
hb_glyph_position_t
*
o
=
POSITION
(
buffer
->
in_pos
);
o
->
x_pos
=
mark2_x
-
mark1_x
;
...
...
@@ -1231,7 +1231,7 @@ struct PosLookup : Lookup
return
type
;
}
inline
bool
apply_once
(
hb_ot_layout_
t
*
layou
t
,
inline
bool
apply_once
(
hb_ot_layout_
context_t
*
contex
t
,
hb_buffer_t
*
buffer
,
unsigned
int
context_length
,
unsigned
int
nesting_level_left
)
const
...
...
@@ -1240,7 +1240,7 @@ struct PosLookup : Lookup
unsigned
int
lookup_flag
=
get_flag
();
unsigned
int
property
;
if
(
!
_hb_ot_layout_check_glyph_property
(
layout
,
IN_CURINFO
(),
lookup_flag
,
&
property
))
if
(
!
_hb_ot_layout_check_glyph_property
(
context
->
layout
,
IN_CURINFO
(),
lookup_flag
,
&
property
))
return
false
;
for
(
unsigned
int
i
=
0
;
i
<
get_subtable_count
();
i
++
)
...
...
@@ -1250,7 +1250,7 @@ struct PosLookup : Lookup
return
false
;
}
bool
apply_string
(
hb_ot_layout_
t
*
layou
t
,
bool
apply_string
(
hb_ot_layout_
context_t
*
contex
t
,
hb_buffer_t
*
buffer
,
hb_ot_layout_feature_mask_t
mask
)
const
{
...
...
@@ -1259,7 +1259,7 @@ struct PosLookup : Lookup
if
(
HB_UNLIKELY
(
!
buffer
->
in_length
))
return
false
;
layout
->
gpos_info
.
last
=
HB_OT_LAYOUT_GPOS_NO_LAST
;
/* no last valid glyph for cursive pos. */
context
->
info
.
gpos
.
last
=
HB_OT_LAYOUT_GPOS_NO_LAST
;
/* no last valid glyph for cursive pos. */
buffer
->
in_pos
=
0
;
while
(
buffer
->
in_pos
<
buffer
->
in_length
)
...
...
@@ -1267,7 +1267,7 @@ struct PosLookup : Lookup
bool
done
;
if
(
~
IN_PROPERTIES
(
buffer
->
in_pos
)
&
mask
)
{
done
=
apply_once
(
layou
t
,
buffer
,
NO_CONTEXT
,
MAX_NESTING_LEVEL
);
done
=
apply_once
(
contex
t
,
buffer
,
NO_CONTEXT
,
MAX_NESTING_LEVEL
);
ret
|=
done
;
}
else
...
...
@@ -1275,7 +1275,7 @@ struct PosLookup : Lookup
done
=
false
;
/* Contrary to properties defined in GDEF, user-defined properties
will always stop a possible cursive positioning. */
layout
->
gpos_info
.
last
=
HB_OT_LAYOUT_GPOS_NO_LAST
;
context
->
info
.
gpos
.
last
=
HB_OT_LAYOUT_GPOS_NO_LAST
;
}
if
(
!
done
)
...
...
@@ -1302,11 +1302,11 @@ struct GPOS : GSUBGPOS
inline
const
PosLookup
&
get_lookup
(
unsigned
int
i
)
const
{
return
(
const
PosLookup
&
)
GSUBGPOS
::
get_lookup
(
i
);
}
inline
bool
position_lookup
(
hb_ot_layout_
t
*
layou
t
,
inline
bool
position_lookup
(
hb_ot_layout_
context_t
*
contex
t
,
hb_buffer_t
*
buffer
,
unsigned
int
lookup_index
,
hb_ot_layout_feature_mask_t
mask
)
const
{
return
get_lookup
(
lookup_index
).
apply_string
(
layou
t
,
buffer
,
mask
);
}
{
return
get_lookup
(
lookup_index
).
apply_string
(
contex
t
,
buffer
,
mask
);
}
};
ASSERT_SIZE
(
GPOS
,
10
);
...
...
@@ -1326,7 +1326,7 @@ inline bool ExtensionPos::apply (APPLY_ARG_DEF) const
static
inline
bool
position_lookup
(
APPLY_ARG_DEF
,
unsigned
int
lookup_index
)
{
const
GPOS
&
gpos
=
*
(
layout
->
gpos
);
const
GPOS
&
gpos
=
*
(
context
->
layout
->
gpos
);
const
PosLookup
&
l
=
gpos
.
get_lookup
(
lookup_index
);
if
(
HB_UNLIKELY
(
nesting_level_left
==
0
))
...
...
@@ -1336,7 +1336,7 @@ static inline bool position_lookup (APPLY_ARG_DEF, unsigned int lookup_index)
if
(
HB_UNLIKELY
(
context_length
<
1
))
return
false
;
return
l
.
apply_once
(
layou
t
,
buffer
,
context_length
,
nesting_level_left
);
return
l
.
apply_once
(
contex
t
,
buffer
,
context_length
,
nesting_level_left
);
}
...
...
src/hb-ot-layout-gsub-private.h
浏览文件 @
55520d2a
...
...
@@ -46,8 +46,8 @@ struct SingleSubstFormat1
_hb_buffer_replace_glyph
(
buffer
,
glyph_id
);
/* We inherit the old glyph class to the substituted glyph */
if
(
_hb_ot_layout_has_new_glyph_classes
(
layout
))
_hb_ot_layout_set_glyph_property
(
layout
,
glyph_id
,
property
);
if
(
_hb_ot_layout_has_new_glyph_classes
(
context
->
layout
))
_hb_ot_layout_set_glyph_property
(
context
->
layout
,
glyph_id
,
property
);
return
true
;
}
...
...
@@ -81,8 +81,8 @@ struct SingleSubstFormat2
_hb_buffer_replace_glyph
(
buffer
,
glyph_id
);
/* We inherit the old glyph class to the substituted glyph */
if
(
_hb_ot_layout_has_new_glyph_classes
(
layout
))
_hb_ot_layout_set_glyph_property
(
layout
,
glyph_id
,
property
);
if
(
_hb_ot_layout_has_new_glyph_classes
(
context
->
layout
))
_hb_ot_layout_set_glyph_property
(
context
->
layout
,
glyph_id
,
property
);
return
true
;
}
...
...
@@ -137,14 +137,14 @@ struct Sequence
0xFFFF
,
0xFFFF
);
/* This is a guess only ... */
if
(
_hb_ot_layout_has_new_glyph_classes
(
layout
))
if
(
_hb_ot_layout_has_new_glyph_classes
(
context
->
layout
))
{
if
(
property
==
HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE
)
property
=
HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH
;
unsigned
int
count
=
substitute
.
len
;
for
(
unsigned
int
n
=
0
;
n
<
count
;
n
++
)
_hb_ot_layout_set_glyph_property
(
layout
,
substitute
[
n
],
property
);
_hb_ot_layout_set_glyph_property
(
context
->
layout
,
substitute
[
n
],
property
);
}
return
true
;
...
...
@@ -229,8 +229,8 @@ struct AlternateSubstFormat1
unsigned
int
alt_index
=
0
;
/* XXX callback to user to choose alternate
if (layout->altfunc)
alt_index = (
layout->altfunc)(
layout, buffer,
if (
context->
layout->altfunc)
alt_index = (
context->layout->altfunc)(context->
layout, buffer,
buffer->out_pos, glyph_id,
alt_set.len, alt_set.array);
*/
...
...
@@ -243,8 +243,8 @@ struct AlternateSubstFormat1
_hb_buffer_replace_glyph
(
buffer
,
glyph_id
);
/* We inherit the old glyph class to the substituted glyph */
if
(
_hb_ot_layout_has_new_glyph_classes
(
layout
))
_hb_ot_layout_set_glyph_property
(
layout
,
glyph_id
,
property
);
if
(
_hb_ot_layout_has_new_glyph_classes
(
context
->
layout
))
_hb_ot_layout_set_glyph_property
(
context
->
layout
,
glyph_id
,
property
);
return
true
;
}
...
...
@@ -297,7 +297,7 @@ struct Ligature
for
(
i
=
1
,
j
=
buffer
->
in_pos
+
1
;
i
<
count
;
i
++
,
j
++
)
{
while
(
_hb_ot_layout_skip_mark
(
layout
,
IN_INFO
(
j
),
lookup_flag
,
&
property
))
while
(
_hb_ot_layout_skip_mark
(
context
->
layout
,
IN_INFO
(
j
),
lookup_flag
,
&
property
))
{
if
(
HB_UNLIKELY
(
j
+
count
-
i
==
end
))
return
false
;
...
...
@@ -311,8 +311,8 @@ struct Ligature
return
false
;
}
/* This is just a guess ... */
if
(
_hb_ot_layout_has_new_glyph_classes
(
layout
))
hb_ot_layout_set_glyph_class
(
layout
,
ligGlyph
,
if
(
_hb_ot_layout_has_new_glyph_classes
(
context
->
layout
))
hb_ot_layout_set_glyph_class
(
context
->
layout
,
ligGlyph
,
is_mark
?
HB_OT_LAYOUT_GLYPH_CLASS_MARK
:
HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE
);
...
...
@@ -338,7 +338,7 @@ struct Ligature
for
(
i
=
1
;
i
<
count
;
i
++
)
{
while
(
_hb_ot_layout_skip_mark
(
layout
,
IN_CURINFO
(),
lookup_flag
,
NULL
))
while
(
_hb_ot_layout_skip_mark
(
context
->
layout
,
IN_CURINFO
(),
lookup_flag
,
NULL
))
_hb_buffer_add_output_glyph
(
buffer
,
IN_CURGLYPH
(),
i
-
1
,
lig_id
);
(
buffer
->
in_pos
)
++
;
...
...
@@ -627,7 +627,7 @@ struct SubstLookup : Lookup
inline
bool
is_reverse
(
void
)
const
{
return
HB_UNLIKELY
(
get_effective_type
()
==
SubstLookupSubTable
::
ReverseChainSingle
);
}
inline
bool
apply_once
(
hb_ot_layout_
t
*
layou
t
,
inline
bool
apply_once
(
hb_ot_layout_
context_t
*
contex
t
,
hb_buffer_t
*
buffer
,
unsigned
int
context_length
,
unsigned
int
nesting_level_left
)
const
...
...
@@ -636,7 +636,7 @@ struct SubstLookup : Lookup
unsigned
int
lookup_flag
=
get_flag
();
unsigned
int
property
;
if
(
!
_hb_ot_layout_check_glyph_property
(
layout
,
IN_CURINFO
(),
lookup_flag
,
&
property
))
if
(
!
_hb_ot_layout_check_glyph_property
(
context
->
layout
,
IN_CURINFO
(),
lookup_flag
,
&
property
))
return
false
;
for
(
unsigned
int
i
=
0
;
i
<
get_subtable_count
();
i
++
)
...
...
@@ -646,7 +646,7 @@ struct SubstLookup : Lookup
return
false
;
}
bool
apply_string
(
hb_ot_layout_
t
*
layou
t
,
bool
apply_string
(
hb_ot_layout_
context_t
*
contex
t
,
hb_buffer_t
*
buffer
,
hb_ot_layout_feature_mask_t
mask
)
const
{
...
...
@@ -663,7 +663,7 @@ struct SubstLookup : Lookup
while
(
buffer
->
in_pos
<
buffer
->
in_length
)
{
if
((
~
IN_PROPERTIES
(
buffer
->
in_pos
)
&
mask
)
&&
apply_once
(
layou
t
,
buffer
,
NO_CONTEXT
,
MAX_NESTING_LEVEL
))
apply_once
(
contex
t
,
buffer
,
NO_CONTEXT
,
MAX_NESTING_LEVEL
))
ret
=
true
;
else
_hb_buffer_next_glyph
(
buffer
);
...
...
@@ -681,7 +681,7 @@ struct SubstLookup : Lookup
do
{
if
((
~
IN_PROPERTIES
(
buffer
->
in_pos
)
&
mask
)
&&
apply_once
(
layou
t
,
buffer
,
NO_CONTEXT
,
MAX_NESTING_LEVEL
))
apply_once
(
contex
t
,
buffer
,
NO_CONTEXT
,
MAX_NESTING_LEVEL
))
ret
=
true
;
else
buffer
->
in_pos
--
;
...
...
@@ -710,11 +710,11 @@ struct GSUB : GSUBGPOS
inline
const
SubstLookup
&
get_lookup
(
unsigned
int
i
)
const
{
return
(
const
SubstLookup
&
)
GSUBGPOS
::
get_lookup
(
i
);
}
inline
bool
substitute_lookup
(
hb_ot_layout_
t
*
layou
t
,
inline
bool
substitute_lookup
(
hb_ot_layout_
context_t
*
contex
t
,
hb_buffer_t
*
buffer
,
unsigned
int
lookup_index
,
hb_ot_layout_feature_mask_t
mask
)
const
{
return
get_lookup
(
lookup_index
).
apply_string
(
layou
t
,
buffer
,
mask
);
}
{
return
get_lookup
(
lookup_index
).
apply_string
(
contex
t
,
buffer
,
mask
);
}
};
ASSERT_SIZE
(
GSUB
,
10
);
...
...
@@ -734,7 +734,7 @@ inline bool ExtensionSubst::apply (APPLY_ARG_DEF) const
static
inline
bool
substitute_lookup
(
APPLY_ARG_DEF
,
unsigned
int
lookup_index
)
{
const
GSUB
&
gsub
=
*
(
layout
->
gsub
);
const
GSUB
&
gsub
=
*
(
context
->
layout
->
gsub
);
const
SubstLookup
&
l
=
gsub
.
get_lookup
(
lookup_index
);
if
(
HB_UNLIKELY
(
nesting_level_left
==
0
))
...
...
@@ -744,7 +744,7 @@ static inline bool substitute_lookup (APPLY_ARG_DEF, unsigned int lookup_index)
if
(
HB_UNLIKELY
(
context_length
<
1
))
return
false
;
return
l
.
apply_once
(
layou
t
,
buffer
,
context_length
,
nesting_level_left
);
return
l
.
apply_once
(
contex
t
,
buffer
,
context_length
,
nesting_level_left
);
}
...
...
src/hb-ot-layout-gsubgpos-private.h
浏览文件 @
55520d2a
...
...
@@ -32,14 +32,14 @@
#define APPLY_ARG_DEF \
hb_ot_layout_
t *layou
t, \
hb_ot_layout_
context_t *contex
t, \
hb_buffer_t *buffer, \
unsigned int context_length HB_GNUC_UNUSED, \
unsigned int nesting_level_left HB_GNUC_UNUSED, \
unsigned int lookup_flag, \
unsigned int property HB_GNUC_UNUSED
/* propety of first glyph */
#define APPLY_ARG \
layou
t, \
contex
t, \
buffer, \
context_length, \
nesting_level_left, \
...
...
@@ -89,7 +89,7 @@ static inline bool match_input (APPLY_ARG_DEF,
for
(
i
=
1
,
j
=
buffer
->
in_pos
+
1
;
i
<
count
;
i
++
,
j
++
)
{
while
(
_hb_ot_layout_skip_mark
(
layout
,
IN_INFO
(
j
),
lookup_flag
,
NULL
))
while
(
_hb_ot_layout_skip_mark
(
context
->
layout
,
IN_INFO
(
j
),
lookup_flag
,
NULL
))
{
if
(
HB_UNLIKELY
(
j
+
count
-
i
==
end
))
return
false
;
...
...
@@ -116,7 +116,7 @@ static inline bool match_backtrack (APPLY_ARG_DEF,
for
(
unsigned
int
i
=
0
,
j
=
buffer
->
out_pos
-
1
;
i
<
count
;
i
++
,
j
--
)
{
while
(
_hb_ot_layout_skip_mark
(
layout
,
OUT_INFO
(
j
),
lookup_flag
,
NULL
))
while
(
_hb_ot_layout_skip_mark
(
context
->
layout
,
OUT_INFO
(
j
),
lookup_flag
,
NULL
))
{
if
(
HB_UNLIKELY
(
j
+
1
==
count
-
i
))
return
false
;
...
...
@@ -144,7 +144,7 @@ static inline bool match_lookahead (APPLY_ARG_DEF,
for
(
i
=
0
,
j
=
buffer
->
in_pos
+
offset
;
i
<
count
;
i
++
,
j
++
)
{
while
(
_hb_ot_layout_skip_mark
(
layout
,
OUT_INFO
(
j
),
lookup_flag
,
NULL
))
while
(
_hb_ot_layout_skip_mark
(
context
->
layout
,
OUT_INFO
(
j
),
lookup_flag
,
NULL
))
{
if
(
HB_UNLIKELY
(
j
+
count
-
i
==
end
))
return
false
;
...
...
@@ -182,7 +182,7 @@ static inline bool apply_lookup (APPLY_ARG_DEF,
* Should be easy for in_place ones at least. */
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
{
while
(
_hb_ot_layout_skip_mark
(
layout
,
IN_CURINFO
(),
lookup_flag
,
NULL
))
while
(
_hb_ot_layout_skip_mark
(
context
->
layout
,
IN_CURINFO
(),
lookup_flag
,
NULL
))
{
if
(
HB_UNLIKELY
(
buffer
->
in_pos
==
end
))
return
true
;
...
...
@@ -232,16 +232,16 @@ static inline bool context_lookup (APPLY_ARG_DEF,
const
USHORT
input
[],
/* Array of input values--start with second glyph */
unsigned
int
lookupCount
,
const
LookupRecord
lookupRecord
[],
ContextLookupContext
&
context
)
ContextLookupContext
&
lookup_
context
)
{
return
match_input
(
APPLY_ARG
,
inputCount
,
input
,
context
.
funcs
.
match
,
context
.
match_data
,
lookup_context
.
funcs
.
match
,
lookup_
context
.
match_data
,
&
context_length
)
&&
apply_lookup
(
APPLY_ARG
,
inputCount
,
lookupCount
,
lookupRecord
,
context
.
funcs
.
apply
);
lookup_
context
.
funcs
.
apply
);
}
struct
Rule
...
...
@@ -249,7 +249,7 @@ struct Rule
friend
struct
RuleSet
;
private:
inline
bool
apply
(
APPLY_ARG_DEF
,
ContextLookupContext
&
context
)
const
inline
bool
apply
(
APPLY_ARG_DEF
,
ContextLookupContext
&
lookup_
context
)
const
{
const
LookupRecord
*
lookupRecord
=
(
const
LookupRecord
*
)
((
const
char
*
)
input
+
...
...
@@ -257,7 +257,7 @@ struct Rule
return
context_lookup
(
APPLY_ARG
,
inputCount
,
input
,
lookupCount
,
lookupRecord
,
context
);
lookup_
context
);
}
private:
...
...
@@ -274,12 +274,12 @@ ASSERT_SIZE (Rule, 4);
struct
RuleSet
{
inline
bool
apply
(
APPLY_ARG_DEF
,
ContextLookupContext
&
context
)
const
inline
bool
apply
(
APPLY_ARG_DEF
,
ContextLookupContext
&
lookup_
context
)
const
{
unsigned
int
num_rules
=
rule
.
len
;
for
(
unsigned
int
i
=
0
;
i
<
num_rules
;
i
++
)
{
if
((
this
+
rule
[
i
]).
apply
(
APPLY_ARG
,
context
))
if
((
this
+
rule
[
i
]).
apply
(
APPLY_ARG
,
lookup_
context
))
return
true
;
}
...
...
@@ -305,11 +305,11 @@ struct ContextFormat1
return
false
;
const
RuleSet
&
rule_set
=
this
+
ruleSet
[
index
];
struct
ContextLookupContext
context
=
{
struct
ContextLookupContext
lookup_
context
=
{
{
match_glyph
,
apply_func
},
NULL
};
return
rule_set
.
apply
(
APPLY_ARG
,
context
);
return
rule_set
.
apply
(
APPLY_ARG
,
lookup_
context
);
}
private:
...
...
@@ -341,11 +341,11 @@ struct ContextFormat2
/* LONGTERMTODO: Old code fetches glyph classes at most once and caches
* them across subrule lookups. Not sure it's worth it.
*/
struct
ContextLookupContext
context
=
{
struct
ContextLookupContext
lookup_
context
=
{
{
match_class
,
apply_func
},
(
char
*
)
&
class_def
};
return
rule_set
.
apply
(
APPLY_ARG
,
context
);
return
rule_set
.
apply
(
APPLY_ARG
,
lookup_
context
);
}
private:
...
...
@@ -377,14 +377,14 @@ struct ContextFormat3
const
LookupRecord
*
lookupRecord
=
(
const
LookupRecord
*
)
((
const
char
*
)
coverage
+
sizeof
(
coverage
[
0
])
*
glyphCount
);
struct
ContextLookupContext
context
=
{
struct
ContextLookupContext
lookup_
context
=
{
{
match_coverage
,
apply_func
},
(
char
*
)
this
};
return
context_lookup
(
APPLY_ARG
,
glyphCount
,
(
const
USHORT
*
)
(
coverage
+
1
),
lookupCount
,
lookupRecord
,
context
);
lookup_
context
);
}
private:
...
...
@@ -441,7 +441,7 @@ static inline bool chain_context_lookup (APPLY_ARG_DEF,
const
USHORT
lookahead
[],
unsigned
int
lookupCount
,
const
LookupRecord
lookupRecord
[],
ChainContextLookupContext
&
context
)
ChainContextLookupContext
&
lookup_
context
)
{
/* First guess */
if
(
HB_UNLIKELY
(
buffer
->
out_pos
<
backtrackCount
||
...
...
@@ -452,20 +452,20 @@ static inline bool chain_context_lookup (APPLY_ARG_DEF,
unsigned
int
offset
;
return
match_backtrack
(
APPLY_ARG
,
backtrackCount
,
backtrack
,
context
.
funcs
.
match
,
context
.
match_data
[
0
])
&&
lookup_context
.
funcs
.
match
,
lookup_
context
.
match_data
[
0
])
&&
match_input
(
APPLY_ARG
,
inputCount
,
input
,
context
.
funcs
.
match
,
context
.
match_data
[
1
],
lookup_context
.
funcs
.
match
,
lookup_
context
.
match_data
[
1
],
&
offset
)
&&
match_lookahead
(
APPLY_ARG
,
lookaheadCount
,
lookahead
,
context
.
funcs
.
match
,
context
.
match_data
[
2
],
lookup_context
.
funcs
.
match
,
lookup_
context
.
match_data
[
2
],
offset
)
&&
(
context_length
=
offset
,
true
)
&&
apply_lookup
(
APPLY_ARG
,
inputCount
,
lookupCount
,
lookupRecord
,
context
.
funcs
.
apply
);
lookup_
context
.
funcs
.
apply
);
}
struct
ChainRule
...
...
@@ -473,7 +473,7 @@ struct ChainRule
friend
struct
ChainRuleSet
;
private:
inline
bool
apply
(
APPLY_ARG_DEF
,
ChainContextLookupContext
&
context
)
const
inline
bool
apply
(
APPLY_ARG_DEF
,
ChainContextLookupContext
&
lookup_
context
)
const
{
const
HeadlessArrayOf
<
USHORT
>
&
input
=
*
(
const
HeadlessArrayOf
<
USHORT
>*
)
((
const
char
*
)
&
backtrack
+
backtrack
.
get_size
());
...
...
@@ -486,7 +486,7 @@ struct ChainRule
input
.
len
,
input
.
array
+
1
,
lookahead
.
len
,
lookahead
.
array
,
lookup
.
len
,
lookup
.
array
,
context
);
lookup_
context
);
return
false
;
}
...
...
@@ -510,12 +510,12 @@ ASSERT_SIZE (ChainRule, 8);
struct
ChainRuleSet
{
inline
bool
apply
(
APPLY_ARG_DEF
,
ChainContextLookupContext
&
context
)
const
inline
bool
apply
(
APPLY_ARG_DEF
,
ChainContextLookupContext
&
lookup_
context
)
const
{
unsigned
int
num_rules
=
rule
.
len
;
for
(
unsigned
int
i
=
0
;
i
<
num_rules
;
i
++
)
{
if
((
this
+
rule
[
i
]).
apply
(
APPLY_ARG
,
context
))
if
((
this
+
rule
[
i
]).
apply
(
APPLY_ARG
,
lookup_
context
))
return
true
;
}
...
...
@@ -541,11 +541,11 @@ struct ChainContextFormat1
return
false
;
const
ChainRuleSet
&
rule_set
=
this
+
ruleSet
[
index
];
struct
ChainContextLookupContext
context
=
{
struct
ChainContextLookupContext
lookup_
context
=
{
{
match_glyph
,
apply_func
},
{
NULL
,
NULL
,
NULL
}
};
return
rule_set
.
apply
(
APPLY_ARG
,
context
);
return
rule_set
.
apply
(
APPLY_ARG
,
lookup_
context
);
}
private:
USHORT
format
;
/* Format identifier--format = 1 */
...
...
@@ -578,13 +578,13 @@ struct ChainContextFormat2
/* LONGTERMTODO: Old code fetches glyph classes at most once and caches
* them across subrule lookups. Not sure it's worth it.
*/
struct
ChainContextLookupContext
context
=
{
struct
ChainContextLookupContext
lookup_
context
=
{
{
match_class
,
apply_func
},
{(
char
*
)
&
backtrack_class_def
,
(
char
*
)
&
input_class_def
,
(
char
*
)
&
lookahead_class_def
}
};
return
rule_set
.
apply
(
APPLY_ARG
,
context
);
return
rule_set
.
apply
(
APPLY_ARG
,
lookup_
context
);
}
private:
...
...
@@ -629,7 +629,7 @@ struct ChainContextFormat3
((
const
char
*
)
&
input
+
input
.
get_size
());
const
ArrayOf
<
LookupRecord
>
&
lookup
=
*
(
const
ArrayOf
<
LookupRecord
>*
)
((
const
char
*
)
&
lookahead
+
lookahead
.
get_size
());
struct
ChainContextLookupContext
context
=
{
struct
ChainContextLookupContext
lookup_
context
=
{
{
match_coverage
,
apply_func
},
{(
char
*
)
this
,
(
char
*
)
this
,
(
char
*
)
this
}
};
...
...
@@ -638,7 +638,7 @@ struct ChainContextFormat3
input
.
len
,
(
USHORT
*
)
input
.
array
,
lookahead
.
len
,
(
USHORT
*
)
lookahead
.
array
,
lookup
.
len
,
lookup
.
array
,
context
);
lookup_
context
);
return
false
;
}
...
...
src/hb-ot-layout-private.h
浏览文件 @
55520d2a
...
...
@@ -44,20 +44,24 @@ struct _hb_ot_layout_t
unsigned
char
*
klasses
;
unsigned
int
len
;
}
new_gdef
;
};
/* TODO full-matrix transformation? */
struct
gpos_info_t
{
unsigned
int
x_ppem
,
y_ppem
;
hb_16dot16_t
x_scale
,
y_scale
;
hb_bool_t
dvi
;
hb_bool_t
r2l
;
typedef
struct
_hb_ot_layout_context_t
hb_ot_layout_context_t
;
struct
_hb_ot_layout_context_t
{
hb_ot_layout_t
*
layout
;
hb_face_t
*
face
;
hb_font_t
*
font
;
union
info_t
{
struct
gpos_t
{
unsigned
int
last
;
/* the last valid glyph--used with cursive positioning */
hb_position_t
anchor_x
;
/* the coordinates of the anchor point */
hb_position_t
anchor_y
;
/* of the last valid glyph */
}
gpos_info
;
}
gpos
;
}
info
;
};
...
...
src/hb-ot-layout.cc
浏览文件 @
55520d2a
...
...
@@ -83,36 +83,6 @@ hb_ot_layout_destroy (hb_ot_layout_t *layout)
free
(
layout
);
}
void
hb_ot_layout_set_direction
(
hb_ot_layout_t
*
layout
,
hb_bool_t
r2l
)
{
layout
->
gpos_info
.
r2l
=
!!
r2l
;
}
void
hb_ot_layout_set_hinting
(
hb_ot_layout_t
*
layout
,
hb_bool_t
hinted
)
{
layout
->
gpos_info
.
dvi
=
!
hinted
;
}
void
hb_ot_layout_set_scale
(
hb_ot_layout_t
*
layout
,
hb_16dot16_t
x_scale
,
hb_16dot16_t
y_scale
)
{
layout
->
gpos_info
.
x_scale
=
x_scale
;
layout
->
gpos_info
.
y_scale
=
y_scale
;
}
void
hb_ot_layout_set_ppem
(
hb_ot_layout_t
*
layout
,
unsigned
int
x_ppem
,
unsigned
int
y_ppem
)
{
layout
->
gpos_info
.
x_ppem
=
x_ppem
;
layout
->
gpos_info
.
y_ppem
=
y_ppem
;
}
/*
* GDEF
...
...
src/hb-ot-layout.h
浏览文件 @
55520d2a
...
...
@@ -48,11 +48,6 @@ hb_ot_layout_create_for_data (const char *font_data,
void
hb_ot_layout_destroy
(
hb_ot_layout_t
*
layout
);
/* XXX */
void
hb_ot_layout_set_direction
(
hb_ot_layout_t
*
layout
,
hb_bool_t
r2l
);
void
hb_ot_layout_set_hinting
(
hb_ot_layout_t
*
layout
,
hb_bool_t
hinted
);
...
...
src/hb-private.h
浏览文件 @
55520d2a
...
...
@@ -100,4 +100,20 @@ _hb_popcount32 (uint32_t mask)
#endif
}
struct
_hb_face_t
{
struct
_hb_ot_layout_t
*
layout
;
};
struct
_hb_font_t
{
hb_face_t
*
face
;
unsigned
int
x_ppem
,
y_ppem
;
hb_16dot16_t
x_scale
,
y_scale
;
hb_bool_t
dvi
;
};
#endif
/* HB_PRIVATE_H */
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录