Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
590d55cb
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,发现更多精彩内容 >>
提交
590d55cb
编写于
1月 24, 2008
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[GDEF] Finish public API
上级
aff831ed
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
176 addition
and
63 deletion
+176
-63
src/hb-common.h
src/hb-common.h
+11
-0
src/hb-ot-layout-gdef-private.h
src/hb-ot-layout-gdef-private.h
+13
-15
src/hb-ot-layout-open-private.h
src/hb-ot-layout-open-private.h
+15
-10
src/hb-ot-layout-private.h
src/hb-ot-layout-private.h
+5
-18
src/hb-ot-layout.cc
src/hb-ot-layout.cc
+115
-8
src/hb-ot-layout.h
src/hb-ot-layout.h
+17
-12
未找到文件。
src/hb-common.h
浏览文件 @
590d55cb
...
@@ -37,4 +37,15 @@
...
@@ -37,4 +37,15 @@
# define HB_END_DECLS() extern int hb_dummy_prototype (int)
# define HB_END_DECLS() extern int hb_dummy_prototype (int)
# endif
/* !__cplusplus */
# endif
/* !__cplusplus */
typedef
int
hb_bool_t
;
typedef
uint32_t
hb_tag_t
;
#define HB_TAG(a,b,c,d) ((hb_tag_t)(((uint8_t)a<<24)|((uint8_t)b<<16)|((uint8_t)c<<8)|(uint8_t)d))
#define HB_TAG_STR(s) (HB_TAG(((const char *) s)[0], \
((const char *) s)[1], \
((const char *) s)[2], \
((const char *) s)[3]))
typedef
uint16_t
hb_glyph_t
;
#endif
/* HB_COMMON_H */
#endif
/* HB_COMMON_H */
src/hb-ot-layout-gdef-private.h
浏览文件 @
590d55cb
...
@@ -33,7 +33,7 @@
...
@@ -33,7 +33,7 @@
#define DEFINE_INDIRECT_GLYPH_ARRAY_LOOKUP(Type, name) \
#define DEFINE_INDIRECT_GLYPH_ARRAY_LOOKUP(Type, name) \
inline const Type& name (hb_
ot_layout_
glyph_t glyph_id) { \
inline const Type& name (hb_glyph_t glyph_id) { \
const Coverage &c = get_coverage (); \
const Coverage &c = get_coverage (); \
hb_ot_layout_coverage_t c_index = c.get_coverage (glyph_id); \
hb_ot_layout_coverage_t c_index = c.get_coverage (glyph_id); \
return (*this)[c_index]; \
return (*this)[c_index]; \
...
@@ -72,13 +72,13 @@ struct AttachList {
...
@@ -72,13 +72,13 @@ struct AttachList {
friend
struct
GDEF
;
friend
struct
GDEF
;
private:
private:
/* const AttachPoint& get_attach_points (hb_
ot_layout_
glyph_t glyph_id); */
/* const AttachPoint& get_attach_points (hb_glyph_t glyph_id); */
DEFINE_INDIRECT_GLYPH_ARRAY_LOOKUP
(
AttachPoint
,
get_attach_points
);
DEFINE_INDIRECT_GLYPH_ARRAY_LOOKUP
(
AttachPoint
,
get_attach_points
);
private:
private:
/* AttachPoint tables, in Coverage Index order */
/* AttachPoint tables, in Coverage Index order */
DEFINE_OFFSET_ARRAY_TYPE
(
AttachPoint
,
attachPoint
,
glyphCount
);
DEFINE_OFFSET_ARRAY_TYPE
(
AttachPoint
,
attachPoint
,
glyphCount
);
DEFINE_
ACCESSOR
(
Coverage
,
get_
coverage
,
coverage
);
DEFINE_
GET_ACCESSOR
(
Coverage
,
coverage
,
coverage
);
private:
private:
Offset
coverage
;
/* Offset to Coverage table -- from
Offset
coverage
;
/* Offset to Coverage table -- from
...
@@ -205,13 +205,13 @@ struct LigCaretList {
...
@@ -205,13 +205,13 @@ struct LigCaretList {
friend
struct
GDEF
;
friend
struct
GDEF
;
private:
private:
/* const LigGlyph& get_lig_glyph (hb_
ot_layout_
glyph_t glyph_id); */
/* const LigGlyph& get_lig_glyph (hb_glyph_t glyph_id); */
DEFINE_INDIRECT_GLYPH_ARRAY_LOOKUP
(
LigGlyph
,
get_lig_glyph
);
DEFINE_INDIRECT_GLYPH_ARRAY_LOOKUP
(
LigGlyph
,
get_lig_glyph
);
private:
private:
/* AttachPoint tables, in Coverage Index order */
/* AttachPoint tables, in Coverage Index order */
DEFINE_OFFSET_ARRAY_TYPE
(
LigGlyph
,
ligGlyph
,
ligGlyphCount
);
DEFINE_OFFSET_ARRAY_TYPE
(
LigGlyph
,
ligGlyph
,
ligGlyphCount
);
DEFINE_
ACCESSOR
(
Coverage
,
get_
coverage
,
coverage
);
DEFINE_
GET_ACCESSOR
(
Coverage
,
coverage
,
coverage
);
private:
private:
Offset
coverage
;
/* Offset to Coverage table--from
Offset
coverage
;
/* Offset to Coverage table--from
...
@@ -240,19 +240,17 @@ struct GDEF {
...
@@ -240,19 +240,17 @@ struct GDEF {
STATIC_DEFINE_GET_FOR_DATA
(
GDEF
);
STATIC_DEFINE_GET_FOR_DATA
(
GDEF
);
/* XXX check version here? */
/* XXX check version here? */
DEFINE_
ACCESSOR
(
ClassDef
,
get_glyph_class_def
,
glyphClassDef
);
DEFINE_
GET_HAS_ACCESSOR
(
ClassDef
,
glyph_classes
,
glyphClassDef
);
DEFINE_
ACCESSOR
(
AttachList
,
get_
attach_list
,
attachList
);
DEFINE_
GET_HAS_ACCESSOR
(
AttachList
,
attach_list
,
attachList
);
DEFINE_
ACCESSOR
(
LigCaretList
,
get_
lig_caret_list
,
ligCaretList
);
DEFINE_
GET_HAS_ACCESSOR
(
LigCaretList
,
lig_caret_list
,
ligCaretList
);
DEFINE_
ACCESSOR
(
ClassDef
,
get_mark_attach_class_def
,
markAttachClassDef
);
DEFINE_
GET_HAS_ACCESSOR
(
ClassDef
,
mark_attachment_types
,
markAttachClassDef
);
/* Returns 0 if not found. */
inline
hb_ot_layout_class_t
get_glyph_class
(
hb_glyph_t
glyph_id
)
const
{
inline
hb_ot_layout_class_t
get_glyph_class
(
hb_ot_layout_glyph_t
glyph_id
)
const
{
return
get_glyph_classes
().
get_class
(
glyph_id
);
return
get_glyph_class_def
().
get_class
(
glyph_id
);
}
}
/* Returns 0 if not found. */
inline
hb_ot_layout_class_t
get_mark_attachment_type
(
hb_glyph_t
glyph_id
)
const
{
inline
hb_ot_layout_class_t
get_mark_attachment_type
(
hb_ot_layout_glyph_t
glyph_id
)
const
{
return
get_mark_attachment_types
().
get_class
(
glyph_id
);
return
get_mark_attach_class_def
().
get_class
(
glyph_id
);
}
}
/* TODO get_attach and get_lig_caret */
/* TODO get_attach and get_lig_caret */
...
...
src/hb-ot-layout-open-private.h
浏览文件 @
590d55cb
...
@@ -186,11 +186,16 @@
...
@@ -186,11 +186,16 @@
}
}
#define DEFINE_ACCESSOR(Type, name, Name) \
#define DEFINE_
GET_
ACCESSOR(Type, name, Name) \
inline const Type& name (void) const { \
inline const Type&
get_##
name (void) const { \
if (HB_UNLIKELY (!Name)) return Null##Type; \
if (HB_UNLIKELY (!Name)) return Null##Type; \
return *(const Type*)((const char*)this + Name); \
return *(const Type*)((const char*)this + Name); \
}
}
#define DEFINE_GET_HAS_ACCESSOR(Type, name, Name) \
DEFINE_GET_ACCESSOR (Type, name, Name); \
inline bool has_##name (void) const { \
return Name != 0; \
}
...
@@ -633,7 +638,7 @@ struct CoverageFormat1 {
...
@@ -633,7 +638,7 @@ struct CoverageFormat1 {
/* GlyphIDs, in sorted numerical order */
/* GlyphIDs, in sorted numerical order */
DEFINE_ARRAY_TYPE
(
GlyphID
,
glyphArray
,
glyphCount
);
DEFINE_ARRAY_TYPE
(
GlyphID
,
glyphArray
,
glyphCount
);
inline
hb_ot_layout_coverage_t
get_coverage
(
hb_
ot_layout_
glyph_t
glyph_id
)
const
{
inline
hb_ot_layout_coverage_t
get_coverage
(
hb_glyph_t
glyph_id
)
const
{
GlyphID
gid
;
GlyphID
gid
;
gid
=
glyph_id
;
gid
=
glyph_id
;
// TODO: bsearch
// TODO: bsearch
...
@@ -655,7 +660,7 @@ struct CoverageRangeRecord {
...
@@ -655,7 +660,7 @@ struct CoverageRangeRecord {
friend
struct
CoverageFormat2
;
friend
struct
CoverageFormat2
;
private:
private:
inline
hb_ot_layout_coverage_t
get_coverage
(
hb_
ot_layout_
glyph_t
glyph_id
)
const
{
inline
hb_ot_layout_coverage_t
get_coverage
(
hb_glyph_t
glyph_id
)
const
{
if
(
glyph_id
>=
start
&&
glyph_id
<=
end
)
if
(
glyph_id
>=
start
&&
glyph_id
<=
end
)
return
startCoverageIndex
+
(
glyph_id
-
start
);
return
startCoverageIndex
+
(
glyph_id
-
start
);
return
-
1
;
return
-
1
;
...
@@ -677,7 +682,7 @@ struct CoverageFormat2 {
...
@@ -677,7 +682,7 @@ struct CoverageFormat2 {
/* CoverageRangeRecords, in sorted numerical start order */
/* CoverageRangeRecords, in sorted numerical start order */
DEFINE_ARRAY_TYPE
(
CoverageRangeRecord
,
rangeRecord
,
rangeCount
);
DEFINE_ARRAY_TYPE
(
CoverageRangeRecord
,
rangeRecord
,
rangeCount
);
inline
hb_ot_layout_coverage_t
get_coverage
(
hb_
ot_layout_
glyph_t
glyph_id
)
const
{
inline
hb_ot_layout_coverage_t
get_coverage
(
hb_glyph_t
glyph_id
)
const
{
// TODO: bsearch
// TODO: bsearch
for
(
unsigned
int
i
=
0
;
i
<
rangeCount
;
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
rangeCount
;
i
++
)
{
int
coverage
=
rangeRecord
[
i
].
get_coverage
(
glyph_id
);
int
coverage
=
rangeRecord
[
i
].
get_coverage
(
glyph_id
);
...
@@ -707,7 +712,7 @@ struct Coverage {
...
@@ -707,7 +712,7 @@ struct Coverage {
}
}
}
}
hb_ot_layout_coverage_t
get_coverage
(
hb_
ot_layout_
glyph_t
glyph_id
)
const
{
hb_ot_layout_coverage_t
get_coverage
(
hb_glyph_t
glyph_id
)
const
{
switch
(
u
.
coverageFormat
)
{
switch
(
u
.
coverageFormat
)
{
case
1
:
return
u
.
format1
.
get_coverage
(
glyph_id
);
case
1
:
return
u
.
format1
.
get_coverage
(
glyph_id
);
case
2
:
return
u
.
format2
.
get_coverage
(
glyph_id
);
case
2
:
return
u
.
format2
.
get_coverage
(
glyph_id
);
...
@@ -736,7 +741,7 @@ struct ClassDefFormat1 {
...
@@ -736,7 +741,7 @@ struct ClassDefFormat1 {
/* GlyphIDs, in sorted numerical order */
/* GlyphIDs, in sorted numerical order */
DEFINE_ARRAY_TYPE
(
USHORT
,
classValueArray
,
glyphCount
);
DEFINE_ARRAY_TYPE
(
USHORT
,
classValueArray
,
glyphCount
);
inline
hb_ot_layout_class_t
get_class
(
hb_
ot_layout_
glyph_t
glyph_id
)
const
{
inline
hb_ot_layout_class_t
get_class
(
hb_glyph_t
glyph_id
)
const
{
if
(
glyph_id
>=
startGlyph
&&
glyph_id
-
startGlyph
<
glyphCount
)
if
(
glyph_id
>=
startGlyph
&&
glyph_id
-
startGlyph
<
glyphCount
)
return
classValueArray
[
glyph_id
-
startGlyph
];
return
classValueArray
[
glyph_id
-
startGlyph
];
return
0
;
return
0
;
...
@@ -755,7 +760,7 @@ struct ClassRangeRecord {
...
@@ -755,7 +760,7 @@ struct ClassRangeRecord {
friend
struct
ClassDefFormat2
;
friend
struct
ClassDefFormat2
;
private:
private:
inline
hb_ot_layout_class_t
get_class
(
hb_
ot_layout_
glyph_t
glyph_id
)
const
{
inline
hb_ot_layout_class_t
get_class
(
hb_glyph_t
glyph_id
)
const
{
if
(
glyph_id
>=
start
&&
glyph_id
<=
end
)
if
(
glyph_id
>=
start
&&
glyph_id
<=
end
)
return
classValue
;
return
classValue
;
return
0
;
return
0
;
...
@@ -776,7 +781,7 @@ struct ClassDefFormat2 {
...
@@ -776,7 +781,7 @@ struct ClassDefFormat2 {
/* ClassRangeRecords, in sorted numerical start order */
/* ClassRangeRecords, in sorted numerical start order */
DEFINE_ARRAY_TYPE
(
ClassRangeRecord
,
rangeRecord
,
rangeCount
);
DEFINE_ARRAY_TYPE
(
ClassRangeRecord
,
rangeRecord
,
rangeCount
);
inline
hb_ot_layout_class_t
get_class
(
hb_
ot_layout_
glyph_t
glyph_id
)
const
{
inline
hb_ot_layout_class_t
get_class
(
hb_glyph_t
glyph_id
)
const
{
// TODO: bsearch
// TODO: bsearch
for
(
int
i
=
0
;
i
<
rangeCount
;
i
++
)
{
for
(
int
i
=
0
;
i
<
rangeCount
;
i
++
)
{
int
classValue
=
rangeRecord
[
i
].
get_class
(
glyph_id
);
int
classValue
=
rangeRecord
[
i
].
get_class
(
glyph_id
);
...
@@ -805,7 +810,7 @@ struct ClassDef {
...
@@ -805,7 +810,7 @@ struct ClassDef {
}
}
}
}
inline
hb_ot_layout_class_t
get_class
(
hb_ot_layout
_glyph_t
glyph_id
)
const
{
hb_ot_layout_class_t
get_class
(
hb
_glyph_t
glyph_id
)
const
{
switch
(
u
.
classFormat
)
{
switch
(
u
.
classFormat
)
{
case
1
:
return
u
.
format1
.
get_class
(
glyph_id
);
case
1
:
return
u
.
format1
.
get_class
(
glyph_id
);
case
2
:
return
u
.
format2
.
get_class
(
glyph_id
);
case
2
:
return
u
.
format2
.
get_class
(
glyph_id
);
...
...
src/hb-ot-layout-private.h
浏览文件 @
590d55cb
...
@@ -38,28 +38,15 @@ typedef uint16_t hb_ot_layout_class_t;
...
@@ -38,28 +38,15 @@ typedef uint16_t hb_ot_layout_class_t;
typedef
uint16_t
hb_ot_layout_glyph_properties_t
;
typedef
uint16_t
hb_ot_layout_glyph_properties_t
;
typedef
int
hb_ot_layout_coverage_t
;
/* -1 is not covered, >= 0 otherwise */
typedef
int
hb_ot_layout_coverage_t
;
/* -1 is not covered, >= 0 otherwise */
struct
GDEF
;
struct
GSUB
;
struct
GPOS
;
struct
_HB_OT_Layout
{
const
GDEF
*
gdef
;
const
GSUB
*
gsub
;
const
GPOS
*
gpos
;
struct
{
uint8_t
*
klasses
;
unsigned
int
len
;
}
new_gdef
;
};
HB_BEGIN_DECLS
();
HB_BEGIN_DECLS
();
static
hb_ot_layout_glyph_properties_t
static
hb_ot_layout_glyph_properties_t
_hb_ot_layout_get_glyph_properties
(
HB_OT_Layout
*
layout
,
_hb_ot_layout_get_glyph_properties
(
HB_OT_Layout
*
layout
,
hb_ot_layout_glyph_t
glyph
);
hb_glyph_t
glyph
);
static
hb_bool_t
_hb_ot_layout_has_new_glyph_classes
(
HB_OT_Layout
*
layout
);
HB_END_DECLS
();
HB_END_DECLS
();
...
...
src/hb-ot-layout.cc
浏览文件 @
590d55cb
...
@@ -37,6 +37,18 @@
...
@@ -37,6 +37,18 @@
#include <string.h>
#include <string.h>
struct
_HB_OT_Layout
{
const
GDEF
*
gdef
;
const
GSUB
*
gsub
;
//const GPOS *gpos;
struct
{
unsigned
char
*
klasses
;
unsigned
int
len
;
}
new_gdef
;
};
HB_OT_Layout
*
HB_OT_Layout
*
hb_ot_layout_create
(
const
char
*
font_data
,
hb_ot_layout_create
(
const
char
*
font_data
,
int
face_index
)
int
face_index
)
...
@@ -59,9 +71,25 @@ hb_ot_layout_destroy (HB_OT_Layout *layout)
...
@@ -59,9 +71,25 @@ hb_ot_layout_destroy (HB_OT_Layout *layout)
free
(
layout
);
free
(
layout
);
}
}
/*
* GDEF
*/
hb_bool_t
hb_ot_layout_has_font_glyph_classes
(
HB_OT_Layout
*
layout
)
{
return
layout
->
gdef
->
has_glyph_classes
();
}
static
hb_bool_t
_hb_ot_layout_has_new_glyph_classes
(
HB_OT_Layout
*
layout
)
{
return
layout
->
new_gdef
.
len
>
0
;
}
static
hb_ot_layout_glyph_properties_t
static
hb_ot_layout_glyph_properties_t
_hb_ot_layout_get_glyph_properties
(
HB_OT_Layout
*
layout
,
_hb_ot_layout_get_glyph_properties
(
HB_OT_Layout
*
layout
,
hb_
ot_layout_glyph_t
glyph
)
hb_
glyph_t
glyph
)
{
{
hb_ot_layout_class_t
klass
;
hb_ot_layout_class_t
klass
;
...
@@ -86,9 +114,68 @@ _hb_ot_layout_get_glyph_properties (HB_OT_Layout *layout,
...
@@ -86,9 +114,68 @@ _hb_ot_layout_get_glyph_properties (HB_OT_Layout *layout,
}
}
}
}
#if 0
static bool
_hb_ot_layout_check_glyph_properties (HB_OT_Layout *layout,
HB_GlyphItem gitem,
HB_UShort flags,
HB_UShort* property)
{
HB_Error error;
if ( gdef )
{
HB_UShort basic_glyph_class;
HB_UShort desired_attachment_class;
if ( gitem->gproperties == HB_GLYPH_PROPERTIES_UNKNOWN )
{
error = HB_GDEF_Get_Glyph_Property( gdef, gitem->gindex, &gitem->gproperties );
if ( error )
return error;
}
*property = gitem->gproperties;
/* If the glyph was found in the MarkAttachmentClass table,
* then that class value is the high byte of the result,
* otherwise the low byte contains the basic type of the glyph
* as defined by the GlyphClassDef table.
*/
if ( *property & HB_LOOKUP_FLAG_IGNORE_SPECIAL_MARKS )
basic_glyph_class = HB_GDEF_MARK;
else
basic_glyph_class = *property;
/* Return Not_Covered, if, for example, basic_glyph_class
* is HB_GDEF_LIGATURE and LookFlags includes HB_LOOKUP_FLAG_IGNORE_LIGATURES
*/
if ( flags & basic_glyph_class )
return HB_Err_Not_Covered;
/* The high byte of LookupFlags has the meaning
* "ignore marks of attachment type different than
* the attachment type specified."
*/
desired_attachment_class = flags & HB_LOOKUP_FLAG_IGNORE_SPECIAL_MARKS;
if ( desired_attachment_class )
{
if ( basic_glyph_class == HB_GDEF_MARK &&
*property != desired_attachment_class )
return HB_Err_Not_Covered;
}
} else {
*property = 0;
}
return HB_Err_Ok;
}
#endif
hb_ot_layout_glyph_class_t
hb_ot_layout_glyph_class_t
hb_ot_layout_get_glyph_class
(
HB_OT_Layout
*
layout
,
hb_ot_layout_get_glyph_class
(
HB_OT_Layout
*
layout
,
hb_
ot_layout_glyph_t
glyph
)
hb_
glyph_t
glyph
)
{
{
hb_ot_layout_glyph_properties_t
properties
;
hb_ot_layout_glyph_properties_t
properties
;
hb_ot_layout_class_t
klass
;
hb_ot_layout_class_t
klass
;
...
@@ -103,23 +190,22 @@ hb_ot_layout_get_glyph_class (HB_OT_Layout *layout,
...
@@ -103,23 +190,22 @@ hb_ot_layout_get_glyph_class (HB_OT_Layout *layout,
void
void
hb_ot_layout_set_glyph_class
(
HB_OT_Layout
*
layout
,
hb_ot_layout_set_glyph_class
(
HB_OT_Layout
*
layout
,
hb_
ot_layout_glyph_t
glyph
,
hb_
glyph_t
glyph
,
hb_ot_layout_glyph_class_t
klass
)
hb_ot_layout_glyph_class_t
klass
)
{
{
/* TODO optimize this, similar to old harfbuzz code for example */
/* TODO optimize this, similar to old harfbuzz code for example */
/* TODO our semantics are a bit different from old harfbuzz code too */
hb_ot_layout_class_t
gdef_klass
;
hb_ot_layout_class_t
gdef_klass
;
int
len
=
layout
->
new_gdef
.
len
;
int
len
=
layout
->
new_gdef
.
len
;
if
(
glyph
>=
len
)
{
if
(
glyph
>=
len
)
{
int
new_len
;
int
new_len
;
u
int8_t
*
new_klasses
;
u
nsigned
char
*
new_klasses
;
new_len
=
len
==
0
?
120
:
2
*
len
;
new_len
=
len
==
0
?
120
:
2
*
len
;
if
(
new_len
>
65535
)
if
(
new_len
>
65535
)
new_len
=
65535
;
new_len
=
65535
;
new_klasses
=
(
u
int8_t
*
)
realloc
(
layout
->
new_gdef
.
klasses
,
new_len
*
sizeof
(
uint8_t
));
new_klasses
=
(
u
nsigned
char
*
)
realloc
(
layout
->
new_gdef
.
klasses
,
new_len
*
sizeof
(
unsigned
char
));
if
(
G_UNLIKELY
(
!
new_klasses
))
if
(
G_UNLIKELY
(
!
new_klasses
))
return
;
return
;
...
@@ -142,3 +228,24 @@ hb_ot_layout_set_glyph_class (HB_OT_Layout *layout,
...
@@ -142,3 +228,24 @@ hb_ot_layout_set_glyph_class (HB_OT_Layout *layout,
layout
->
new_gdef
.
klasses
[
glyph
]
=
gdef_klass
;
layout
->
new_gdef
.
klasses
[
glyph
]
=
gdef_klass
;
return
;
return
;
}
}
void
hb_ot_layout_build_glyph_classes
(
HB_OT_Layout
*
layout
,
uint16_t
num_total_glyphs
,
hb_glyph_t
*
glyphs
,
unsigned
char
*
klasses
,
uint16_t
count
)
{
int
i
;
if
(
G_UNLIKELY
(
!
count
||
!
glyphs
||
!
klasses
))
return
;
if
(
layout
->
new_gdef
.
len
==
0
)
{
layout
->
new_gdef
.
klasses
=
(
unsigned
char
*
)
calloc
(
num_total_glyphs
,
sizeof
(
unsigned
char
));
layout
->
new_gdef
.
len
=
count
;
}
for
(
i
=
0
;
i
<
count
;
i
++
)
hb_ot_layout_set_glyph_class
(
layout
,
glyphs
[
i
],
(
hb_ot_layout_glyph_class_t
)
klasses
[
i
]);
}
src/hb-ot-layout.h
浏览文件 @
590d55cb
...
@@ -31,13 +31,6 @@
...
@@ -31,13 +31,6 @@
HB_BEGIN_DECLS
();
HB_BEGIN_DECLS
();
typedef
uint32_t
hb_tag_t
;
#define HB_TAG(a,b,c,d) ((hb_tag_t)(((uint8_t)a<<24)|((uint8_t)b<<16)|((uint8_t)c<<8)|(uint8_t)d))
#define HB_TAG_STR(s) (HB_TAG(((const char *) s)[0], \
((const char *) s)[1], \
((const char *) s)[2], \
((const char *) s)[3]))
typedef
enum
{
typedef
enum
{
HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED
=
0x0000
,
HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED
=
0x0000
,
HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH
=
0x0002
,
HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH
=
0x0002
,
...
@@ -46,8 +39,6 @@ typedef enum {
...
@@ -46,8 +39,6 @@ typedef enum {
HB_OT_LAYOUT_GLYPH_CLASS_COMPONENT
=
0x0010
HB_OT_LAYOUT_GLYPH_CLASS_COMPONENT
=
0x0010
}
hb_ot_layout_glyph_class_t
;
}
hb_ot_layout_glyph_class_t
;
typedef
uint16_t
hb_ot_layout_glyph_t
;
/*
/*
* HB_OT_Layout
* HB_OT_Layout
*/
*/
...
@@ -67,15 +58,29 @@ hb_ot_layout_create_sanitize (char *data,
...
@@ -67,15 +58,29 @@ hb_ot_layout_create_sanitize (char *data,
make_writable_func);
make_writable_func);
*/
*/
/*
* GDEF
*/
hb_bool_t
hb_ot_layout_has_font_glyph_classes
(
HB_OT_Layout
*
layout
);
hb_ot_layout_glyph_class_t
hb_ot_layout_glyph_class_t
hb_ot_layout_get_glyph_class
(
HB_OT_Layout
*
layout
,
hb_ot_layout_get_glyph_class
(
HB_OT_Layout
*
layout
,
hb_
ot_layout_glyph_t
glyph
);
hb_
glyph_t
glyph
);
void
void
hb_ot_layout_set_glyph_class
(
HB_OT_Layout
*
layout
,
hb_ot_layout_set_glyph_class
(
HB_OT_Layout
*
layout
,
hb_
ot_layout_glyph_t
glyph
,
hb_
glyph_t
glyph
,
hb_ot_layout_glyph_class_t
klass
);
hb_ot_layout_glyph_class_t
klass
);
void
hb_ot_layout_build_glyph_classes
(
HB_OT_Layout
*
layout
,
uint16_t
num_total_glyphs
,
hb_glyph_t
*
glyphs
,
unsigned
char
*
klasses
,
uint16_t
count
);
HB_END_DECLS
();
HB_END_DECLS
();
#endif
/* HB_OT_LAYOUT_H */
#endif
/* HB_OT_LAYOUT_H */
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录