Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
670c8734
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看板
提交
670c8734
编写于
8月 08, 2011
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix shaper ordering logic
上级
cc797e0d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
34 addition
and
46 deletion
+34
-46
src/hb-shape.cc
src/hb-shape.cc
+34
-46
未找到文件。
src/hb-shape.cc
浏览文件 @
670c8734
...
...
@@ -45,8 +45,8 @@ typedef hb_bool_t (*hb_shape_func_t) (hb_font_t *font,
const
char
*
shaper_options
);
#define HB_SHAPER_IMPLEMENT(name) {#name, hb_##name##_shape}
static
const
struct
hb_shaper_pair_t
{
c
onst
c
har
name
[
16
];
static
struct
hb_shaper_pair_t
{
char
name
[
16
];
hb_shape_func_t
func
;
}
shapers
[]
=
{
/* v--- Add new shapers in the right place here */
...
...
@@ -65,49 +65,42 @@ static struct static_shaper_list_t
static_shaper_list_t
(
void
)
{
char
*
env
=
getenv
(
"HB_SHAPER_LIST"
);
shaper_list
=
NULL
;
if
(
!
env
||
!*
env
)
{
fallback:
ASSERT_STATIC
((
ARRAY_LENGTH
(
shapers
)
+
1
)
*
sizeof
(
*
shaper_list
)
<=
sizeof
(
static_buffer
));
shaper_list
=
(
const
char
**
)
static_buffer
;
unsigned
int
i
;
for
(
i
=
0
;
i
<
ARRAY_LENGTH
(
shapers
);
i
++
)
shaper_list
[
i
]
=
shapers
[
i
].
name
;
shaper_list
[
i
]
=
NULL
;
return
;
if
(
env
&&
*
env
)
{
/* Reorder shaper list to prefer requested shaper list. */
unsigned
int
i
=
0
;
char
*
end
,
*
p
=
env
;
for
(;;)
{
end
=
strchr
(
p
,
','
);
if
(
!
end
)
end
=
p
+
strlen
(
p
);
for
(
unsigned
int
j
=
i
;
j
<
ARRAY_LENGTH
(
shapers
);
j
++
)
if
(
end
-
p
==
strlen
(
shapers
[
j
].
name
)
&&
0
==
strncmp
(
shapers
[
j
].
name
,
p
,
end
-
p
))
{
/* Reorder this shaper to position i */
struct
hb_shaper_pair_t
t
=
shapers
[
j
];
memmove
(
&
shapers
[
i
+
1
],
&
shapers
[
i
],
sizeof
(
shapers
[
i
])
*
(
j
-
i
));
shapers
[
i
]
=
t
;
i
++
;
}
if
(
!*
end
)
break
;
else
p
=
end
+
1
;
}
}
unsigned
int
count
=
3
;
/* initial, fallback, null */
for
(
const
char
*
p
=
env
;
(
p
=
strchr
(
p
,
','
))
&&
p
++
;
)
count
++
;
unsigned
int
len
=
strlen
(
env
);
if
(
count
>
100
||
len
>
1000
)
goto
fallback
;
len
+=
count
*
sizeof
(
*
shaper_list
)
+
1
;
char
*
buffer
=
len
<
sizeof
(
static_buffer
)
?
static_buffer
:
(
char
*
)
malloc
(
len
);
shaper_list
=
(
const
char
**
)
buffer
;
buffer
+=
count
*
sizeof
(
*
shaper_list
);
len
-=
count
*
sizeof
(
*
shaper_list
);
strncpy
(
buffer
,
env
,
len
);
count
=
0
;
shaper_list
[
count
++
]
=
buffer
;
for
(
char
*
p
=
buffer
;
(
p
=
strchr
(
p
,
','
))
&&
(
*
p
=
'\0'
,
TRUE
)
&&
p
++
;
)
shaper_list
[
count
++
]
=
p
;
shaper_list
[
count
++
]
=
"fallback"
;
shaper_list
[
count
]
=
NULL
;
}
~
static_shaper_list_t
(
void
)
{
if
((
char
*
)
shaper_list
!=
static_buffer
)
free
(
shaper_list
);
ASSERT_STATIC
((
ARRAY_LENGTH
(
shapers
)
+
1
)
*
sizeof
(
*
shaper_list
)
<=
sizeof
(
shaper_list
));
unsigned
int
i
;
for
(
i
=
0
;
i
<
ARRAY_LENGTH
(
shapers
);
i
++
)
shaper_list
[
i
]
=
shapers
[
i
].
name
;
shaper_list
[
i
]
=
NULL
;
}
const
char
**
shaper_list
;
char
static_buffer
[
32
];
const
char
*
shaper_list
[
ARRAY_LENGTH
(
shapers
)
+
1
];
}
static_shaper_list
;
const
char
**
...
...
@@ -124,11 +117,6 @@ hb_shape_full (hb_font_t *font,
const
char
*
shaper_options
,
const
char
**
shaper_list
)
{
/* TODO
* This function, and shaper_list handling need to be redone. */
if
(
likely
(
!
shaper_list
))
shaper_list
=
static_shaper_list
.
shaper_list
;
if
(
likely
(
!
shaper_list
))
{
for
(
unsigned
int
i
=
0
;
i
<
ARRAY_LENGTH
(
shapers
);
i
++
)
if
(
likely
(
shapers
[
i
].
func
(
font
,
buffer
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录