Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
c968fc2d
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,发现更多精彩内容 >>
提交
c968fc2d
编写于
5月 25, 2009
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[HB] More buffer cleanup
上级
88a5f5a4
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
125 addition
and
177 deletion
+125
-177
src/hb-buffer-private.h
src/hb-buffer-private.h
+10
-29
src/hb-buffer.c
src/hb-buffer.c
+68
-68
src/hb-buffer.h
src/hb-buffer.h
+11
-11
src/hb-ot-layout-gpos-private.h
src/hb-ot-layout-gpos-private.h
+15
-14
src/hb-ot-layout-gsub-private.h
src/hb-ot-layout-gsub-private.h
+5
-5
src/hb-ot-layout-gsubgpos-private.h
src/hb-ot-layout-gsubgpos-private.h
+4
-4
src/hb-ot-layout-private.h
src/hb-ot-layout-private.h
+4
-9
src/hb-ot-layout.cc
src/hb-ot-layout.cc
+8
-8
src/hb-private.h
src/hb-private.h
+0
-29
未找到文件。
src/hb-buffer-private.h
浏览文件 @
c968fc2d
...
...
@@ -33,7 +33,7 @@
HB_BEGIN_DECLS
#define HB_
GLYPH_PROPERTY
_UNKNOWN 0xFFFF
#define HB_
BUFFER_GLYPH_PROPERTIES
_UNKNOWN 0xFFFF
HB_INTERNAL
void
_hb_buffer_swap
(
hb_buffer_t
*
buffer
);
...
...
@@ -41,10 +41,10 @@ _hb_buffer_swap (hb_buffer_t *buffer);
HB_INTERNAL
void
_hb_buffer_clear_output
(
hb_buffer_t
*
buffer
);
HB_INTERNAL
HB_Error
HB_INTERNAL
void
_hb_buffer_clear_positions
(
hb_buffer_t
*
buffer
);
HB_INTERNAL
HB_Error
HB_INTERNAL
void
_hb_buffer_add_output_glyphs
(
hb_buffer_t
*
buffer
,
unsigned
int
num_in
,
unsigned
int
num_out
,
...
...
@@ -52,54 +52,35 @@ _hb_buffer_add_output_glyphs (hb_buffer_t *buffer,
unsigned
short
component
,
unsigned
short
ligID
);
HB_INTERNAL
HB_Error
HB_INTERNAL
void
_hb_buffer_add_output_glyph
(
hb_buffer_t
*
buffer
,
hb_codepoint_t
glyph_index
,
unsigned
short
component
,
unsigned
short
ligID
);
HB_INTERNAL
HB_Error
HB_INTERNAL
void
_hb_buffer_next_glyph
(
hb_buffer_t
*
buffer
);
HB_INTERNAL
HB_Error
HB_INTERNAL
void
_hb_buffer_replace_glyph
(
hb_buffer_t
*
buffer
,
hb_codepoint_t
glyph_index
);
HB_INTERNAL
unsigned
short
_hb_buffer_allocate_ligid
(
hb_buffer_t
*
buffer
);
_hb_buffer_allocate_lig
_
id
(
hb_buffer_t
*
buffer
);
/* convenience macros */
#define IN_GLYPH(pos) (buffer->in_string[(pos)].gindex)
#define IN_I
TEM
(pos) (&buffer->in_string[(pos)])
#define IN_I
NFO
(pos) (&buffer->in_string[(pos)])
#define IN_CURGLYPH() (buffer->in_string[buffer->in_pos].gindex)
#define IN_CURI
TEM
() (&buffer->in_string[buffer->in_pos])
#define IN_CURI
NFO
() (&buffer->in_string[buffer->in_pos])
#define IN_PROPERTIES(pos) (buffer->in_string[(pos)].properties)
#define IN_LIGID(pos) (buffer->in_string[(pos)].ligID)
#define IN_COMPONENT(pos) (buffer->in_string[(pos)].component)
#define POSITION(pos) (&buffer->positions[(pos)])
#define CURPOSITION() (&buffer->positions[buffer->in_pos])
#define OUT_GLYPH(pos) (buffer->out_string[(pos)].gindex)
#define OUT_ITEM(pos) (&buffer->out_string[(pos)])
#define CHECK_Property (layout, index, flags, properties) \
({unsigned int _p; error = _hb_ot_layout_check_glyph_property((layout), (index), (flags), (&_p)) \
? HB_Err_Ok : HB_Err_Not_Covered, *(properties) = _p; error;})
#define ADD_String (buffer, num_in, num_out, glyph_data, component, ligID) \
((error = _hb_buffer_add_output_glyphs ((buffer), \
(num_in), (num_out), \
(glyph_data), (component), (ligID) \
)) != HB_Err_Ok)
#define ADD_Glyph (buffer, glyph_index, component, ligID) \
((error = _hb_buffer_add_output_glyph ((buffer), \
(glyph_index), (component), (ligID) \
)) != HB_Err_Ok)
#define REPLACE_Glyph (buffer, glyph_index) \
((error = _hb_buffer_replace_glyph ((buffer), (glyph_index))) != HB_Err_Ok)
#define COPY_Glyph (buffer) \
((error = _hb_buffer_next_glyph (buffer)) != HB_Err_Ok)
#define OUT_INFO(pos) (&buffer->out_string[(pos)])
HB_END_DECLS
...
...
src/hb-buffer.c
浏览文件 @
c968fc2d
...
...
@@ -56,19 +56,17 @@
* to in_string (FALSE) or alt_string (TRUE).
*/
/* XXX err handling */
/* Internal API */
static
void
hb_buffer_ensure
(
hb_buffer_t
*
buffer
,
unsigned
int
size
)
hb_buffer_ensure
(
hb_buffer_t
*
buffer
,
unsigned
int
size
)
{
unsigned
int
new_allocated
=
buffer
->
allocated
;
/* XXX err handling */
if
(
size
>
new_allocated
)
{
HB_Error
error
;
while
(
size
>
new_allocated
)
new_allocated
+=
(
new_allocated
>>
1
)
+
8
;
...
...
@@ -97,8 +95,8 @@ hb_buffer_ensure (hb_buffer_t *buffer,
}
}
static
HB_Error
hb_buffer_duplicate_out_buffer
(
HB_Buffer
buffer
)
static
void
hb_buffer_duplicate_out_buffer
(
hb_buffer_t
*
buffer
)
{
if
(
!
buffer
->
alt_string
)
buffer
->
alt_string
=
malloc
(
buffer
->
allocated
*
sizeof
(
buffer
->
alt_string
[
0
]));
...
...
@@ -106,8 +104,14 @@ hb_buffer_duplicate_out_buffer (HB_Buffer buffer)
buffer
->
out_string
=
buffer
->
alt_string
;
memcpy
(
buffer
->
out_string
,
buffer
->
in_string
,
buffer
->
out_length
*
sizeof
(
buffer
->
out_string
[
0
]));
buffer
->
separate_out
=
TRUE
;
}
return
HB_Err_Ok
;
static
void
hb_buffer_ensure_separate
(
hb_buffer_t
*
buffer
,
unsigned
int
size
)
{
hb_buffer_ensure
(
buffer
,
size
);
if
(
!
buffer
->
separate_out
)
hb_buffer_duplicate_out_buffer
(
buffer
);
}
/* Public API */
...
...
@@ -132,7 +136,7 @@ hb_buffer_new (void)
}
void
hb_buffer_free
(
HB_Buffer
buffer
)
hb_buffer_free
(
hb_buffer_t
*
buffer
)
{
free
(
buffer
->
in_string
);
free
(
buffer
->
alt_string
);
...
...
@@ -141,7 +145,7 @@ hb_buffer_free (HB_Buffer buffer)
}
void
hb_buffer_clear
(
HB_Buffer
buffer
)
hb_buffer_clear
(
hb_buffer_t
*
buffer
)
{
buffer
->
in_length
=
0
;
buffer
->
out_length
=
0
;
...
...
@@ -149,7 +153,7 @@ hb_buffer_clear (HB_Buffer buffer)
buffer
->
out_pos
=
0
;
buffer
->
out_string
=
buffer
->
in_string
;
buffer
->
separate_out
=
FALSE
;
buffer
->
max_lig
ID
=
0
;
buffer
->
max_lig
_id
=
0
;
}
void
...
...
@@ -158,8 +162,7 @@ hb_buffer_add_glyph (hb_buffer_t *buffer,
unsigned
int
properties
,
unsigned
int
cluster
)
{
HB_Error
error
;
HB_GlyphItem
glyph
;
hb_glyph_info_t
*
glyph
;
hb_buffer_ensure
(
buffer
,
buffer
->
in_length
+
1
);
...
...
@@ -169,7 +172,7 @@ hb_buffer_add_glyph (hb_buffer_t *buffer,
glyph
->
cluster
=
cluster
;
glyph
->
component
=
0
;
glyph
->
ligID
=
0
;
glyph
->
gproperty
=
HB_
GLYPH_PROPERTY
_UNKNOWN
;
glyph
->
gproperty
=
HB_
BUFFER_GLYPH_PROPERTIES
_UNKNOWN
;
buffer
->
in_length
++
;
}
...
...
@@ -177,7 +180,7 @@ hb_buffer_add_glyph (hb_buffer_t *buffer,
/* HarfBuzz-Internal API */
HB_INTERNAL
void
_hb_buffer_clear_output
(
HB_Buffer
buffer
)
_hb_buffer_clear_output
(
hb_buffer_t
*
buffer
)
{
buffer
->
out_length
=
0
;
buffer
->
out_pos
=
0
;
...
...
@@ -185,41 +188,41 @@ _hb_buffer_clear_output (HB_Buffer buffer)
buffer
->
separate_out
=
FALSE
;
}
HB_INTERNAL
HB_Error
_hb_buffer_clear_positions
(
HB_Buffer
buffer
)
HB_INTERNAL
void
_hb_buffer_clear_positions
(
hb_buffer_t
*
buffer
)
{
_hb_buffer_clear_output
(
buffer
);
if
(
!
buffer
->
positions
)
buffer
->
positions
=
malloc
(
buffer
->
allocated
*
sizeof
(
buffer
->
positions
[
0
]));
if
(
HB_UNLIKELY
(
!
buffer
->
positions
))
{
buffer
->
positions
=
calloc
(
buffer
->
allocated
,
sizeof
(
buffer
->
positions
[
0
]));
return
;
}
memset
(
buffer
->
positions
,
0
,
sizeof
(
buffer
->
positions
[
0
])
*
buffer
->
in_length
);
return
HB_Err_Ok
;
}
HB_INTERNAL
void
_hb_buffer_swap
(
HB_Buffer
buffer
)
_hb_buffer_swap
(
hb_buffer_t
*
buffer
)
{
HB_GlyphItem
tmp_string
;
int
tmp_length
;
int
tmp_pos
;
unsigned
int
tmp
;
if
(
buffer
->
separate_out
)
{
hb_glyph_info_t
*
tmp_string
;
tmp_string
=
buffer
->
in_string
;
buffer
->
in_string
=
buffer
->
out_string
;
buffer
->
out_string
=
tmp_string
;
buffer
->
alt_string
=
buffer
->
out_string
;
}
tmp
_length
=
buffer
->
in_length
;
tmp
=
buffer
->
in_length
;
buffer
->
in_length
=
buffer
->
out_length
;
buffer
->
out_length
=
tmp
_length
;
buffer
->
out_length
=
tmp
;
tmp
_pos
=
buffer
->
in_pos
;
tmp
=
buffer
->
in_pos
;
buffer
->
in_pos
=
buffer
->
out_pos
;
buffer
->
out_pos
=
tmp
_pos
;
buffer
->
out_pos
=
tmp
;
}
/* The following function copies `num_out' elements from `glyph_data'
...
...
@@ -241,7 +244,7 @@ _hb_buffer_swap (HB_Buffer buffer)
The cluster value for the glyph at position buffer->in_pos is used
for all replacement glyphs */
HB_INTERNAL
HB_Error
HB_INTERNAL
void
_hb_buffer_add_output_glyphs
(
hb_buffer_t
*
buffer
,
unsigned
int
num_in
,
unsigned
int
num_out
,
...
...
@@ -249,66 +252,67 @@ _hb_buffer_add_output_glyphs (hb_buffer_t *buffer,
unsigned
short
component
,
unsigned
short
ligID
)
{
HB_Error
error
;
unsigned
int
i
;
unsigned
int
properties
;
unsigned
int
cluster
;
hb_buffer_ensure
(
buffer
,
buffer
->
out_pos
+
num_out
);
/* XXX */
if
(
!
buffer
->
separate_out
)
{
error
=
hb_buffer_duplicate_out_buffer
(
buffer
);
if
(
error
)
return
error
;
}
hb_buffer_ensure_separate
(
buffer
,
buffer
->
out_pos
+
num_out
);
properties
=
buffer
->
in_string
[
buffer
->
in_pos
].
properties
;
cluster
=
buffer
->
in_string
[
buffer
->
in_pos
].
cluster
;
if
(
component
==
0xFFFF
)
if
(
component
==
0xFFFF
)
component
=
buffer
->
in_string
[
buffer
->
in_pos
].
component
;
if
(
ligID
==
0xFFFF
)
if
(
ligID
==
0xFFFF
)
ligID
=
buffer
->
in_string
[
buffer
->
in_pos
].
ligID
;
for
(
i
=
0
;
i
<
num_out
;
i
++
)
for
(
i
=
0
;
i
<
num_out
;
i
++
)
{
HB_GlyphItem
item
=
&
buffer
->
out_string
[
buffer
->
out_pos
+
i
];
i
tem
->
gindex
=
hb_be_uint16_t
(
glyph_data_be
[
i
]);
i
tem
->
properties
=
properties
;
i
tem
->
cluster
=
cluster
;
i
tem
->
component
=
component
;
i
tem
->
ligID
=
ligID
;
i
tem
->
gproperty
=
HB_GLYPH_PROPERTY
_UNKNOWN
;
hb_glyph_info_t
*
info
=
&
buffer
->
out_string
[
buffer
->
out_pos
+
i
];
i
nfo
->
gindex
=
hb_be_uint16_t
(
glyph_data_be
[
i
]);
i
nfo
->
properties
=
properties
;
i
nfo
->
cluster
=
cluster
;
i
nfo
->
component
=
component
;
i
nfo
->
ligID
=
ligID
;
i
nfo
->
gproperty
=
HB_BUFFER_GLYPH_PROPERTIES
_UNKNOWN
;
}
buffer
->
in_pos
+=
num_in
;
buffer
->
out_pos
+=
num_out
;
buffer
->
out_length
=
buffer
->
out_pos
;
return
HB_Err_Ok
;
}
HB_INTERNAL
HB_Error
HB_INTERNAL
void
_hb_buffer_add_output_glyph
(
hb_buffer_t
*
buffer
,
hb_codepoint_t
glyph_index
,
unsigned
short
component
,
unsigned
short
ligID
)
{
uint16_t
glyph_data
=
hb_be_uint16_t
(
glyph_index
);
hb_glyph_info_t
*
info
;
hb_buffer_ensure_separate
(
buffer
,
buffer
->
out_pos
+
1
);
return
_hb_buffer_add_output_glyphs
(
buffer
,
1
,
1
,
&
glyph_data
,
component
,
ligID
);
info
=
&
buffer
->
out_string
[
buffer
->
out_pos
];
*
info
=
buffer
->
in_string
[
buffer
->
in_pos
];
info
->
gindex
=
glyph_index
;
if
(
component
!=
0xFFFF
)
info
->
component
=
component
;
if
(
ligID
!=
0xFFFF
)
info
->
ligID
=
ligID
;
info
->
gproperty
=
HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN
;
buffer
->
in_pos
++
;
buffer
->
out_pos
++
;
buffer
->
out_length
=
buffer
->
out_pos
;
}
HB_INTERNAL
HB_Error
_hb_buffer_next_glyph
(
HB_Buffer
buffer
)
HB_INTERNAL
void
_hb_buffer_next_glyph
(
hb_buffer_t
*
buffer
)
{
HB_Error
error
;
if
(
buffer
->
separate_out
)
{
hb_buffer_ensure
(
buffer
,
buffer
->
out_pos
+
1
);
...
...
@@ -319,11 +323,9 @@ _hb_buffer_next_glyph (HB_Buffer buffer)
buffer
->
in_pos
++
;
buffer
->
out_pos
++
;
buffer
->
out_length
=
buffer
->
out_pos
;
return
HB_Err_Ok
;
}
HB_INTERNAL
HB_Error
HB_INTERNAL
void
_hb_buffer_replace_glyph
(
hb_buffer_t
*
buffer
,
hb_codepoint_t
glyph_index
)
{
...
...
@@ -339,12 +341,10 @@ _hb_buffer_replace_glyph (hb_buffer_t *buffer,
{
return
_hb_buffer_add_output_glyph
(
buffer
,
glyph_index
,
0xFFFF
,
0xFFFF
);
}
return
HB_Err_Ok
;
}
HB_INTERNAL
unsigned
short
_hb_buffer_allocate_ligid
(
hb_buffer_t
*
buffer
)
_hb_buffer_allocate_lig
_
id
(
hb_buffer_t
*
buffer
)
{
return
++
buffer
->
max_lig
ID
;
return
++
buffer
->
max_lig
_id
;
}
src/hb-buffer.h
浏览文件 @
c968fc2d
...
...
@@ -34,16 +34,16 @@ HB_BEGIN_DECLS
/* XXX Hide structs? */
typedef
struct
HB_GlyphItemRec_
{
typedef
struct
_hb_glyph_info_t
{
hb_codepoint_t
gindex
;
unsigned
int
properties
;
unsigned
int
cluster
;
unsigned
short
component
;
unsigned
short
ligID
;
unsigned
short
gproperty
;
}
HB_GlyphItemRec
,
*
HB_GlyphItem
;
}
hb_glyph_info_t
;
typedef
struct
HB_PositionRec_
{
typedef
struct
_hb_glyph_position_t
{
hb_position_t
x_pos
;
hb_position_t
y_pos
;
hb_position_t
x_advance
;
...
...
@@ -57,7 +57,7 @@ typedef struct HB_PositionRec_ {
short
cursive_chain
;
/* character to which this connects,
may be positive or negative; used
only internally */
}
HB_PositionRec
,
*
HB_Position
;
}
hb_glyph_position_t
;
typedef
struct
_hb_buffer_t
{
...
...
@@ -68,13 +68,13 @@ typedef struct _hb_buffer_t {
unsigned
int
in_pos
;
unsigned
int
out_pos
;
hb_bool_t
separate_out
;
HB_GlyphItem
in_string
;
HB_GlyphItem
out_string
;
HB_GlyphItem
alt_string
;
HB_Position
positions
;
unsigned
int
max_ligID
;
}
HB_BufferRec
,
*
HB_Buffer
,
hb_buffer_t
;
hb_bool_t
separate_out
;
hb_glyph_info_t
*
in_string
;
hb_glyph_info_t
*
out_string
;
hb_glyph_info_t
*
alt_string
;
hb_glyph_position_t
*
positions
;
unsigned
int
max_lig_id
;
}
hb_buffer_t
;
hb_buffer_t
*
hb_buffer_new
(
void
);
...
...
src/hb-ot-layout-gpos-private.h
浏览文件 @
c968fc2d
...
...
@@ -29,6 +29,7 @@
#include "hb-ot-layout-gsubgpos-private.h"
#define HB_OT_LAYOUT_GPOS_NO_LAST ((unsigned int) -1)
/* Shared Tables: ValueRecord, Anchor Table, and MarkArray */
...
...
@@ -55,10 +56,10 @@ struct ValueFormat : USHORT
return
_hb_popcount32
((
unsigned
int
)
*
this
);
}
const
void
apply_value
(
hb_ot_layout_t
*
layout
,
const
char
*
base
,
const
Value
*
values
,
HB_Position
glyph_pos
)
const
const
void
apply_value
(
hb_ot_layout_t
*
layout
,
const
char
*
base
,
const
Value
*
values
,
hb_glyph_position_t
*
glyph_pos
)
const
{
unsigned
int
x_ppem
,
y_ppem
;
hb_16dot16_t
x_scale
,
y_scale
;
...
...
@@ -379,7 +380,7 @@ struct PairPosFormat1
return
false
;
unsigned
int
j
=
buffer
->
in_pos
+
1
;
while
(
!
_hb_ot_layout_check_glyph_property
(
layout
,
IN_I
TEM
(
j
),
lookup_flag
,
&
property
))
while
(
!
_hb_ot_layout_check_glyph_property
(
layout
,
IN_I
NFO
(
j
),
lookup_flag
,
&
property
))
{
if
(
HB_UNLIKELY
(
j
==
end
))
return
false
;
...
...
@@ -444,7 +445,7 @@ struct PairPosFormat2
return
false
;
unsigned
int
j
=
buffer
->
in_pos
+
1
;
while
(
!
_hb_ot_layout_check_glyph_property
(
layout
,
IN_I
TEM
(
j
),
lookup_flag
,
&
property
))
while
(
!
_hb_ot_layout_check_glyph_property
(
layout
,
IN_I
NFO
(
j
),
lookup_flag
,
&
property
))
{
if
(
HB_UNLIKELY
(
j
==
end
))
return
false
;
...
...
@@ -664,7 +665,7 @@ struct CursivePosFormat1
struct
hb_ot_layout_t
::
gpos_info_t
*
gpi
=
&
layout
->
gpos_info
;
hb_codepoint_t
last_pos
=
gpi
->
last
;
gpi
->
last
=
HB_OT_GPOS_NO_LAST
;
gpi
->
last
=
HB_OT_
LAYOUT_
GPOS_NO_LAST
;
/* We don't handle mark glyphs here. */
if
(
property
==
HB_OT_LAYOUT_GLYPH_CLASS_MARK
)
...
...
@@ -678,7 +679,7 @@ struct CursivePosFormat1
hb_position_t
entry_x
,
entry_y
,
exit_x
,
exit_y
;
if
(
last_pos
==
HB_OT_GPOS_NO_LAST
||
!
record
.
entryAnchor
)
if
(
last_pos
==
HB_OT_
LAYOUT_
GPOS_NO_LAST
||
!
record
.
entryAnchor
)
goto
end
;
(
this
+
record
.
entryAnchor
).
get_anchor
(
layout
,
IN_CURGLYPH
(),
&
entry_x
,
&
entry_y
);
...
...
@@ -816,7 +817,7 @@ struct MarkBasePosFormat1
unsigned
int
index
=
base_index
*
classCount
+
mark_class
;
(
&
base_array
+
base_array
.
matrix
[
index
]).
get_anchor
(
layout
,
IN_GLYPH
(
j
),
&
base_x
,
&
base_y
);
HB_Position
o
=
POSITION
(
buffer
->
in_pos
);
hb_glyph_position_t
*
o
=
POSITION
(
buffer
->
in_pos
);
o
->
x_pos
=
base_x
-
mark_x
;
o
->
y_pos
=
base_y
-
mark_y
;
o
->
x_advance
=
0
;
...
...
@@ -960,7 +961,7 @@ struct MarkLigPosFormat1
unsigned
int
index
=
comp_index
*
classCount
+
mark_class
;
(
&
lig_attach
+
lig_attach
.
matrix
[
index
]).
get_anchor
(
layout
,
IN_GLYPH
(
j
),
&
lig_x
,
&
lig_y
);
HB_Position
o
=
POSITION
(
buffer
->
in_pos
);
hb_glyph_position_t
*
o
=
POSITION
(
buffer
->
in_pos
);
o
->
x_pos
=
lig_x
-
mark_x
;
o
->
y_pos
=
lig_y
-
mark_y
;
o
->
x_advance
=
0
;
...
...
@@ -1076,7 +1077,7 @@ struct MarkMarkPosFormat1
unsigned
int
index
=
mark2_index
*
classCount
+
mark1_class
;
(
&
mark2_array
+
mark2_array
.
matrix
[
index
]).
get_anchor
(
layout
,
IN_GLYPH
(
j
),
&
mark2_x
,
&
mark2_y
);
HB_Position
o
=
POSITION
(
buffer
->
in_pos
);
hb_glyph_position_t
*
o
=
POSITION
(
buffer
->
in_pos
);
o
->
x_pos
=
mark2_x
-
mark1_x
;
o
->
y_pos
=
mark2_y
-
mark1_y
;
o
->
x_advance
=
0
;
...
...
@@ -1257,7 +1258,7 @@ struct PosLookup : Lookup
unsigned
int
lookup_flag
=
get_flag
();
unsigned
int
property
;
if
(
!
_hb_ot_layout_check_glyph_property
(
layout
,
IN_CURI
TEM
(),
lookup_flag
,
&
property
))
if
(
!
_hb_ot_layout_check_glyph_property
(
layout
,
IN_CURI
NFO
(),
lookup_flag
,
&
property
))
return
false
;
for
(
unsigned
int
i
=
0
;
i
<
get_subtable_count
();
i
++
)
...
...
@@ -1276,7 +1277,7 @@ struct PosLookup : Lookup
if
(
HB_UNLIKELY
(
!
buffer
->
in_length
))
return
false
;
layout
->
gpos_info
.
last
=
HB_OT_GPOS_NO_LAST
;
/* no last valid glyph for cursive pos. */
layout
->
gpos_info
.
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
)
...
...
@@ -1292,7 +1293,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_GPOS_NO_LAST
;
layout
->
gpos_info
.
last
=
HB_OT_
LAYOUT_
GPOS_NO_LAST
;
}
if
(
!
done
)
...
...
src/hb-ot-layout-gsub-private.h
浏览文件 @
c968fc2d
...
...
@@ -303,7 +303,7 @@ struct Ligature
for
(
i
=
1
,
j
=
buffer
->
in_pos
+
1
;
i
<
count
;
i
++
,
j
++
)
{
while
(
!
_hb_ot_layout_check_glyph_property
(
layout
,
IN_I
TEM
(
j
),
lookup_flag
,
&
property
))
while
(
!
_hb_ot_layout_check_glyph_property
(
layout
,
IN_I
NFO
(
j
),
lookup_flag
,
&
property
))
{
if
(
HB_UNLIKELY
(
j
+
count
-
i
==
end
))
return
false
;
...
...
@@ -330,10 +330,10 @@ struct Ligature
1
,
(
const
uint16_t
*
)
&
ligGlyph
,
0xFFFF
,
IN_LIGID
(
buffer
->
in_pos
)
?
0xFFFF
:
_hb_buffer_allocate_ligid
(
buffer
));
0xFFFF
:
_hb_buffer_allocate_lig
_
id
(
buffer
));
else
{
unsigned
int
lig_id
=
_hb_buffer_allocate_ligid
(
buffer
);
unsigned
int
lig_id
=
_hb_buffer_allocate_lig
_
id
(
buffer
);
_hb_buffer_add_output_glyph
(
buffer
,
ligGlyph
,
0xFFFF
,
lig_id
);
/* Now we must do a second loop to copy the skipped glyphs to
...
...
@@ -345,7 +345,7 @@ struct Ligature
for
(
i
=
1
;
i
<
count
;
i
++
)
{
while
(
!
_hb_ot_layout_check_glyph_property
(
layout
,
IN_CURI
TEM
(),
lookup_flag
,
&
property
))
while
(
!
_hb_ot_layout_check_glyph_property
(
layout
,
IN_CURI
NFO
(),
lookup_flag
,
&
property
))
_hb_buffer_add_output_glyph
(
buffer
,
IN_CURGLYPH
(),
i
-
1
,
lig_id
);
(
buffer
->
in_pos
)
++
;
...
...
@@ -652,7 +652,7 @@ struct SubstLookup : Lookup
unsigned
int
lookup_flag
=
get_flag
();
unsigned
int
property
;
if
(
!
_hb_ot_layout_check_glyph_property
(
layout
,
IN_CURI
TEM
(),
lookup_flag
,
&
property
))
if
(
!
_hb_ot_layout_check_glyph_property
(
layout
,
IN_CURI
NFO
(),
lookup_flag
,
&
property
))
return
false
;
for
(
unsigned
int
i
=
0
;
i
<
get_subtable_count
();
i
++
)
...
...
src/hb-ot-layout-gsubgpos-private.h
浏览文件 @
c968fc2d
...
...
@@ -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_check_glyph_property
(
layout
,
IN_I
TEM
(
j
),
lookup_flag
,
&
property
))
while
(
!
_hb_ot_layout_check_glyph_property
(
layout
,
IN_I
NFO
(
j
),
lookup_flag
,
&
property
))
{
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_check_glyph_property
(
layout
,
OUT_I
TEM
(
j
),
lookup_flag
,
&
property
))
while
(
!
_hb_ot_layout_check_glyph_property
(
layout
,
OUT_I
NFO
(
j
),
lookup_flag
,
&
property
))
{
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_check_glyph_property
(
layout
,
OUT_I
TEM
(
j
),
lookup_flag
,
&
property
))
while
(
!
_hb_ot_layout_check_glyph_property
(
layout
,
OUT_I
NFO
(
j
),
lookup_flag
,
&
property
))
{
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_check_glyph_property
(
layout
,
IN_CURI
TEM
(),
lookup_flag
,
&
property
))
while
(
!
_hb_ot_layout_check_glyph_property
(
layout
,
IN_CURI
NFO
(),
lookup_flag
,
&
property
))
{
if
(
HB_UNLIKELY
(
buffer
->
in_pos
==
end
))
return
true
;
...
...
src/hb-ot-layout-private.h
浏览文件 @
c968fc2d
...
...
@@ -83,15 +83,10 @@ _hb_ot_layout_set_glyph_property (hb_ot_layout_t *layout,
unsigned
int
property
);
HB_INTERNAL
hb_bool_t
_hb_ot_layout_check_glyph_property
(
hb_ot_layout_t
*
layout
,
HB_GlyphItem
gitem
,
unsigned
int
lookup_flags
,
unsigned
int
*
property
);
/* XXX */
void
hb_buffer_ensure
(
hb_buffer_t
*
buffer
,
unsigned
int
size
);
_hb_ot_layout_check_glyph_property
(
hb_ot_layout_t
*
layout
,
hb_glyph_info_t
*
ginfo
,
unsigned
int
lookup_flags
,
unsigned
int
*
property
);
HB_END_DECLS
...
...
src/hb-ot-layout.cc
浏览文件 @
c968fc2d
...
...
@@ -160,22 +160,22 @@ _hb_ot_layout_get_glyph_property (hb_ot_layout_t *layout,
}
HB_INTERNAL
hb_bool_t
_hb_ot_layout_check_glyph_property
(
hb_ot_layout_t
*
layout
,
HB_GlyphItem
gitem
,
unsigned
int
lookup_flags
,
unsigned
int
*
property
)
_hb_ot_layout_check_glyph_property
(
hb_ot_layout_t
*
layout
,
hb_glyph_info_t
*
ginfo
,
unsigned
int
lookup_flags
,
unsigned
int
*
property
)
{
hb_ot_layout_glyph_class_t
basic_glyph_class
;
unsigned
int
desired_attachment_class
;
if
(
gi
tem
->
gproperty
==
HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN
)
if
(
gi
nfo
->
gproperty
==
HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN
)
{
gi
tem
->
gproperty
=
*
property
=
_hb_ot_layout_get_glyph_property
(
layout
,
gitem
->
gindex
);
if
(
gi
tem
->
gproperty
==
HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED
)
gi
nfo
->
gproperty
=
*
property
=
_hb_ot_layout_get_glyph_property
(
layout
,
ginfo
->
gindex
);
if
(
gi
nfo
->
gproperty
==
HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED
)
return
false
;
}
*
property
=
gi
tem
->
gproperty
;
*
property
=
gi
nfo
->
gproperty
;
/* If the glyph was found in the MarkAttachmentClass table,
* then that class value is the high byte of the result,
...
...
src/hb-private.h
浏览文件 @
c968fc2d
...
...
@@ -100,33 +100,4 @@ _hb_popcount32 (uint32_t mask)
#endif
}
/*
* buffer
*/
/* XXX */
#define HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN 0xFFFF
#define HB_OT_GPOS_NO_LAST ((unsigned int) -1)
/* XXX */
typedef
enum
{
/* no error */
HB_Err_Ok
=
0x0000
,
HB_Err_Not_Covered
=
0xFFFF
,
/* _hb_err() is called whenever returning the following errors,
* and in a couple places for HB_Err_Not_Covered too. */
/* programmer error */
HB_Err_Invalid_Argument
=
0x1A66
,
/* font error */
HB_Err_Invalid_SubTable_Format
=
0x157F
,
HB_Err_Invalid_SubTable
=
0x1570
,
HB_Err_Read_Error
=
0x6EAD
,
/* system error */
HB_Err_Out_Of_Memory
=
0xDEAD
}
HB_Error
;
#endif
/* HB_PRIVATE_H */
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录