Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
3b26f96e
T
Third Party Harfbuzz
项目概览
OpenHarmony
/
Third Party Harfbuzz
12 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
3b26f96e
编写于
4月 10, 2012
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add Thai shaper that does SARA AM decomposition / reordering
That's not in the OpenType spec, but it's what MS and Adobe do.
上级
0b6d2ac6
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
112 addition
and
1 deletion
+112
-1
src/hb-buffer.cc
src/hb-buffer.cc
+1
-0
src/hb-ot-shape-complex-misc.cc
src/hb-ot-shape-complex-misc.cc
+103
-1
src/hb-ot-shape-complex-private.hh
src/hb-ot-shape-complex-private.hh
+8
-0
未找到文件。
src/hb-buffer.cc
浏览文件 @
3b26f96e
...
...
@@ -223,6 +223,7 @@ hb_buffer_t::swap_buffers (void)
if
(
unlikely
(
in_error
))
return
;
assert
(
have_output
);
have_output
=
FALSE
;
if
(
out_info
!=
info
)
{
...
...
src/hb-ot-shape-complex-misc.cc
浏览文件 @
3b26f96e
...
...
@@ -27,7 +27,7 @@
#include "hb-ot-shape-complex-private.hh"
/* TODO Add kana,
hangul,
and other small shapers here */
/* TODO Add kana, and other small shapers here */
/* When adding trivial shapers, eg. kana, hangul, etc, we can either
* add a full shaper enum value for them, or switch on the script in
...
...
@@ -54,6 +54,8 @@ _hb_ot_shape_complex_setup_masks_default (hb_ot_map_t *map, hb_buffer_t *buffer)
/* Hangul shaper */
void
_hb_ot_shape_complex_collect_features_hangul
(
hb_ot_map_builder_t
*
map
,
const
hb_segment_properties_t
*
props
)
{
...
...
@@ -69,3 +71,103 @@ void
_hb_ot_shape_complex_setup_masks_hangul
(
hb_ot_map_t
*
map
,
hb_buffer_t
*
buffer
)
{
}
/* Thai / Lao shaper */
void
_hb_ot_shape_complex_collect_features_thai
(
hb_ot_map_builder_t
*
map
,
const
hb_segment_properties_t
*
props
)
{
}
hb_ot_shape_normalization_mode_t
_hb_ot_shape_complex_normalization_preference_thai
(
void
)
{
return
HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_FULL
;
}
void
_hb_ot_shape_complex_setup_masks_thai
(
hb_ot_map_t
*
map
,
hb_buffer_t
*
buffer
)
{
/* The following is NOT specified in the MS OT Thai spec, however, it seems
* to be what Uniscribe and other engines implement. According to Eric Muller:
*
* When you have a sara am, decompose it in nikhahit + sara a, *and* mode the
* nihka hit backwards over any *tone* mark (0E48-0E4B).
*
* <0E14, 0E4B, 0E33> -> <0E14, 0E4D, 0E4B, 0E32>
*
* This reordering is legit only when the nikhahit comes from a sara am, not
* when it's there to start with. The string <0E14, 0E4B, 0E4D> is probably
* not what a u↪ser wanted, but the rendering is nevertheless nikhahit above
* chattawa.
*
* Same for Lao.
*/
/*
* Here are the characters of significance:
*
* Thai Lao
* SARA AM: U+0E33 U+0EB3
* SARA AA: U+0E32 U+0EB2
* Nikhahit: U+0E4D U+0ECD
*
* Tone marks:
* Thai: <0E48..0E4B> CCC=107
* Lao: <0EC8..0ECB> CCC=122
*
* Note how the Lao versions are the same as Thai + 0x80.
*/
/* We only get one script at a time, so a script-agnostic implementation
* is adequate here. */
#define IS_SARA_AM(x) (((x) & ~0x0080) == 0x0E33)
#define NIKHAHIT_FROM_SARA_AM(x) ((x) - 0xE33 + 0xE4D)
#define SARA_AA_FROM_SARA_AM(x) ((x) - 1)
#define IS_TONE_MARK(x) (((x) & ~0x0083) == 0x0E48)
buffer
->
clear_output
();
unsigned
int
count
=
buffer
->
len
;
for
(
buffer
->
idx
=
0
;
buffer
->
idx
<
count
;)
{
if
(
!
IS_SARA_AM
(
buffer
->
info
[
buffer
->
idx
].
codepoint
))
{
buffer
->
next_glyph
();
continue
;
}
/* Is SARA AM. Decompose and reorder. */
uint16_t
decomposed
[
2
]
=
{
NIKHAHIT_FROM_SARA_AM
(
buffer
->
info
[
buffer
->
idx
].
codepoint
),
SARA_AA_FROM_SARA_AM
(
buffer
->
info
[
buffer
->
idx
].
codepoint
)};
buffer
->
replace_glyphs
(
1
,
2
,
decomposed
);
if
(
buffer
->
in_error
)
return
;
/* Ok, let's see... */
unsigned
int
end
=
buffer
->
out_len
;
unsigned
int
start
=
end
-
2
;
while
(
start
>
0
&&
IS_TONE_MARK
(
buffer
->
out_info
[
start
-
1
].
codepoint
))
start
--
;
/* Move Nikhahit (end-2) to the beginning */
hb_glyph_info_t
t
=
buffer
->
out_info
[
end
-
2
];
memmove
(
buffer
->
out_info
+
start
+
1
,
buffer
->
out_info
+
start
,
sizeof
(
buffer
->
out_info
[
0
])
*
(
end
-
start
-
2
));
buffer
->
out_info
[
start
]
=
t
;
/* Make cluster */
for
(;
start
>
0
&&
buffer
->
out_info
[
start
-
1
].
cluster
==
buffer
->
out_info
[
start
].
cluster
;
start
--
)
;
for
(;
buffer
->
idx
<
count
;)
if
(
buffer
->
info
[
buffer
->
idx
].
cluster
==
buffer
->
out_info
[
buffer
->
out_len
-
1
].
cluster
)
buffer
->
next_glyph
();
else
break
;
end
=
buffer
->
out_len
;
buffer
->
merge_out_clusters
(
start
,
end
);
}
buffer
->
swap_buffers
();
}
src/hb-ot-shape-complex-private.hh
浏览文件 @
3b26f96e
...
...
@@ -52,6 +52,7 @@
HB_COMPLEX_SHAPER_IMPLEMENT (arabic) \
HB_COMPLEX_SHAPER_IMPLEMENT (hangul) \
HB_COMPLEX_SHAPER_IMPLEMENT (indic) \
HB_COMPLEX_SHAPER_IMPLEMENT (thai) \
/* ^--- Add new shapers here */
enum
hb_ot_complex_shaper_t
{
...
...
@@ -91,6 +92,13 @@ hb_ot_shape_complex_categorize (const hb_segment_properties_t *props)
return
hb_ot_complex_shaper_hangul
;
/* Unicode-1.1 additions */
case
HB_SCRIPT_THAI
:
case
HB_SCRIPT_LAO
:
return
hb_ot_complex_shaper_thai
;
/* ^--- Add new shapers here */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录