Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
f0554427
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看板
提交
f0554427
编写于
7月 19, 2012
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[Indic] Lookup consonant position in the font
Fixes most failures of Oriya, and improves others a bit.
上级
74d1d887
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
54 addition
and
127 deletion
+54
-127
src/hb-ot-map-private.hh
src/hb-ot-map-private.hh
+9
-4
src/hb-ot-shape-complex-indic-private.hh
src/hb-ot-shape-complex-indic-private.hh
+0
-105
src/hb-ot-shape-complex-indic.cc
src/hb-ot-shape-complex-indic.cc
+45
-18
未找到文件。
src/hb-ot-map-private.hh
浏览文件 @
f0554427
...
@@ -50,17 +50,22 @@ struct hb_ot_map_t
...
@@ -50,17 +50,22 @@ struct hb_ot_map_t
inline
hb_mask_t
get_global_mask
(
void
)
const
{
return
global_mask
;
}
inline
hb_mask_t
get_global_mask
(
void
)
const
{
return
global_mask
;
}
inline
hb_mask_t
get_mask
(
hb_tag_t
tag
,
unsigned
int
*
shift
=
NULL
)
const
{
inline
hb_mask_t
get_mask
(
hb_tag_t
feature_
tag
,
unsigned
int
*
shift
=
NULL
)
const
{
const
feature_map_t
*
map
=
features
.
bsearch
(
&
tag
);
const
feature_map_t
*
map
=
features
.
bsearch
(
&
feature_
tag
);
if
(
shift
)
*
shift
=
map
?
map
->
shift
:
0
;
if
(
shift
)
*
shift
=
map
?
map
->
shift
:
0
;
return
map
?
map
->
mask
:
0
;
return
map
?
map
->
mask
:
0
;
}
}
inline
hb_mask_t
get_1_mask
(
hb_tag_t
tag
)
const
{
inline
hb_mask_t
get_1_mask
(
hb_tag_t
feature_
tag
)
const
{
const
feature_map_t
*
map
=
features
.
bsearch
(
&
tag
);
const
feature_map_t
*
map
=
features
.
bsearch
(
&
feature_
tag
);
return
map
?
map
->
_1_mask
:
0
;
return
map
?
map
->
_1_mask
:
0
;
}
}
inline
hb_mask_t
get_feature_index
(
unsigned
int
table_index
,
hb_tag_t
feature_tag
)
const
{
const
feature_map_t
*
map
=
features
.
bsearch
(
&
feature_tag
);
return
map
?
map
->
index
[
table_index
]
:
HB_OT_LAYOUT_NO_FEATURE_INDEX
;
}
inline
hb_tag_t
get_chosen_script
(
unsigned
int
table_index
)
const
inline
hb_tag_t
get_chosen_script
(
unsigned
int
table_index
)
const
{
return
chosen_script
[
table_index
];
}
{
return
chosen_script
[
table_index
];
}
...
...
src/hb-ot-shape-complex-indic-private.hh
浏览文件 @
f0554427
...
@@ -164,111 +164,6 @@ enum indic_matra_category_t {
...
@@ -164,111 +164,6 @@ enum indic_matra_category_t {
#include "hb-ot-shape-complex-indic-table.hh"
#include "hb-ot-shape-complex-indic-table.hh"
/* XXX
* This is a hack for now. We should:
* 1. Move this data into the main Indic table,
* and/or
* 2. Probe font lookups to determine consonant positions.
*/
static
const
struct
consonant_position_t
{
hb_codepoint_t
u
;
indic_position_t
position
;
}
consonant_positions
[]
=
{
{
0x0930
,
POS_BELOW_C
},
{
0x09AC
,
POS_BELOW_C
},
{
0x09AF
,
POS_POST_C
},
{
0x09B0
,
POS_BELOW_C
},
{
0x09F0
,
POS_BELOW_C
},
{
0x0A2F
,
POS_POST_C
},
{
0x0A30
,
POS_BELOW_C
},
{
0x0A35
,
POS_BELOW_C
},
{
0x0A39
,
POS_BELOW_C
},
{
0x0AB0
,
POS_BELOW_C
},
{
0x0B24
,
POS_BELOW_C
},
{
0x0B28
,
POS_BELOW_C
},
{
0x0B2C
,
POS_BELOW_C
},
{
0x0B2D
,
POS_BELOW_C
},
{
0x0B2E
,
POS_BELOW_C
},
{
0x0B2F
,
POS_POST_C
},
{
0x0B30
,
POS_BELOW_C
},
{
0x0B32
,
POS_BELOW_C
},
{
0x0B33
,
POS_BELOW_C
},
{
0x0B5F
,
POS_POST_C
},
{
0x0B71
,
POS_BELOW_C
},
{
0x0C15
,
POS_BELOW_C
},
{
0x0C16
,
POS_BELOW_C
},
{
0x0C17
,
POS_BELOW_C
},
{
0x0C18
,
POS_BELOW_C
},
{
0x0C19
,
POS_BELOW_C
},
{
0x0C1A
,
POS_BELOW_C
},
{
0x0C1B
,
POS_BELOW_C
},
{
0x0C1C
,
POS_BELOW_C
},
{
0x0C1D
,
POS_BELOW_C
},
{
0x0C1E
,
POS_BELOW_C
},
{
0x0C1F
,
POS_BELOW_C
},
{
0x0C20
,
POS_BELOW_C
},
{
0x0C21
,
POS_BELOW_C
},
{
0x0C22
,
POS_BELOW_C
},
{
0x0C23
,
POS_BELOW_C
},
{
0x0C24
,
POS_BELOW_C
},
{
0x0C25
,
POS_BELOW_C
},
{
0x0C26
,
POS_BELOW_C
},
{
0x0C27
,
POS_BELOW_C
},
{
0x0C28
,
POS_BELOW_C
},
{
0x0C2A
,
POS_BELOW_C
},
{
0x0C2B
,
POS_BELOW_C
},
{
0x0C2C
,
POS_BELOW_C
},
{
0x0C2D
,
POS_BELOW_C
},
{
0x0C2E
,
POS_BELOW_C
},
{
0x0C2F
,
POS_BELOW_C
},
{
0x0C30
,
POS_BELOW_C
},
{
0x0C32
,
POS_BELOW_C
},
{
0x0C33
,
POS_BELOW_C
},
{
0x0C35
,
POS_BELOW_C
},
{
0x0C36
,
POS_BELOW_C
},
{
0x0C37
,
POS_BELOW_C
},
{
0x0C38
,
POS_BELOW_C
},
{
0x0C39
,
POS_BELOW_C
},
{
0x0C95
,
POS_BELOW_C
},
{
0x0C96
,
POS_BELOW_C
},
{
0x0C97
,
POS_BELOW_C
},
{
0x0C98
,
POS_BELOW_C
},
{
0x0C99
,
POS_BELOW_C
},
{
0x0C9A
,
POS_BELOW_C
},
{
0x0C9B
,
POS_BELOW_C
},
{
0x0C9C
,
POS_BELOW_C
},
{
0x0C9D
,
POS_BELOW_C
},
{
0x0C9E
,
POS_BELOW_C
},
{
0x0C9F
,
POS_BELOW_C
},
{
0x0CA0
,
POS_BELOW_C
},
{
0x0CA1
,
POS_BELOW_C
},
{
0x0CA2
,
POS_BELOW_C
},
{
0x0CA3
,
POS_BELOW_C
},
{
0x0CA4
,
POS_BELOW_C
},
{
0x0CA5
,
POS_BELOW_C
},
{
0x0CA6
,
POS_BELOW_C
},
{
0x0CA7
,
POS_BELOW_C
},
{
0x0CA8
,
POS_BELOW_C
},
{
0x0CAA
,
POS_BELOW_C
},
{
0x0CAB
,
POS_BELOW_C
},
{
0x0CAC
,
POS_BELOW_C
},
{
0x0CAD
,
POS_BELOW_C
},
{
0x0CAE
,
POS_BELOW_C
},
{
0x0CAF
,
POS_BELOW_C
},
{
0x0CB0
,
POS_BELOW_C
},
{
0x0CB2
,
POS_BELOW_C
},
{
0x0CB3
,
POS_BELOW_C
},
{
0x0CB5
,
POS_BELOW_C
},
{
0x0CB6
,
POS_BELOW_C
},
{
0x0CB7
,
POS_BELOW_C
},
{
0x0CB8
,
POS_BELOW_C
},
{
0x0CB9
,
POS_BELOW_C
},
{
0x0CDE
,
POS_BELOW_C
},
{
0x0D2F
,
POS_POST_C
},
{
0x0D30
,
POS_POST_C
},
{
0x0D32
,
POS_BELOW_C
},
{
0x0D35
,
POS_POST_C
},
};
/* XXX
/* XXX
* This is a hack for now. We should move this data into the main Indic table.
* This is a hack for now. We should move this data into the main Indic table.
...
...
src/hb-ot-shape-complex-indic.cc
浏览文件 @
f0554427
...
@@ -87,21 +87,48 @@ compare_codepoint (const void *pa, const void *pb)
...
@@ -87,21 +87,48 @@ compare_codepoint (const void *pa, const void *pb)
return
a
<
b
?
-
1
:
a
==
b
?
0
:
+
1
;
return
a
<
b
?
-
1
:
a
==
b
?
0
:
+
1
;
}
}
static
indic_position_t
static
bool
consonant_position
(
hb_codepoint_t
u
)
would_substitute
(
hb_codepoint_t
*
glyphs
,
unsigned
int
glyphs_count
,
hb_tag_t
feature_tag
,
hb_ot_map_t
*
map
,
hb_face_t
*
face
)
{
{
consonant_position_t
*
record
;
unsigned
int
lookup_indices
[
32
];
unsigned
int
offset
,
len
;
/* Khmer does not have pre-base half forms. */
if
(
0x1780
<=
u
&&
u
<=
0x17FF
)
offset
=
0
;
return
POS_BELOW_C
;
do
{
len
=
ARRAY_LENGTH
(
lookup_indices
);
record
=
(
consonant_position_t
*
)
bsearch
(
&
u
,
consonant_positions
,
hb_ot_layout_feature_get_lookup_indexes
(
face
,
HB_OT_TAG_GSUB
,
ARRAY_LENGTH
(
consonant_positions
),
map
->
get_feature_index
(
0
/*GSUB*/
,
feature_tag
),
sizeof
(
consonant_positions
[
0
]),
offset
,
compare_codepoint
);
&
len
,
lookup_indices
);
for
(
unsigned
int
i
=
0
;
i
<
len
;
i
++
)
if
(
hb_ot_layout_would_substitute_lookup
(
face
,
glyphs
,
glyphs_count
,
lookup_indices
[
i
]))
return
true
;
offset
+=
len
;
}
while
(
len
==
ARRAY_LENGTH
(
lookup_indices
));
return
false
;
}
return
record
?
record
->
position
:
POS_BASE_C
;
static
indic_position_t
consonant_position
(
hb_codepoint_t
u
,
hb_ot_map_t
*
map
,
hb_font_t
*
font
)
{
hb_codepoint_t
virama
=
(
u
&
~
0x007F
)
|
0x004D
;
if
((
u
&
~
0x007F
)
==
0x0D80
)
virama
=
0x0DCA
;
/* Sinahla */
if
((
u
&
~
0x007F
)
==
0x1780
)
virama
=
0x17D2
;
/* Khmer */
hb_codepoint_t
glyphs
[
2
];
hb_font_get_glyph
(
font
,
virama
,
0
,
&
glyphs
[
0
]);
hb_font_get_glyph
(
font
,
u
,
0
,
&
glyphs
[
1
]);
hb_face_t
*
face
=
hb_font_get_face
(
font
);
if
(
would_substitute
(
glyphs
,
ARRAY_LENGTH
(
glyphs
),
HB_TAG
(
'p'
,
'r'
,
'e'
,
'f'
),
map
,
face
))
return
POS_BELOW_C
;
if
(
would_substitute
(
glyphs
,
ARRAY_LENGTH
(
glyphs
),
HB_TAG
(
'b'
,
'l'
,
'w'
,
'f'
),
map
,
face
))
return
POS_BELOW_C
;
if
(
would_substitute
(
glyphs
,
ARRAY_LENGTH
(
glyphs
),
HB_TAG
(
'p'
,
's'
,
't'
,
'f'
),
map
,
face
))
return
POS_POST_C
;
return
POS_BASE_C
;
}
}
#define MATRA_POS_LEFT(u) POS_PRE_M
#define MATRA_POS_LEFT(u) POS_PRE_M
...
@@ -193,7 +220,7 @@ is_halant_or_coeng (const hb_glyph_info_t &info)
...
@@ -193,7 +220,7 @@ is_halant_or_coeng (const hb_glyph_info_t &info)
}
}
static
inline
void
static
inline
void
set_indic_properties
(
hb_glyph_info_t
&
info
)
set_indic_properties
(
hb_glyph_info_t
&
info
,
hb_ot_map_t
*
map
,
hb_font_t
*
font
)
{
{
hb_codepoint_t
u
=
info
.
codepoint
;
hb_codepoint_t
u
=
info
.
codepoint
;
unsigned
int
type
=
get_indic_categories
(
u
);
unsigned
int
type
=
get_indic_categories
(
u
);
...
@@ -247,7 +274,7 @@ set_indic_properties (hb_glyph_info_t &info)
...
@@ -247,7 +274,7 @@ set_indic_properties (hb_glyph_info_t &info)
if
((
FLAG
(
cat
)
&
CONSONANT_FLAGS
))
if
((
FLAG
(
cat
)
&
CONSONANT_FLAGS
))
{
{
pos
=
consonant_position
(
u
);
pos
=
consonant_position
(
u
,
map
,
font
);
if
(
is_ra
(
u
))
if
(
is_ra
(
u
))
cat
=
OT_Ra
;
cat
=
OT_Ra
;
}
}
...
@@ -380,9 +407,9 @@ _hb_ot_shape_complex_normalization_preference_indic (void)
...
@@ -380,9 +407,9 @@ _hb_ot_shape_complex_normalization_preference_indic (void)
void
void
_hb_ot_shape_complex_setup_masks_indic
(
hb_ot_map_t
*
map
HB_UNUSED
,
_hb_ot_shape_complex_setup_masks_indic
(
hb_ot_map_t
*
map
,
hb_buffer_t
*
buffer
,
hb_buffer_t
*
buffer
,
hb_font_t
*
font
HB_UNUSED
)
hb_font_t
*
font
)
{
{
HB_BUFFER_ALLOCATE_VAR
(
buffer
,
indic_category
);
HB_BUFFER_ALLOCATE_VAR
(
buffer
,
indic_category
);
HB_BUFFER_ALLOCATE_VAR
(
buffer
,
indic_position
);
HB_BUFFER_ALLOCATE_VAR
(
buffer
,
indic_position
);
...
@@ -392,7 +419,7 @@ _hb_ot_shape_complex_setup_masks_indic (hb_ot_map_t *map HB_UNUSED,
...
@@ -392,7 +419,7 @@ _hb_ot_shape_complex_setup_masks_indic (hb_ot_map_t *map HB_UNUSED,
unsigned
int
count
=
buffer
->
len
;
unsigned
int
count
=
buffer
->
len
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
set_indic_properties
(
buffer
->
info
[
i
]);
set_indic_properties
(
buffer
->
info
[
i
]
,
map
,
font
);
}
}
static
int
static
int
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录