Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
30bd763f
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看板
提交
30bd763f
编写于
4月 15, 2009
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Implement the first substitute()
上级
ce48f039
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
151 addition
and
56 deletion
+151
-56
src/harfbuzz-buffer-private.h
src/harfbuzz-buffer-private.h
+4
-4
src/harfbuzz-buffer.c
src/harfbuzz-buffer.c
+2
-2
src/harfbuzz-buffer.h
src/harfbuzz-buffer.h
+1
-1
src/harfbuzz-gdef-private.h
src/harfbuzz-gdef-private.h
+2
-2
src/harfbuzz-gdef.c
src/harfbuzz-gdef.c
+3
-3
src/harfbuzz-gdef.h
src/harfbuzz-gdef.h
+1
-1
src/harfbuzz-gpos.c
src/harfbuzz-gpos.c
+4
-4
src/harfbuzz-gpos.h
src/harfbuzz-gpos.h
+1
-1
src/harfbuzz-gsub.h
src/harfbuzz-gsub.h
+1
-1
src/hb-ot-layout-gsub-private.h
src/hb-ot-layout-gsub-private.h
+80
-8
src/hb-ot-layout-open-private.h
src/hb-ot-layout-open-private.h
+1
-1
src/hb-ot-layout-private.h
src/hb-ot-layout-private.h
+13
-10
src/hb-ot-layout.cc
src/hb-ot-layout.cc
+37
-17
src/hb-ot-layout.h
src/hb-ot-layout.h
+1
-1
未找到文件。
src/harfbuzz-buffer-private.h
浏览文件 @
30bd763f
...
...
@@ -33,7 +33,7 @@
HB_BEGIN_HEADER
#define HB_GLYPH_PROPERT
IES
_UNKNOWN 0xFFFF
#define HB_GLYPH_PROPERT
Y
_UNKNOWN 0xFFFF
HB_INTERNAL
void
_hb_buffer_swap
(
HB_Buffer
buffer
);
...
...
@@ -83,9 +83,9 @@ _hb_buffer_allocate_ligid( HB_Buffer buffer );
#define OUT_GLYPH( pos ) (buffer->out_string[(pos)].gindex)
#define OUT_ITEM( pos ) (&buffer->out_string[(pos)])
#define CHECK_Property( layout, index, flags, propert
y
) \
(
error = _hb_ot_layout_check_glyph_properties((layout), (index), (flags), (property
)) \
? HB_Err_Ok : HB_Err_Not_Covered)
#define CHECK_Property( layout, index, flags, propert
ies
) \
(
{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), \
...
...
src/harfbuzz-buffer.c
浏览文件 @
30bd763f
...
...
@@ -187,7 +187,7 @@ hb_buffer_add_glyph( HB_Buffer buffer,
glyph
->
cluster
=
cluster
;
glyph
->
component
=
0
;
glyph
->
ligID
=
0
;
glyph
->
gpropert
ies
=
HB_GLYPH_PROPERTIES
_UNKNOWN
;
glyph
->
gpropert
y
=
HB_GLYPH_PROPERTY
_UNKNOWN
;
buffer
->
in_length
++
;
...
...
@@ -304,7 +304,7 @@ _hb_buffer_add_output_glyphs( HB_Buffer buffer,
item
->
cluster
=
cluster
;
item
->
component
=
component
;
item
->
ligID
=
ligID
;
item
->
gpropert
ies
=
HB_GLYPH_PROPERTIES
_UNKNOWN
;
item
->
gpropert
y
=
HB_GLYPH_PROPERTY
_UNKNOWN
;
}
buffer
->
in_pos
+=
num_in
;
...
...
src/harfbuzz-buffer.h
浏览文件 @
30bd763f
...
...
@@ -38,7 +38,7 @@ typedef struct HB_GlyphItemRec_ {
HB_UInt
cluster
;
HB_UShort
component
;
HB_UShort
ligID
;
HB_UShort
gpropert
ies
;
HB_UShort
gpropert
y
;
}
HB_GlyphItemRec
,
*
HB_GlyphItem
;
typedef
struct
HB_PositionRec_
{
...
...
src/harfbuzz-gdef-private.h
浏览文件 @
30bd763f
...
...
@@ -105,13 +105,13 @@ struct HB_LigGlyph_
HB_INTERNAL
HB_Error
_HB_GDEF_Add_Glyph_Property
(
HB_GDEFHeader
*
gdef
,
HB_UShort
glyphID
,
HB_UShort
propert
y
);
HB_UShort
propert
ies
);
HB_INTERNAL
HB_Error
_HB_GDEF_Check_Property
(
HB_GDEFHeader
*
gdef
,
HB_GlyphItem
item
,
HB_UShort
flags
,
HB_UShort
*
propert
y
);
HB_UShort
*
propert
ies
);
HB_INTERNAL
HB_Error
_HB_GDEF_LoadMarkAttachClassDef_From_LookupFlags
(
HB_GDEFHeader
*
gdef
,
...
...
src/harfbuzz-gdef.c
浏览文件 @
30bd763f
...
...
@@ -1074,14 +1074,14 @@ _HB_GDEF_Check_Property( HB_GDEFHeader* gdef,
HB_UShort
basic_glyph_class
;
HB_UShort
desired_attachment_class
;
if
(
gitem
->
gpropert
ies
==
HB_GLYPH_PROPERTIES
_UNKNOWN
)
if
(
gitem
->
gpropert
y
==
HB_GLYPH_PROPERTY
_UNKNOWN
)
{
error
=
HB_GDEF_Get_Glyph_Property
(
gdef
,
gitem
->
gindex
,
&
gitem
->
gpropert
ies
);
error
=
HB_GDEF_Get_Glyph_Property
(
gdef
,
gitem
->
gindex
,
&
gitem
->
gpropert
y
);
if
(
error
)
return
error
;
}
*
property
=
gitem
->
gpropert
ies
;
*
property
=
gitem
->
gpropert
y
;
/* If the glyph was found in the MarkAttachmentClass table,
* then that class value is the high byte of the result,
...
...
src/harfbuzz-gdef.h
浏览文件 @
30bd763f
...
...
@@ -121,7 +121,7 @@ HB_Error HB_Done_GDEF_Table ( HB_GDEFHeader* gdef );
HB_Error
HB_GDEF_Get_Glyph_Property
(
HB_GDEFHeader
*
gdef
,
HB_UShort
glyphID
,
HB_UShort
*
propert
y
);
HB_UShort
*
propert
ies
);
HB_Error
HB_GDEF_Build_ClassDefinition
(
HB_GDEFHeader
*
gdef
,
HB_UShort
num_glyphs
,
...
...
src/harfbuzz-gpos.c
浏览文件 @
30bd763f
...
...
@@ -1783,7 +1783,7 @@ static HB_Error Lookup_CursivePos( GPOS_Instance* gpi,
return
HB_Err_Not_Covered
;
}
/* Glyphs not having the right GDEF propert
ies
will be ignored, i.e.,
/* Glyphs not having the right GDEF propert
y
will be ignored, i.e.,
gpi->last won't be reset (contrary to user defined properties). */
if
(
CHECK_Property
(
gpos
->
layout
,
IN_CURITEM
(),
flags
,
&
property
)
)
...
...
@@ -2224,7 +2224,7 @@ static HB_Error Lookup_MarkBasePos( GPOS_Instance* gpi,
while
(
i
<=
buffer
->
in_pos
)
{
property
=
_hb_ot_layout_get_glyph_propert
ies
(
gpos
->
layout
,
IN_GLYPH
(
j
));
property
=
_hb_ot_layout_get_glyph_propert
y
(
gpos
->
layout
,
IN_GLYPH
(
j
));
if
(
!
property
)
return
HB_Err_Not_Covered
;
...
...
@@ -2633,7 +2633,7 @@ static HB_Error Lookup_MarkLigPos( GPOS_Instance* gpi,
while
(
i
<=
buffer
->
in_pos
)
{
property
=
_hb_ot_layout_get_glyph_propert
ies
(
gpos
->
layout
,
IN_GLYPH
(
j
));
property
=
_hb_ot_layout_get_glyph_propert
y
(
gpos
->
layout
,
IN_GLYPH
(
j
));
if
(
!
property
)
return
HB_Err_Not_Covered
;
...
...
@@ -2960,7 +2960,7 @@ static HB_Error Lookup_MarkMarkPos( GPOS_Instance* gpi,
j
=
buffer
->
in_pos
-
1
;
while
(
i
<=
buffer
->
in_pos
)
{
property
=
_hb_ot_layout_get_glyph_propert
ies
(
gpos
->
layout
,
IN_GLYPH
(
j
));
property
=
_hb_ot_layout_get_glyph_propert
y
(
gpos
->
layout
,
IN_GLYPH
(
j
));
if
(
!
property
)
return
HB_Err_Not_Covered
;
...
...
src/harfbuzz-gpos.h
浏览文件 @
30bd763f
...
...
@@ -145,7 +145,7 @@ HB_Error HB_GPOS_Query_Features( HB_GPOSHeader* gpos,
HB_Error
HB_GPOS_Add_Feature
(
HB_GPOSHeader
*
gpos
,
HB_UShort
feature_index
,
HB_UInt
propert
y
);
HB_UInt
propert
ies
);
HB_Error
HB_GPOS_Clear_Features
(
HB_GPOSHeader
*
gpos
);
...
...
src/harfbuzz-gsub.h
浏览文件 @
30bd763f
...
...
@@ -121,7 +121,7 @@ HB_Error HB_GSUB_Query_Features( HB_GSUBHeader* gsub,
HB_Error
HB_GSUB_Add_Feature
(
HB_GSUBHeader
*
gsub
,
HB_UShort
feature_index
,
HB_UInt
propert
y
);
HB_UInt
propert
ies
);
HB_Error
HB_GSUB_Clear_Features
(
HB_GSUBHeader
*
gsub
);
...
...
src/hb-ot-layout-gsub-private.h
浏览文件 @
30bd763f
...
...
@@ -32,19 +32,89 @@
#include "hb-ot-layout-open-private.h"
#include "hb-ot-layout-gdef-private.h"
#include "harfbuzz-buffer-private.h"
/* XXX */
#define DEFINE_GET_GLYPH_COVERAGE(name) \
inline hb_ot_layout_coverage_t get_##name (hb_codepoint_t glyph) const { \
const Coverage &c = get_coverage (); \
return c.get_coverage (glyph); \
}
#define SUBTABLE_SUBSTITUTE \
bool substitute (hb_ot_layout_t *layout, \
hb_buffer_t *buffer, \
unsigned int context_length, \
unsigned int nesting_level_left, \
unsigned int lookup_flag) const
struct
SingleSubstFormat1
{
friend
struct
SingleSubst
;
private:
inline
bool
substitute
(
hb_ot_layout_t
*
layout
,
hb_buffer_t
*
buffer
,
unsigned
int
context_length
,
unsigned
int
nesting_level_left
)
const
{
// if (get_coverage (IN_CURGLYPH()))
// return ;
DEFINE_GET_ACCESSOR
(
Coverage
,
coverage
,
coverage
);
DEFINE_GET_GLYPH_COVERAGE
(
glyph_coverage
);
inline
SUBTABLE_SUBSTITUTE
{
hb_codepoint_t
glyph_id
;
hb_ot_layout_coverage_t
index
;
unsigned
int
property
;
HB_UNUSED
(
nesting_level_left
);
if
(
HB_UNLIKELY
(
context_length
<
1
))
return
false
;
if
(
!
_hb_ot_layout_check_glyph_property
(
layout
,
IN_CURITEM
(),
lookup_flag
,
&
property
))
return
false
;
glyph_id
=
IN_CURGLYPH
();
index
=
get_glyph_coverage
(
glyph_id
);
if
(
-
1
==
index
)
return
false
;
glyph_id
+=
deltaGlyphID
;
_hb_buffer_replace_output_glyph
(
buffer
,
glyph_id
,
context_length
==
NO_CONTEXT
);
if
(
_hb_ot_layout_has_new_glyph_classes
(
layout
)
)
{
/* we inherit the old glyph class to the substituted glyph */
_hb_ot_layout_set_glyph_property
(
layout
,
glyph_id
,
property
);
}
return
true
;
}
#if 0
switch ( ss->SubstFormat )
{
case 1:
value = (IN_CURGLYPH() + ss->ssf.ssf1.DeltaGlyphID ) & 0xFFFF;
if ( REPLACE_Glyph( buffer, value, nesting_level ) )
return error;
break;
case 2:
if ( index >= ss->ssf.ssf2.GlyphCount )
return ERR(HB_Err_Invalid_SubTable);
value = ss->ssf.ssf2.Substitute[index];
if ( REPLACE_Glyph( buffer, value, nesting_level ) )
return error;
break;
default:
return ERR(HB_Err_Invalid_SubTable);
}
if ( _hb_ot_layout_has_new_glyph_classes (layout) )
{
/* we inherit the old glyph class to the substituted glyph */
hb_ot_layout_set_glyph_class (layout, value, properties);
}
#endif
private:
USHORT
substFormat
;
/* Format identifier--format = 1 */
...
...
@@ -490,7 +560,8 @@ struct SubstLookupSubTable {
hb_buffer_t
*
buffer
,
unsigned
int
context_length
,
unsigned
int
nesting_level_left
,
unsigned
int
lookup_type
)
const
{
unsigned
int
lookup_type
,
unsigned
int
lookup_flag
)
const
{
}
private:
...
...
@@ -545,6 +616,7 @@ struct SubstLookup : Lookup {
unsigned
int
context_length
,
unsigned
int
nesting_level_left
)
const
{
unsigned
int
lookup_type
=
get_type
();
unsigned
int
lookup_flag
=
get_flag
();
if
(
HB_UNLIKELY
(
nesting_level_left
==
0
))
return
false
;
...
...
@@ -553,7 +625,7 @@ struct SubstLookup : Lookup {
for
(
unsigned
int
i
=
0
;
i
<
get_subtable_count
();
i
++
)
if
(
get_subtable
(
i
).
substitute
(
layout
,
buffer
,
context_length
,
nesting_level_left
,
lookup_type
))
lookup_type
,
lookup_flag
))
return
true
;
return
false
;
...
...
src/hb-ot-layout-open-private.h
浏览文件 @
30bd763f
...
...
@@ -671,7 +671,7 @@ struct Lookup {
inline
bool
ignore_base_glyphs
(
void
)
const
{
return
lookupFlag
&
LookupFlag
::
IgnoreBaseGlyphs
;
}
inline
bool
ignore_ligatures
(
void
)
const
{
return
lookupFlag
&
LookupFlag
::
IgnoreLigatures
;
}
inline
bool
ignore_marks
(
void
)
const
{
return
lookupFlag
&
LookupFlag
::
IgnoreMarks
;
}
inline
bool
get_mark_attachment_type
(
void
)
const
{
return
lookupFlag
&
LookupFlag
::
MarkAttachmentType
;
}
inline
unsigned
int
get_mark_attachment_type
(
void
)
const
{
return
lookupFlag
&
LookupFlag
::
MarkAttachmentType
;
}
inline
unsigned
int
get_type
(
void
)
const
{
return
lookupType
;
}
inline
unsigned
int
get_flag
(
void
)
const
{
return
lookupFlag
;
}
...
...
src/hb-ot-layout-private.h
浏览文件 @
30bd763f
...
...
@@ -34,9 +34,7 @@
#include "harfbuzz-buffer.h"
typedef
uint16_t
hb_ot_layout_class_t
;
typedef
uint16_t
hb_ot_layout_glyph_properties_t
;
typedef
uint16_t
hb_ot_layout_lookup_flags_t
;
typedef
unsigned
int
hb_ot_layout_class_t
;
typedef
int
hb_ot_layout_coverage_t
;
/* -1 is not covered, >= 0 otherwise */
/* XXX #define HB_OT_LAYOUT_INTERNAL static */
...
...
@@ -51,15 +49,20 @@ HB_BEGIN_DECLS();
HB_OT_LAYOUT_INTERNAL
hb_bool_t
_hb_ot_layout_has_new_glyph_classes
(
hb_ot_layout_t
*
layout
);
HB_OT_LAYOUT_INTERNAL
hb_ot_layout_glyph_properties_t
_hb_ot_layout_get_glyph_properties
(
hb_ot_layout_t
*
layout
,
hb_codepoint_t
glyph
);
HB_OT_LAYOUT_INTERNAL
unsigned
int
_hb_ot_layout_get_glyph_property
(
hb_ot_layout_t
*
layout
,
hb_codepoint_t
glyph
);
HB_OT_LAYOUT_INTERNAL
void
_hb_ot_layout_set_glyph_property
(
hb_ot_layout_t
*
layout
,
hb_codepoint_t
glyph
,
unsigned
int
property
);
HB_OT_LAYOUT_INTERNAL
hb_bool_t
_hb_ot_layout_check_glyph_propert
ies
(
hb_ot_layout_t
*
layout
,
HB_GlyphItem
gitem
,
hb_ot_layout_lookup_flags_t
lookup_flags
,
hb_ot_layout_glyph_properties_t
*
property
);
_hb_ot_layout_check_glyph_propert
y
(
hb_ot_layout_t
*
layout
,
HB_GlyphItem
gitem
,
unsigned
int
lookup_flags
,
unsigned
int
*
property
);
HB_END_DECLS
();
...
...
src/hb-ot-layout.cc
浏览文件 @
30bd763f
...
...
@@ -98,6 +98,8 @@ hb_ot_layout_destroy (hb_ot_layout_t *layout)
* GDEF
*/
/* XXX the public class_t is a mess */
hb_bool_t
hb_ot_layout_has_font_glyph_classes
(
hb_ot_layout_t
*
layout
)
{
...
...
@@ -110,9 +112,9 @@ _hb_ot_layout_has_new_glyph_classes (hb_ot_layout_t *layout)
return
layout
->
new_gdef
.
len
>
0
;
}
HB_OT_LAYOUT_INTERNAL
hb_ot_layout_glyph_properties_
t
_hb_ot_layout_get_glyph_propert
ies
(
hb_ot_layout_t
*
layout
,
hb_codepoint_t
glyph
)
HB_OT_LAYOUT_INTERNAL
unsigned
in
t
_hb_ot_layout_get_glyph_propert
y
(
hb_ot_layout_t
*
layout
,
hb_codepoint_t
glyph
)
{
hb_ot_layout_class_t
klass
;
...
...
@@ -138,22 +140,22 @@ _hb_ot_layout_get_glyph_properties (hb_ot_layout_t *layout,
}
HB_OT_LAYOUT_INTERNAL
hb_bool_t
_hb_ot_layout_check_glyph_propert
ies
(
hb_ot_layout_t
*
layout
,
HB_GlyphItem
gitem
,
hb_ot_layout_lookup_flags_t
lookup_flags
,
hb_ot_layout_glyph_properties_t
*
property
)
_hb_ot_layout_check_glyph_propert
y
(
hb_ot_layout_t
*
layout
,
HB_GlyphItem
gitem
,
unsigned
int
lookup_flags
,
unsigned
int
*
property
)
{
hb_ot_layout_glyph_class_t
basic_glyph_class
;
hb_ot_layout_glyph_properties_
t
desired_attachment_class
;
unsigned
in
t
desired_attachment_class
;
if
(
gitem
->
gpropert
ies
==
HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN
)
if
(
gitem
->
gpropert
y
==
HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN
)
{
gitem
->
gpropert
ies
=
*
property
=
_hb_ot_layout_get_glyph_properties
(
layout
,
gitem
->
gindex
);
if
(
gitem
->
gpropert
ies
==
HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED
)
gitem
->
gpropert
y
=
*
property
=
_hb_ot_layout_get_glyph_property
(
layout
,
gitem
->
gindex
);
if
(
gitem
->
gpropert
y
==
HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED
)
return
false
;
}
*
property
=
gitem
->
gpropert
ies
;
*
property
=
gitem
->
gpropert
y
;
/* If the glyph was found in the MarkAttachmentClass table,
* then that class value is the high byte of the result,
...
...
@@ -179,27 +181,42 @@ _hb_ot_layout_check_glyph_properties (hb_ot_layout_t *layout,
if
(
desired_attachment_class
)
{
if
(
basic_glyph_class
==
HB_OT_LAYOUT_GLYPH_CLASS_MARK
&&
*
property
!=
desired_attachment_class
)
*
property
!=
desired_attachment_class
)
return
false
;
}
return
true
;
}
HB_OT_LAYOUT_INTERNAL
void
_hb_ot_layout_set_glyph_property
(
hb_ot_layout_t
*
layout
,
hb_codepoint_t
glyph
,
unsigned
int
property
)
{
hb_ot_layout_glyph_class_t
klass
;
if
(
property
&
LookupFlag
::
MarkAttachmentType
)
klass
=
HB_OT_LAYOUT_GLYPH_CLASS_MARK
;
else
klass
=
(
hb_ot_layout_glyph_class_t
)
property
;
hb_ot_layout_set_glyph_class
(
layout
,
glyph
,
klass
);
}
hb_ot_layout_glyph_class_t
hb_ot_layout_get_glyph_class
(
hb_ot_layout_t
*
layout
,
hb_codepoint_t
glyph
)
{
hb_ot_layout_glyph_properties_t
properties
;
unsigned
int
property
;
hb_ot_layout_class_t
klass
;
propert
ies
=
_hb_ot_layout_get_glyph_properties
(
layout
,
glyph
);
propert
y
=
_hb_ot_layout_get_glyph_property
(
layout
,
glyph
);
if
(
propert
ies
&
0xFF00
)
if
(
propert
y
&
LookupFlag
::
MarkAttachmentType
)
return
HB_OT_LAYOUT_GLYPH_CLASS_MARK
;
return
(
hb_ot_layout_glyph_class_t
)
propert
ies
;
return
(
hb_ot_layout_glyph_class_t
)
propert
y
;
}
void
...
...
@@ -212,6 +229,9 @@ hb_ot_layout_set_glyph_class (hb_ot_layout_t *layout,
hb_ot_layout_class_t
gdef_klass
;
int
len
=
layout
->
new_gdef
.
len
;
if
(
G_UNLIKELY
(
glyph
>
65535
))
return
;
if
(
glyph
>=
len
)
{
int
new_len
;
unsigned
char
*
new_klasses
;
...
...
src/hb-ot-layout.h
浏览文件 @
30bd763f
...
...
@@ -91,7 +91,7 @@ typedef enum {
HB_OT_LAYOUT_TABLE_TYPE_NONE
}
hb_ot_layout_table_type_t
;
typedef
uint
16
_t
hb_ot_layout_feature_mask_t
;
typedef
uint
32
_t
hb_ot_layout_feature_mask_t
;
#define HB_OT_LAYOUT_MAX_NESTING_LEVEL 100
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录