Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
b65c0602
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,发现更多精彩内容 >>
提交
b65c0602
编写于
7月 28, 2011
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Formalize buffer var allocations
上级
a9ad3d34
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
83 addition
and
57 deletion
+83
-57
src/hb-buffer-private.hh
src/hb-buffer-private.hh
+9
-16
src/hb-buffer.cc
src/hb-buffer.cc
+8
-7
src/hb-ot-layout-gpos-private.hh
src/hb-ot-layout-gpos-private.hh
+9
-5
src/hb-ot-layout-gsub-private.hh
src/hb-ot-layout-gsub-private.hh
+4
-1
src/hb-ot-shape-complex-arabic.cc
src/hb-ot-shape-complex-arabic.cc
+5
-1
src/hb-ot-shape-complex-indic.cc
src/hb-ot-shape-complex-indic.cc
+2
-2
src/hb-ot-shape-complex-private.hh
src/hb-ot-shape-complex-private.hh
+9
-1
src/hb-ot-shape.cc
src/hb-ot-shape.cc
+36
-24
src/hb-private.hh
src/hb-private.hh
+1
-0
未找到文件。
src/hb-buffer-private.hh
浏览文件 @
b65c0602
...
...
@@ -84,26 +84,10 @@ struct _hb_buffer_t {
{
return
have_output
?
out_len
:
idx
;
}
inline
unsigned
int
next_serial
(
void
)
{
return
serial
++
;
}
HB_INTERNAL
void
allocate_var
(
unsigned
int
byte_i
,
unsigned
int
count
,
const
char
*
owner
);
HB_INTERNAL
void
deallocate_var
(
unsigned
int
byte_i
,
unsigned
int
count
,
const
char
*
owner
);
HB_INTERNAL
void
deallocate_var_all
(
void
);
inline
void
allocate_var_8
(
unsigned
int
var_num
,
unsigned
int
i
,
const
char
*
owner
)
{
assert
(
var_num
<
2
&&
i
<
4
);
allocate_var
(
var_num
*
4
+
i
,
1
,
owner
);
}
inline
void
allocate_var_16
(
unsigned
int
var_num
,
unsigned
int
i
,
const
char
*
owner
)
{
assert
(
var_num
<
2
&&
i
<
2
);
allocate_var
(
var_num
*
4
+
i
*
2
,
2
,
owner
);
}
inline
void
allocate_var_32
(
unsigned
int
var_num
,
const
char
*
owner
)
{
assert
(
var_num
<
2
);
allocate_var
(
var_num
*
4
,
4
,
owner
);
}
inline
void
deallocate_var_8
(
unsigned
int
var_num
,
unsigned
int
i
,
const
char
*
owner
)
{
assert
(
var_num
<
2
&&
i
<
4
);
deallocate_var
(
var_num
*
4
+
i
,
1
,
owner
);
}
inline
void
deallocate_var_16
(
unsigned
int
var_num
,
unsigned
int
i
,
const
char
*
owner
)
{
assert
(
var_num
<
2
&&
i
<
2
);
deallocate_var
(
var_num
*
4
+
i
*
2
,
2
,
owner
);
}
inline
void
deallocate_var_32
(
unsigned
int
var_num
,
const
char
*
owner
)
{
assert
(
var_num
<
2
);
deallocate_var
(
var_num
*
4
,
4
,
owner
);
}
HB_INTERNAL
void
add
(
hb_codepoint_t
codepoint
,
hb_mask_t
mask
,
unsigned
int
cluster
);
...
...
@@ -154,6 +138,15 @@ struct _hb_buffer_t {
};
#define HB_BUFFER_XALLOCATE_VAR(b, func, var, owner) \
b->func (offsetof (hb_glyph_info_t, var) - offsetof(hb_glyph_info_t, var1), \
sizeof (b->info[0].var), owner)
#define HB_BUFFER_ALLOCATE_VAR(b, var) \
HB_BUFFER_XALLOCATE_VAR (b, allocate_var, var (), #var)
#define HB_BUFFER_DEALLOCATE_VAR(b, var) \
HB_BUFFER_XALLOCATE_VAR (b, deallocate_var, var (), #var)
HB_END_DECLS
#endif
/* HB_BUFFER_PRIVATE_HH */
src/hb-buffer.cc
浏览文件 @
b65c0602
...
...
@@ -398,7 +398,7 @@ dump_var_allocation (const hb_buffer_t *buffer)
{
char
buf
[
80
];
for
(
unsigned
int
i
=
0
;
i
<
8
;
i
++
)
buf
[
i
]
=
'0'
+
buffer
->
allocated_var_bytes
[
i
];
buf
[
i
]
=
'0'
+
buffer
->
allocated_var_bytes
[
7
-
i
];
buf
[
8
]
=
'\0'
;
DEBUG_MSG
(
BUFFER
,
buffer
,
"Current var allocation: %s"
,
...
...
@@ -407,7 +407,7 @@ dump_var_allocation (const hb_buffer_t *buffer)
void
hb_buffer_t
::
allocate_var
(
unsigned
int
byte_i
,
unsigned
int
count
,
const
char
*
owner
)
{
assert
(
byte_i
<
8
&&
byte_i
+
count
<
8
);
assert
(
byte_i
<
8
&&
byte_i
+
count
<
=
8
);
if
(
DEBUG
(
BUFFER
))
dump_var_allocation
(
this
);
...
...
@@ -424,18 +424,19 @@ void hb_buffer_t::allocate_var (unsigned int byte_i, unsigned int count, const c
void
hb_buffer_t
::
deallocate_var
(
unsigned
int
byte_i
,
unsigned
int
count
,
const
char
*
owner
)
{
if
(
DEBUG
(
BUFFER
))
dump_var_allocation
(
this
);
DEBUG_MSG
(
BUFFER
,
this
,
"Deallocating var bytes %d..%d for %s"
,
byte_i
,
byte_i
+
count
-
1
,
owner
);
assert
(
byte_i
<
8
&&
byte_i
+
count
<
8
);
assert
(
byte_i
<
8
&&
byte_i
+
count
<
=
8
);
for
(
unsigned
int
i
=
byte_i
;
i
<
byte_i
+
count
;
i
++
)
{
assert
(
allocated_var_bytes
[
i
]
&&
allocated_var_owner
[
i
]
==
owner
);
assert
(
allocated_var_bytes
[
i
]);
assert
(
0
==
strcmp
(
allocated_var_owner
[
i
],
owner
));
allocated_var_bytes
[
i
]
--
;
}
if
(
DEBUG
(
BUFFER
))
dump_var_allocation
(
this
);
}
void
hb_buffer_t
::
deallocate_var_all
(
void
)
...
...
src/hb-ot-layout-gpos-private.hh
浏览文件 @
b65c0602
...
...
@@ -34,7 +34,7 @@
HB_BEGIN_DECLS
/* buffer var allocations */
/* buffer
**position**
var allocations */
#define attach_lookback() var.u16[0]
/* number of glyphs to go back to attach this glyph to its base */
#define cursive_chain() var.i16[1]
/* character to which this connects, may be positive or negative */
...
...
@@ -1569,6 +1569,10 @@ void
GPOS
::
position_start
(
hb_buffer_t
*
buffer
)
{
buffer
->
clear_positions
();
unsigned
int
count
=
buffer
->
len
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
buffer
->
pos
[
i
].
attach_lookback
()
=
buffer
->
pos
[
i
].
cursive_chain
()
=
0
;
}
void
...
...
@@ -1580,15 +1584,15 @@ GPOS::position_finish (hb_buffer_t *buffer)
/* Handle cursive connections */
for
(
unsigned
int
i
=
0
;
i
<
len
;
i
++
)
{
fix_cursive_minor_offset
(
pos
,
i
,
direction
);
}
/* Handle attachments */
for
(
unsigned
int
i
=
0
;
i
<
len
;
i
++
)
{
fix_mark_attachment
(
pos
,
i
,
direction
);
}
HB_BUFFER_DEALLOCATE_VAR
(
buffer
,
lig_comp
);
HB_BUFFER_DEALLOCATE_VAR
(
buffer
,
lig_id
);
HB_BUFFER_DEALLOCATE_VAR
(
buffer
,
props_cache
);
}
...
...
src/hb-ot-layout-gsub-private.hh
浏览文件 @
b65c0602
...
...
@@ -887,8 +887,11 @@ struct GSUB : GSUBGPOS
void
GSUB
::
substitute_start
(
hb_buffer_t
*
buffer
)
{
HB_BUFFER_ALLOCATE_VAR
(
buffer
,
props_cache
);
HB_BUFFER_ALLOCATE_VAR
(
buffer
,
lig_id
);
HB_BUFFER_ALLOCATE_VAR
(
buffer
,
lig_comp
);
unsigned
int
count
=
buffer
->
len
;
/* XXX */
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
buffer
->
info
[
i
].
var1
.
u32
=
buffer
->
info
[
i
].
var2
.
u32
=
0
;
}
...
...
src/hb-ot-shape-complex-arabic.cc
浏览文件 @
b65c0602
...
...
@@ -30,7 +30,7 @@ HB_BEGIN_DECLS
/* buffer var allocations */
#define arabic_shaping_action()
var2.u32
/* arabic shaping action */
#define arabic_shaping_action()
complex_var_temporary_u16()
/* arabic shaping action */
/*
...
...
@@ -195,6 +195,8 @@ _hb_ot_shape_complex_setup_masks_arabic (hb_ot_map_t *map, hb_buffer_t *buffer)
unsigned
int
count
=
buffer
->
len
;
unsigned
int
prev
=
0
,
state
=
0
;
HB_BUFFER_ALLOCATE_VAR
(
buffer
,
arabic_shaping_action
);
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
{
unsigned
int
this_type
=
get_joining_type
(
buffer
->
info
[
i
].
codepoint
,
(
hb_unicode_general_category_t
)
buffer
->
info
[
i
].
general_category
());
...
...
@@ -222,6 +224,8 @@ _hb_ot_shape_complex_setup_masks_arabic (hb_ot_map_t *map, hb_buffer_t *buffer)
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
buffer
->
info
[
i
].
mask
|=
mask_array
[
buffer
->
info
[
i
].
arabic_shaping_action
()];
HB_BUFFER_DEALLOCATE_VAR
(
buffer
,
arabic_shaping_action
);
}
...
...
src/hb-ot-shape-complex-indic.cc
浏览文件 @
b65c0602
...
...
@@ -30,8 +30,8 @@ HB_BEGIN_DECLS
/* buffer var allocations */
#define indic_category()
var2.u8[0]
/* indic_category_t */
#define indic_position()
var2.u8[1]
/* indic_matra_category_t */
#define indic_category()
complex_var_persistent_u8_0()
/* indic_category_t */
#define indic_position()
complex_var_persistent_u8_1()
/* indic_matra_category_t */
#define INDIC_TABLE_ELEMENT_TYPE uint8_t
...
...
src/hb-ot-shape-complex-private.hh
浏览文件 @
b65c0602
...
...
@@ -34,10 +34,18 @@
HB_BEGIN_DECLS
/* buffer var allocations, used
by all shaper
s */
/* buffer var allocations, used
during the entire shaping proces
s */
#define general_category() var1.u8[0]
/* unicode general_category (hb_unicode_general_category_t) */
#define combining_class() var1.u8[1]
/* unicode combining_class (uint8_t) */
/* buffer var allocations, used by complex shapers */
#define complex_var_persistent_u8_0() var2.u8[0]
#define complex_var_persistent_u8_1() var2.u8[1]
#define complex_var_persistent_u16() var2.u16[0]
#define complex_var_temporary_u8_0() var2.u8[2]
#define complex_var_temporary_u8_1() var2.u8[3]
#define complex_var_temporary_u16() var2.u16[1]
#define HB_COMPLEX_SHAPERS_IMPLEMENT_SHAPERS \
HB_COMPLEX_SHAPER_IMPLEMENT (default)
/* should be first */
\
...
...
src/hb-ot-shape.cc
浏览文件 @
b65c0602
...
...
@@ -115,7 +115,7 @@ hb_ot_shape_setup_masks (hb_ot_shape_context_t *c)
hb_mask_t
global_mask
=
c
->
plan
->
map
.
get_global_mask
();
c
->
buffer
->
reset_masks
(
global_mask
);
hb_ot_shape_complex_setup_masks
(
c
->
plan
->
shaper
,
&
c
->
plan
->
map
,
c
->
buffer
);
/* BUFFER: Clobbers var2 */
hb_ot_shape_complex_setup_masks
(
c
->
plan
->
shaper
,
&
c
->
plan
->
map
,
c
->
buffer
);
for
(
unsigned
int
i
=
0
;
i
<
c
->
num_user_features
;
i
++
)
{
...
...
@@ -225,16 +225,20 @@ hb_map_glyphs (hb_font_t *font,
static
void
hb_substitute_default
(
hb_ot_shape_context_t
*
c
)
{
hb_ot_layout_substitute_start
(
c
->
buffer
);
hb_mirror_chars
(
c
);
hb_map_glyphs
(
c
->
font
,
c
->
buffer
);
}
static
void
hb_ot_substitute_complex
(
hb_ot_shape_context_t
*
c
)
{
if
(
!
hb_ot_layout_has_substitution
(
c
->
face
))
return
;
if
(
hb_ot_layout_has_substitution
(
c
->
face
))
c
->
plan
->
map
.
substitute
(
c
->
face
,
c
->
buffer
)
;
c
->
plan
->
map
.
substitute
(
c
->
face
,
c
->
buffer
);
hb_ot_layout_substitute_finish
(
c
->
buffer
);
c
->
applied_substitute_complex
=
TRUE
;
return
;
...
...
@@ -271,24 +275,26 @@ static void
hb_ot_position_complex
(
hb_ot_shape_context_t
*
c
)
{
if
(
!
hb_ot_layout_has_positioning
(
c
->
face
))
return
;
unsigned
int
count
=
c
->
buffer
->
len
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
{
hb_font_add_glyph_origin_for_direction
(
c
->
font
,
c
->
buffer
->
info
[
i
].
codepoint
,
HB_DIRECTION_LTR
,
&
c
->
buffer
->
pos
[
i
].
x_offset
,
&
c
->
buffer
->
pos
[
i
].
y_offset
);
}
if
(
hb_ot_layout_has_positioning
(
c
->
face
))
{
/* Change glyph origin to what GPOS expects, apply GPOS, change it back. */
unsigned
int
count
=
c
->
buffer
->
len
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
{
hb_font_add_glyph_origin_for_direction
(
c
->
font
,
c
->
buffer
->
info
[
i
].
codepoint
,
HB_DIRECTION_LTR
,
&
c
->
buffer
->
pos
[
i
].
x_offset
,
&
c
->
buffer
->
pos
[
i
].
y_offset
);
}
c
->
plan
->
map
.
position
(
c
->
font
,
c
->
buffer
);
c
->
plan
->
map
.
position
(
c
->
font
,
c
->
buffer
);
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
{
hb_font_subtract_glyph_origin_for_direction
(
c
->
font
,
c
->
buffer
->
info
[
i
].
codepoint
,
HB_DIRECTION_LTR
,
&
c
->
buffer
->
pos
[
i
].
x_offset
,
&
c
->
buffer
->
pos
[
i
].
y_offset
);
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
{
hb_font_subtract_glyph_origin_for_direction
(
c
->
font
,
c
->
buffer
->
info
[
i
].
codepoint
,
HB_DIRECTION_LTR
,
&
c
->
buffer
->
pos
[
i
].
x_offset
,
&
c
->
buffer
->
pos
[
i
].
y_offset
);
}
}
hb_ot_layout_position_finish
(
c
->
buffer
);
...
...
@@ -341,10 +347,15 @@ hb_position_complex_fallback_visual (hb_ot_shape_context_t *c)
static
void
hb_ot_shape_execute_internal
(
hb_ot_shape_context_t
*
c
)
{
c
->
buffer
->
deallocate_var_all
();
/* Save the original direction, we use it later. */
c
->
target_direction
=
c
->
buffer
->
props
.
direction
;
_hb_set_unicode_props
(
c
->
buffer
);
/* BUFFER: Set general_category and combining_class in var1 */
HB_BUFFER_ALLOCATE_VAR
(
c
->
buffer
,
general_category
);
HB_BUFFER_ALLOCATE_VAR
(
c
->
buffer
,
combining_class
);
_hb_set_unicode_props
(
c
->
buffer
);
/* BUFFER: Set general_category and combining_class */
hb_form_clusters
(
c
->
buffer
);
...
...
@@ -352,12 +363,10 @@ hb_ot_shape_execute_internal (hb_ot_shape_context_t *c)
_hb_ot_shape_normalize
(
c
);
hb_ot_shape_setup_masks
(
c
);
/* BUFFER: Clobbers var2 */
hb_ot_shape_setup_masks
(
c
);
/* SUBSTITUTE */
{
hb_mirror_chars
(
c
);
hb_substitute_default
(
c
);
hb_ot_substitute_complex
(
c
);
...
...
@@ -383,6 +392,9 @@ hb_ot_shape_execute_internal (hb_ot_shape_context_t *c)
hb_position_complex_fallback_visual
(
c
);
}
HB_BUFFER_DEALLOCATE_VAR
(
c
->
buffer
,
combining_class
);
HB_BUFFER_DEALLOCATE_VAR
(
c
->
buffer
,
general_category
);
c
->
buffer
->
props
.
direction
=
c
->
target_direction
;
}
...
...
src/hb-private.hh
浏览文件 @
b65c0602
...
...
@@ -36,6 +36,7 @@
#include "hb-common.h"
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <assert.h>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录