Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
aff831ed
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看板
提交
aff831ed
编写于
1月 24, 2008
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Implement glyph properties
上级
ead428d7
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
117 addition
and
18 deletion
+117
-18
src/hb-ot-layout-gdef-private.h
src/hb-ot-layout-gdef-private.h
+8
-2
src/hb-ot-layout-private.h
src/hb-ot-layout-private.h
+14
-2
src/hb-ot-layout.cc
src/hb-ot-layout.cc
+77
-7
src/hb-ot-layout.h
src/hb-ot-layout.h
+18
-7
未找到文件。
src/hb-ot-layout-gdef-private.h
浏览文件 @
aff831ed
...
...
@@ -231,6 +231,12 @@ DEFINE_NULL_ASSERT_SIZE (LigCaretList, 4);
struct
GDEF
{
static
const
hb_tag_t
Tag
=
HB_TAG
(
'G'
,
'D'
,
'E'
,
'F'
);
static
const
hb_ot_layout_class_t
UnclassifiedGlyph
=
0
;
static
const
hb_ot_layout_class_t
BaseGlyph
=
1
;
static
const
hb_ot_layout_class_t
LigatureGlyph
=
2
;
static
const
hb_ot_layout_class_t
MarkGlyph
=
3
;
static
const
hb_ot_layout_class_t
ComponentGlyph
=
4
;
STATIC_DEFINE_GET_FOR_DATA
(
GDEF
);
/* XXX check version here? */
...
...
@@ -240,12 +246,12 @@ struct GDEF {
DEFINE_ACCESSOR
(
ClassDef
,
get_mark_attach_class_def
,
markAttachClassDef
);
/* Returns 0 if not found. */
inline
in
t
get_glyph_class
(
hb_ot_layout_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_class_def
().
get_class
(
glyph_id
);
}
/* Returns 0 if not found. */
inline
in
t
get_mark_attachment_type
(
hb_ot_layout_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_attach_class_def
().
get_class
(
glyph_id
);
}
...
...
src/hb-ot-layout-private.h
浏览文件 @
aff831ed
...
...
@@ -35,20 +35,32 @@
#include "hb-ot-layout.h"
typedef
uint16_t
hb_ot_layout_class_t
;
typedef
uint16_t
hb_ot_layout_glyph_properties_t
;
typedef
int
hb_ot_layout_coverage_t
;
/* -1 is not covered, >= 0 otherwise */
struct
GDEF
;
struct
GSUB
;
struct
GPOS
;
HB_BEGIN_DECLS
();
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
();
static
hb_ot_layout_glyph_properties_t
_hb_ot_layout_get_glyph_properties
(
HB_OT_Layout
*
layout
,
hb_ot_layout_glyph_t
glyph
);
HB_END_DECLS
();
#endif
/* HB_OT_LAYOUT_PRIVATE_H */
src/hb-ot-layout.cc
浏览文件 @
aff831ed
...
...
@@ -34,6 +34,8 @@
#include "hb-ot-layout-gsub-private.h"
#include <stdlib.h>
#include <string.h>
HB_OT_Layout
*
hb_ot_layout_create
(
const
char
*
font_data
,
...
...
@@ -57,18 +59,86 @@ hb_ot_layout_destroy (HB_OT_Layout *layout)
free
(
layout
);
}
hb_ot_layout_glyph_properties_t
hb_ot_layout_get_glyph_properties
(
HB_OT_Layout
*
layout
,
hb_ot_layout_glyph_t
glyph
)
static
hb_ot_layout_glyph_properties_t
_hb_ot_layout_get_glyph_properties
(
HB_OT_Layout
*
layout
,
hb_ot_layout_glyph_t
glyph
)
{
hb_ot_layout_class_t
klass
;
/* TODO old harfbuzz doesn't always parse mark attachments as it says it was
* introduced without a version bump, so it may not be safe */
klass
=
layout
->
gdef
->
get_mark_attachment_type
(
glyph
);
if
(
klass
)
return
klass
<<
8
;
klass
=
layout
->
gdef
->
get_glyph_class
(
glyph
);
if
(
!
klass
&&
glyph
<
layout
->
new_gdef
.
len
)
klass
=
layout
->
new_gdef
.
klasses
[
glyph
];
switch
(
klass
)
{
default:
case
GDEF
::
UnclassifiedGlyph
:
return
HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED
;
case
GDEF
::
BaseGlyph
:
return
HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH
;
case
GDEF
::
LigatureGlyph
:
return
HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE
;
case
GDEF
::
MarkGlyph
:
return
HB_OT_LAYOUT_GLYPH_CLASS_MARK
;
case
GDEF
::
ComponentGlyph
:
return
HB_OT_LAYOUT_GLYPH_CLASS_COMPONENT
;
}
}
void
hb_ot_layout_set_glyph_properties
(
HB_OT_Layout
*
layout
,
hb_ot_layout_glyph_t
glyph
,
hb_ot_layout_glyph_properties_t
properties
)
hb_ot_layout_glyph_class_t
hb_ot_layout_get_glyph_class
(
HB_OT_Layout
*
layout
,
hb_ot_layout_glyph_t
glyph
)
{
hb_ot_layout_glyph_properties_t
properties
;
hb_ot_layout_class_t
klass
;
properties
=
_hb_ot_layout_get_glyph_properties
(
layout
,
glyph
);
if
(
properties
&
0xFF
)
return
HB_OT_LAYOUT_GLYPH_CLASS_MARK
;
return
(
hb_ot_layout_glyph_class_t
)
properties
;
}
void
hb_ot_layout_set_glyph_class
(
HB_OT_Layout
*
layout
,
hb_ot_layout_glyph_t
glyph
,
hb_ot_layout_glyph_class_t
klass
)
{
/* 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
;
int
len
=
layout
->
new_gdef
.
len
;
if
(
glyph
>=
len
)
{
int
new_len
;
uint8_t
*
new_klasses
;
new_len
=
len
==
0
?
120
:
2
*
len
;
if
(
new_len
>
65535
)
new_len
=
65535
;
new_klasses
=
(
uint8_t
*
)
realloc
(
layout
->
new_gdef
.
klasses
,
new_len
*
sizeof
(
uint8_t
));
if
(
G_UNLIKELY
(
!
new_klasses
))
return
;
memset
(
new_klasses
+
len
,
0
,
new_len
-
len
);
layout
->
new_gdef
.
klasses
=
new_klasses
;
layout
->
new_gdef
.
len
=
new_len
;
}
switch
(
klass
)
{
default:
case
HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED
:
gdef_klass
=
GDEF
::
UnclassifiedGlyph
;
break
;
case
HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH
:
gdef_klass
=
GDEF
::
BaseGlyph
;
break
;
case
HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE
:
gdef_klass
=
GDEF
::
LigatureGlyph
;
break
;
case
HB_OT_LAYOUT_GLYPH_CLASS_MARK
:
gdef_klass
=
GDEF
::
MarkGlyph
;
break
;
case
HB_OT_LAYOUT_GLYPH_CLASS_COMPONENT
:
gdef_klass
=
GDEF
::
ComponentGlyph
;
break
;
}
layout
->
new_gdef
.
klasses
[
glyph
]
=
gdef_klass
;
return
;
}
src/hb-ot-layout.h
浏览文件 @
aff831ed
...
...
@@ -38,9 +38,20 @@ typedef uint32_t hb_tag_t;
((const char *) s)[2], \
((const char *) s)[3]))
typedef
uint16_t
hb_ot_layout_glyph_properties_t
;
typedef
enum
{
HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED
=
0x0000
,
HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH
=
0x0002
,
HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE
=
0x0004
,
HB_OT_LAYOUT_GLYPH_CLASS_MARK
=
0x0008
,
HB_OT_LAYOUT_GLYPH_CLASS_COMPONENT
=
0x0010
}
hb_ot_layout_glyph_class_t
;
typedef
uint16_t
hb_ot_layout_glyph_t
;
/*
* HB_OT_Layout
*/
typedef
struct
_HB_OT_Layout
HB_OT_Layout
;
HB_OT_Layout
*
...
...
@@ -56,14 +67,14 @@ hb_ot_layout_create_sanitize (char *data,
make_writable_func);
*/
hb_ot_layout_glyph_
propertie
s_t
hb_ot_layout_get_glyph_
properties
(
HB_OT_Layout
*
layout
,
hb_ot_layout_glyph_t
glyph
);
hb_ot_layout_glyph_
clas
s_t
hb_ot_layout_get_glyph_
class
(
HB_OT_Layout
*
layout
,
hb_ot_layout_glyph_t
glyph
);
void
hb_ot_layout_set_glyph_
properties
(
HB_OT_Layout
*
layout
,
hb_ot_layout_glyph_t
glyph
,
hb_ot_layout_glyph_properties_t
propertie
s
);
hb_ot_layout_set_glyph_
class
(
HB_OT_Layout
*
layout
,
hb_ot_layout_glyph_t
glyph
,
hb_ot_layout_glyph_class_t
klas
s
);
HB_END_DECLS
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录