Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
8a8cfad9
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,发现更多精彩内容 >>
提交
8a8cfad9
编写于
9月 26, 2016
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[MATH] Cleanup previous commit a bit
上级
d7182d12
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
113 addition
and
117 deletion
+113
-117
src/hb-ot-layout-math-table.hh
src/hb-ot-layout-math-table.hh
+93
-93
src/hb-ot-layout.cc
src/hb-ot-layout.cc
+13
-17
src/hb-ot-layout.h
src/hb-ot-layout.h
+7
-7
未找到文件。
src/hb-ot-layout-math-table.hh
浏览文件 @
8a8cfad9
...
...
@@ -48,10 +48,10 @@ struct MathValueRecord
}
protected:
SHORT
value
;
/* The X or Y value in design units */
OffsetTo
<
Device
>
deviceTable
;
/* Offset to the device table - from the
beginning of parent table. May be NULL.
Suggested format for device table is 1. */
SHORT
value
;
/* The X or Y value in design units */
OffsetTo
<
Device
>
deviceTable
;
/* Offset to the device table - from the
*
beginning of parent table. May be NULL.
*
Suggested format for device table is 1. */
public:
DEFINE_SIZE_STATIC
(
4
);
...
...
@@ -62,9 +62,12 @@ struct MathConstants
inline
bool
sanitize_math_value_records
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
unsigned
int
count
=
ARRAY_LENGTH
(
mathValueRecords
);
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
if
(
!
mathValueRecords
[
i
].
sanitize
(
c
,
this
))
return_trace
(
false
);
if
(
!
mathValueRecords
[
i
].
sanitize
(
c
,
this
))
return_trace
(
false
);
return_trace
(
true
);
}
...
...
@@ -165,12 +168,12 @@ struct MathItalicsCorrectionInfo
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_struct
(
this
)
&&
coverage
.
sanitize
(
c
,
this
)
&&
italicsCorrection
.
sanitize
(
c
,
this
));
coverage
.
sanitize
(
c
,
this
)
&&
italicsCorrection
.
sanitize
(
c
,
this
));
}
inline
bool
get_value
(
hb_font_t
*
font
,
hb_codepoint_t
glyph
,
hb_position_t
&
value
)
const
hb_position_t
&
value
)
const
{
unsigned
int
index
=
(
this
+
coverage
).
get_coverage
(
glyph
);
if
(
likely
(
index
==
NOT_COVERED
))
return
false
;
...
...
@@ -180,17 +183,17 @@ struct MathItalicsCorrectionInfo
}
protected:
OffsetTo
<
Coverage
>
coverage
;
/* Offset to Coverage table -
from the beginning of
MathItalicsCorrectionInfo
table. */
ArrayOf
<
MathValueRecord
>
italicsCorrection
;
/* Array of MathValueRecords
defining italics correction
values for each
covered glyph. */
OffsetTo
<
Coverage
>
coverage
;
/* Offset to Coverage table -
*
from the beginning of
*
MathItalicsCorrectionInfo
*
table. */
ArrayOf
<
MathValueRecord
>
italicsCorrection
;
/* Array of MathValueRecords
*
defining italics correction
*
values for each
*
covered glyph. */
public:
DEFINE_SIZE_ARRAY
(
2
+
2
,
italicsCorrection
);
DEFINE_SIZE_ARRAY
(
4
,
italicsCorrection
);
};
struct
MathTopAccentAttachment
...
...
@@ -199,12 +202,12 @@ struct MathTopAccentAttachment
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_struct
(
this
)
&&
topAccentCoverage
.
sanitize
(
c
,
this
)
&&
topAccentAttachment
.
sanitize
(
c
,
this
));
topAccentCoverage
.
sanitize
(
c
,
this
)
&&
topAccentAttachment
.
sanitize
(
c
,
this
));
}
inline
bool
get_value
(
hb_font_t
*
font
,
hb_codepoint_t
glyph
,
hb_position_t
&
value
)
const
hb_position_t
&
value
)
const
{
unsigned
int
index
=
(
this
+
topAccentCoverage
).
get_coverage
(
glyph
);
if
(
likely
(
index
==
NOT_COVERED
))
return
false
;
...
...
@@ -215,13 +218,13 @@ struct MathTopAccentAttachment
protected:
OffsetTo
<
Coverage
>
topAccentCoverage
;
/* Offset to Coverage table -
from the beginning of
MathTopAccentAttachment
table. */
*
from the beginning of
*
MathTopAccentAttachment
*
table. */
ArrayOf
<
MathValueRecord
>
topAccentAttachment
;
/* Array of MathValueRecords
defining top accent
attachment points for each
covered glyph. */
*
defining top accent
*
attachment points for each
*
covered glyph. */
public:
DEFINE_SIZE_ARRAY
(
2
+
2
,
topAccentAttachment
);
...
...
@@ -242,14 +245,14 @@ struct MathKern
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_struct
(
this
)
&&
c
->
check_array
(
mathValueRecords
,
mathValueRecords
[
0
].
static_size
,
2
*
heightCount
+
1
)
&&
sanitize_math_value_records
(
c
));
c
->
check_array
(
mathValueRecords
,
mathValueRecords
[
0
].
static_size
,
2
*
heightCount
+
1
)
&&
sanitize_math_value_records
(
c
));
}
inline
hb_position_t
get_value
(
hb_font_t
*
font
,
hb_position_t
&
correction_height
)
const
hb_position_t
&
correction_height
)
const
{
const
MathValueRecord
*
correctionHeight
=
mathValueRecords
;
const
MathValueRecord
*
kernValue
=
mathValueRecords
+
heightCount
;
...
...
@@ -265,12 +268,12 @@ struct MathKern
while
(
count
>
0
)
{
unsigned
int
half
=
count
/
2
;
hb_position_t
height
=
correctionHeight
[
i
+
half
].
get_y_value
(
font
,
this
);
correctionHeight
[
i
+
half
].
get_y_value
(
font
,
this
);
if
(
height
<
correction_height
)
{
i
+=
half
+
1
;
count
-=
half
+
1
;
i
+=
half
+
1
;
count
-=
half
+
1
;
}
else
count
=
half
;
count
=
half
;
}
return
kernValue
[
i
].
get_x_value
(
font
,
this
);
}
...
...
@@ -278,11 +281,11 @@ struct MathKern
protected:
USHORT
heightCount
;
MathValueRecord
mathValueRecords
[
VAR
];
/* Array of correction heights at
which the kern value changes.
Sorted by the height value in
design units. */
/* Array of kern values corresponding
to heights. */
*
which the kern value changes.
*
Sorted by the height value in
*
design units. */
/* Array of kern values corresponding
*
to heights. */
public:
DEFINE_SIZE_ARRAY
(
2
,
mathValueRecords
);
...
...
@@ -293,30 +296,30 @@ struct MathKernInfoRecord
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
,
const
void
*
base
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_struct
(
this
)
&&
mathKern
[
HB_OT_MATH_KERN_TOP_RIGHT
].
sanitize
(
c
,
base
)
&&
mathKern
[
HB_OT_MATH_KERN_TOP_LEFT
].
sanitize
(
c
,
base
)
&&
mathKern
[
HB_OT_MATH_KERN_BOTTOM_RIGHT
].
sanitize
(
c
,
base
)
&&
mathKern
[
HB_OT_MATH_KERN_BOTTOM_LEFT
].
sanitize
(
c
,
base
));
}
inline
bool
has_math_kern
(
hb_ot_math_kern_t
kern
)
const
{
return
mathKern
[
kern
]
!=
0
;
unsigned
int
count
=
ARRAY_LENGTH
(
mathKern
);
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
if
(
unlikely
(
!
mathKern
[
i
].
sanitize
(
c
,
base
)))
return_trace
(
false
);
return_trace
(
true
);
}
inline
const
MathKern
&
get_math_kern
(
hb_ot_math_kern_t
kern
,
const
void
*
base
)
const
{
return
base
+
mathKern
[
kern
];
const
void
*
base
)
const
{
unsigned
int
idx
=
kern
;
if
(
unlikely
(
idx
>
ARRAY_LENGTH
(
mathKern
)))
return
Null
(
MathKern
);
return
base
+
mathKern
[
idx
];
}
protected:
/* Offset to MathKern table for each corner -
from the beginning of MathKernInfo table. May be NULL. */
OffsetTo
<
MathKern
>
mathKern
[
HB_OT_MATH_KERN_BOTTOM_LEFT
-
HB_OT_MATH_KERN_TOP_RIGHT
+
1
];
* from the beginning of MathKernInfo table. May be NULL. */
OffsetTo
<
MathKern
>
mathKern
[
4
];
public:
DEFINE_SIZE_STATIC
(
2
*
(
HB_OT_MATH_KERN_BOTTOM_LEFT
-
HB_OT_MATH_KERN_TOP_RIGHT
+
1
));
DEFINE_SIZE_STATIC
(
8
);
};
struct
MathKernInfo
...
...
@@ -325,34 +328,30 @@ struct MathKernInfo
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_struct
(
this
)
&&
mathKernCoverage
.
sanitize
(
c
,
this
)
&&
mathKernInfoRecords
.
sanitize
(
c
,
this
));
mathKernCoverage
.
sanitize
(
c
,
this
)
&&
mathKernInfoRecords
.
sanitize
(
c
,
this
));
}
inline
bool
get_math_kern_info_record
(
hb_codepoint_t
glyph
,
const
MathKernInfoRecord
*&
record
)
const
inline
const
MathKernInfoRecord
&
get_math_kern_info_record
(
hb_codepoint_t
glyph
)
const
{
unsigned
int
index
=
(
this
+
mathKernCoverage
).
get_coverage
(
glyph
);
if
(
likely
(
index
==
NOT_COVERED
))
return
false
;
if
(
unlikely
(
index
>=
mathKernInfoRecords
.
len
))
return
false
;
record
=
&
mathKernInfoRecords
[
index
];
return
true
;
return
mathKernInfoRecords
[
index
];
}
protected:
OffsetTo
<
Coverage
>
mathKernCoverage
;
/* Offset to Coverage table -
from the beginning of the
MathKernInfo table. */
ArrayOf
<
MathKernInfoRecord
>
mathKernInfoRecords
;
/* Array of
MathKernInfoRecords,
per-glyph information for
mathematical positioning
of subscripts and
superscripts. */
OffsetTo
<
Coverage
>
mathKernCoverage
;
/* Offset to Coverage table -
*
from the beginning of the
*
MathKernInfo table. */
ArrayOf
<
MathKernInfoRecord
>
mathKernInfoRecords
;
/* Array of
*
MathKernInfoRecords,
*
per-glyph information for
*
mathematical positioning
*
of subscripts and
*
superscripts. */
public:
DEFINE_SIZE_ARRAY
(
2
+
2
,
mathKernInfoRecords
);
DEFINE_SIZE_ARRAY
(
4
,
mathKernInfoRecords
);
};
struct
MathGlyphInfo
...
...
@@ -361,10 +360,10 @@ struct MathGlyphInfo
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_struct
(
this
)
&&
mathItalicsCorrectionInfo
.
sanitize
(
c
,
this
)
&&
mathTopAccentAttachment
.
sanitize
(
c
,
this
)
&&
extendedShapeCoverage
.
sanitize
(
c
,
this
)
&&
mathKernInfo
.
sanitize
(
c
,
this
));
mathItalicsCorrectionInfo
.
sanitize
(
c
,
this
)
&&
mathTopAccentAttachment
.
sanitize
(
c
,
this
)
&&
extendedShapeCoverage
.
sanitize
(
c
,
this
)
&&
mathKernInfo
.
sanitize
(
c
,
this
));
}
inline
bool
has_math_italics_correction_info
(
void
)
const
{
...
...
@@ -398,28 +397,29 @@ struct MathGlyphInfo
protected:
/* Offset to MathItalicsCorrectionInfo table -
from the beginning of MathGlyphInfo table. */
*
from the beginning of MathGlyphInfo table. */
OffsetTo
<
MathItalicsCorrectionInfo
>
mathItalicsCorrectionInfo
;
/* Offset to MathTopAccentAttachment table -
from the beginning of MathGlyphInfo table. */
*
from the beginning of MathGlyphInfo table. */
OffsetTo
<
MathTopAccentAttachment
>
mathTopAccentAttachment
;
/* Offset to coverage table for Extended Shape glyphs -
from the beginning of MathGlyphInfo table. When the left or right glyph of
a box is an extended shape variant, the (ink) box (and not the default
position defined by values in MathConstants table) should be used for
vertical positioning purposes. May be NULL.. */
*
from the beginning of MathGlyphInfo table. When the left or right glyph of
*
a box is an extended shape variant, the (ink) box (and not the default
*
position defined by values in MathConstants table) should be used for
*
vertical positioning purposes. May be NULL.. */
OffsetTo
<
Coverage
>
extendedShapeCoverage
;
/* Offset to MathKernInfo table -
from the beginning of MathGlyphInfo table. */
*
from the beginning of MathGlyphInfo table. */
OffsetTo
<
MathKernInfo
>
mathKernInfo
;
public:
DEFINE_SIZE_STATIC
(
4
*
2
);
DEFINE_SIZE_STATIC
(
8
);
};
/*
* MATH -- The MATH Table
*/
...
...
@@ -432,9 +432,9 @@ struct MATH
{
TRACE_SANITIZE
(
this
);
return_trace
(
version
.
sanitize
(
c
)
&&
likely
(
version
.
major
==
1
)
&&
mathConstants
.
sanitize
(
c
,
this
)
&&
mathGlyphInfo
.
sanitize
(
c
,
this
));
likely
(
version
.
major
==
1
)
&&
mathConstants
.
sanitize
(
c
,
this
)
&&
mathGlyphInfo
.
sanitize
(
c
,
this
));
}
inline
bool
has_math_constants
(
void
)
const
{
return
mathConstants
!=
0
;
}
...
...
@@ -447,10 +447,10 @@ struct MATH
return
this
+
mathGlyphInfo
;
}
protected:
FixedVersion
<>
version
;
/* Version of the MATH table
* initially set to 0x00010000u */
OffsetTo
<
MathConstants
>
mathConstants
;
/* MathConstants table */
OffsetTo
<
MathGlyphInfo
>
mathGlyphInfo
;
/* MathGlyphInfo table */
FixedVersion
<>
version
;
/* Version of the MATH table
* initially set to 0x00010000u */
OffsetTo
<
MathConstants
>
mathConstants
;
/* MathConstants table */
OffsetTo
<
MathGlyphInfo
>
mathGlyphInfo
;
/* MathGlyphInfo table */
public:
DEFINE_SIZE_STATIC
(
8
);
...
...
src/hb-ot-layout.cc
浏览文件 @
8a8cfad9
...
...
@@ -1263,7 +1263,7 @@ hb_ot_layout_has_math_data (hb_face_t *face)
**/
hb_position_t
hb_ot_layout_get_math_constant
(
hb_font_t
*
font
,
hb_ot_math_constant_t
constant
)
hb_ot_math_constant_t
constant
)
{
const
OT
::
MATH
&
math
=
_get_math
(
font
->
face
);
return
math
.
has_math_constants
()
?
...
...
@@ -1282,7 +1282,7 @@ hb_ot_layout_get_math_constant (hb_font_t *font,
**/
HB_EXTERN
hb_position_t
hb_ot_layout_get_math_italic_correction
(
hb_font_t
*
font
,
hb_codepoint_t
glyph
)
hb_codepoint_t
glyph
)
{
const
OT
::
MATH
&
math
=
_get_math
(
font
->
face
);
if
(
math
.
has_math_glyph_info
())
{
...
...
@@ -1290,8 +1290,8 @@ hb_ot_layout_get_math_italic_correction (hb_font_t *font,
if
(
glyphInfo
.
has_math_italics_correction_info
())
{
hb_position_t
value
;
if
(
glyphInfo
.
get_math_italics_correction_info
().
get_value
(
font
,
glyph
,
value
))
return
value
;
value
))
return
value
;
}
}
return
0
;
...
...
@@ -1309,7 +1309,7 @@ hb_ot_layout_get_math_italic_correction (hb_font_t *font,
**/
HB_EXTERN
hb_position_t
hb_ot_layout_get_math_top_accent_attachment
(
hb_font_t
*
font
,
hb_codepoint_t
glyph
)
hb_codepoint_t
glyph
)
{
const
OT
::
MATH
&
math
=
_get_math
(
font
->
face
);
if
(
math
.
has_math_glyph_info
())
{
...
...
@@ -1317,8 +1317,8 @@ hb_ot_layout_get_math_top_accent_attachment (hb_font_t *font,
if
(
glyphInfo
.
has_math_top_accent_attachment
())
{
hb_position_t
value
;
if
(
glyphInfo
.
get_math_top_accent_attachment
().
get_value
(
font
,
glyph
,
value
))
return
value
;
value
))
return
value
;
}
}
return
0
;
...
...
@@ -1336,7 +1336,7 @@ hb_ot_layout_get_math_top_accent_attachment (hb_font_t *font,
**/
HB_EXTERN
hb_bool_t
hb_ot_layout_is_math_extended_shape
(
hb_face_t
*
face
,
hb_codepoint_t
glyph
)
hb_codepoint_t
glyph
)
{
const
OT
::
MATH
&
math
=
_get_math
(
face
);
return
math
.
has_math_glyph_info
()
&&
...
...
@@ -1363,21 +1363,17 @@ hb_ot_layout_is_math_extended_shape (hb_face_t *face,
**/
HB_EXTERN
hb_position_t
hb_ot_layout_get_math_kerning
(
hb_font_t
*
font
,
hb_codepoint_t
glyph
,
hb_ot_math_kern_t
kern
,
hb_position_t
correction_height
)
hb_codepoint_t
glyph
,
hb_ot_math_kern_t
kern
,
hb_position_t
correction_height
)
{
const
OT
::
MATH
&
math
=
_get_math
(
font
->
face
);
if
(
math
.
has_math_glyph_info
())
{
const
OT
::
MathGlyphInfo
&
glyphInfo
=
math
.
get_math_glyph_info
();
if
(
glyphInfo
.
has_math_kern_info
())
{
const
OT
::
MathKernInfo
&
kernInfo
=
glyphInfo
.
get_math_kern_info
();
const
OT
::
MathKernInfoRecord
*
kernInfoRecord
;
if
(
kernInfo
.
get_math_kern_info_record
(
glyph
,
kernInfoRecord
)
&&
kernInfoRecord
->
has_math_kern
(
kern
))
{
return
kernInfoRecord
->
get_math_kern
(
kern
,
&
kernInfo
).
get_value
(
font
,
correction_height
);
}
const
OT
::
MathKernInfoRecord
&
kernInfoRecord
=
kernInfo
.
get_math_kern_info_record
(
glyph
);
return
kernInfoRecord
.
get_math_kern
(
kern
,
&
kernInfo
).
get_value
(
font
,
correction_height
);
}
}
...
...
src/hb-ot-layout.h
浏览文件 @
8a8cfad9
...
...
@@ -308,25 +308,25 @@ hb_ot_layout_has_math_data (hb_face_t *face);
HB_EXTERN
hb_position_t
hb_ot_layout_get_math_constant
(
hb_font_t
*
font
,
hb_ot_math_constant_t
constant
);
hb_ot_math_constant_t
constant
);
HB_EXTERN
hb_position_t
hb_ot_layout_get_math_italic_correction
(
hb_font_t
*
font
,
hb_codepoint_t
glyph
);
hb_codepoint_t
glyph
);
HB_EXTERN
hb_position_t
hb_ot_layout_get_math_top_accent_attachment
(
hb_font_t
*
font
,
hb_codepoint_t
glyph
);
hb_codepoint_t
glyph
);
HB_EXTERN
hb_bool_t
hb_ot_layout_is_math_extended_shape
(
hb_face_t
*
face
,
hb_codepoint_t
glyph
);
hb_codepoint_t
glyph
);
HB_EXTERN
hb_position_t
hb_ot_layout_get_math_kerning
(
hb_font_t
*
font
,
hb_codepoint_t
glyph
,
hb_ot_math_kern_t
kern
,
hb_position_t
correction_height
);
hb_codepoint_t
glyph
,
hb_ot_math_kern_t
kern
,
hb_position_t
correction_height
);
HB_END_DECLS
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录