Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
8bcf517f
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,发现更多精彩内容 >>
提交
8bcf517f
编写于
9月 26, 2016
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[MATH] Clean up get_italics_correction()
上级
06003f71
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
25 addition
and
30 deletion
+25
-30
src/hb-ot-layout-math-table.hh
src/hb-ot-layout-math-table.hh
+8
-8
src/hb-ot-layout.cc
src/hb-ot-layout.cc
+6
-11
src/hb-ot-layout.h
src/hb-ot-layout.h
+2
-2
test/api/test-ot-layout-math.c
test/api/test-ot-layout-math.c
+9
-9
未找到文件。
src/hb-ot-layout-math-table.hh
浏览文件 @
8bcf517f
...
...
@@ -173,13 +173,11 @@ struct MathItalicsCorrectionInfo
italicsCorrection
.
sanitize
(
c
,
this
));
}
inline
bool
get_value
(
hb_font_t
*
font
,
hb_codepoint_t
glyph
,
hb_position_t
&
value
)
const
inline
hb_position_t
get_value
(
hb_codepoint_t
glyph
,
hb_font_t
*
font
)
const
{
unsigned
int
index
=
(
this
+
coverage
).
get_coverage
(
glyph
);
if
(
likely
(
index
==
NOT_COVERED
))
return
false
;
if
(
unlikely
(
index
>=
italicsCorrection
.
len
))
return
false
;
value
=
italicsCorrection
[
index
].
get_x_value
(
font
,
this
);
return
italicsCorrection
[
index
].
get_x_value
(
font
,
this
);
return
true
;
}
...
...
@@ -367,9 +365,11 @@ struct MathGlyphInfo
mathKernInfo
.
sanitize
(
c
,
this
));
}
inline
const
MathItalicsCorrectionInfo
&
get_math_italics_correction_info
(
void
)
const
{
return
this
+
mathItalicsCorrectionInfo
;
inline
hb_position_t
get_italics_correction
(
hb_codepoint_t
glyph
,
hb_font_t
*
font
)
const
{
return
(
this
+
mathItalicsCorrectionInfo
).
get_value
(
glyph
,
font
);
}
inline
const
MathTopAccentAttachment
&
...
...
src/hb-ot-layout.cc
浏览文件 @
8bcf517f
...
...
@@ -1270,26 +1270,21 @@ hb_ot_layout_get_math_constant (hb_font_t *font,
}
/**
* hb_ot_layout_get_math_italic_correction:
* hb_ot_layout_get_math_italic
s
_correction:
*
* @font: #hb_font_t from which to retrieve the value
* @glyph: glyph index from which to retrieve the value
*
* Return value: the italic correction of the glyph or 0
* Return value: the italic
s
correction of the glyph or 0
*
* Since: 1.4
**/
HB_EXTERN
hb_position_t
hb_ot_layout_get_math_italic_correction
(
hb_font_t
*
font
,
hb_ot_layout_get_math_italic
s
_correction
(
hb_font_t
*
font
,
hb_codepoint_t
glyph
)
{
const
OT
::
MATH
&
math
=
_get_math
(
font
->
face
);
const
OT
::
MathGlyphInfo
&
glyphInfo
=
math
.
get_math_glyph_info
();
hb_position_t
value
;
if
(
glyphInfo
.
get_math_italics_correction_info
().
get_value
(
font
,
glyph
,
value
))
return
value
;
else
return
0
;
return
math
.
get_math_glyph_info
().
get_italics_correction
(
glyph
,
font
);
}
/**
...
...
@@ -1330,7 +1325,7 @@ hb_ot_layout_is_math_extended_shape (hb_face_t *face,
hb_codepoint_t
glyph
)
{
const
OT
::
MATH
&
math
=
_get_math
(
face
);
return
math
.
get_math_glyph_info
().
is_extended_shape
(
glyph
);
return
math
.
get_math_glyph_info
().
is_extended_shape
(
glyph
);
}
/**
...
...
src/hb-ot-layout.h
浏览文件 @
8bcf517f
...
...
@@ -311,7 +311,7 @@ hb_ot_layout_get_math_constant (hb_font_t *font,
hb_ot_math_constant_t
constant
);
HB_EXTERN
hb_position_t
hb_ot_layout_get_math_italic_correction
(
hb_font_t
*
font
,
hb_ot_layout_get_math_italic
s
_correction
(
hb_font_t
*
font
,
hb_codepoint_t
glyph
);
HB_EXTERN
hb_position_t
...
...
test/api/test-ot-layout-math.c
浏览文件 @
8bcf517f
...
...
@@ -161,35 +161,35 @@ test_get_math_constant (void)
}
static
void
test_get_math_italic_correction
(
void
)
test_get_math_italic
s
_correction
(
void
)
{
hb_codepoint_t
glyph
;
initFreeType
();
openFont
(
"fonts/MathTestFontEmpty.otf"
);
g_assert
(
hb_font_get_glyph_from_name
(
hb_font
,
"space"
,
-
1
,
&
glyph
));
g_assert_cmpint
(
hb_ot_layout_get_math_italic_correction
(
hb_font
,
glyph
),
==
,
0
);
// MathGlyphInfo not available
g_assert_cmpint
(
hb_ot_layout_get_math_italic
s
_correction
(
hb_font
,
glyph
),
==
,
0
);
// MathGlyphInfo not available
closeFont
();
openFont
(
"fonts/MathTestFontPartial1.otf"
);
g_assert
(
hb_font_get_glyph_from_name
(
hb_font
,
"space"
,
-
1
,
&
glyph
));
g_assert_cmpint
(
hb_ot_layout_get_math_italic_correction
(
hb_font
,
glyph
),
==
,
0
);
// MathGlyphInfo empty
g_assert_cmpint
(
hb_ot_layout_get_math_italic
s
_correction
(
hb_font
,
glyph
),
==
,
0
);
// MathGlyphInfo empty
closeFont
();
openFont
(
"fonts/MathTestFontPartial2.otf"
);
g_assert
(
hb_font_get_glyph_from_name
(
hb_font
,
"space"
,
-
1
,
&
glyph
));
g_assert_cmpint
(
hb_ot_layout_get_math_italic_correction
(
hb_font
,
glyph
),
==
,
0
);
// MathItalicsCorrectionInfo empty
g_assert_cmpint
(
hb_ot_layout_get_math_italic
s
_correction
(
hb_font
,
glyph
),
==
,
0
);
// MathItalicsCorrectionInfo empty
closeFont
();
openFont
(
"fonts/MathTestFontFull.otf"
);
g_assert
(
hb_font_get_glyph_from_name
(
hb_font
,
"space"
,
-
1
,
&
glyph
));
g_assert_cmpint
(
hb_ot_layout_get_math_italic_correction
(
hb_font
,
glyph
),
==
,
0
);
// Glyph without italic correction.
g_assert_cmpint
(
hb_ot_layout_get_math_italic
s
_correction
(
hb_font
,
glyph
),
==
,
0
);
// Glyph without italic correction.
g_assert
(
hb_font_get_glyph_from_name
(
hb_font
,
"A"
,
-
1
,
&
glyph
));
g_assert_cmpint
(
hb_ot_layout_get_math_italic_correction
(
hb_font
,
glyph
),
==
,
197
);
g_assert_cmpint
(
hb_ot_layout_get_math_italic
s
_correction
(
hb_font
,
glyph
),
==
,
197
);
g_assert
(
hb_font_get_glyph_from_name
(
hb_font
,
"B"
,
-
1
,
&
glyph
));
g_assert_cmpint
(
hb_ot_layout_get_math_italic_correction
(
hb_font
,
glyph
),
==
,
150
);
g_assert_cmpint
(
hb_ot_layout_get_math_italic
s
_correction
(
hb_font
,
glyph
),
==
,
150
);
g_assert
(
hb_font_get_glyph_from_name
(
hb_font
,
"C"
,
-
1
,
&
glyph
));
g_assert_cmpint
(
hb_ot_layout_get_math_italic_correction
(
hb_font
,
glyph
),
==
,
452
);
g_assert_cmpint
(
hb_ot_layout_get_math_italic
s
_correction
(
hb_font
,
glyph
),
==
,
452
);
closeFont
();
cleanupFreeType
();
...
...
@@ -318,7 +318,7 @@ main (int argc, char **argv)
hb_test_add
(
test_has_math_data
);
hb_test_add
(
test_get_math_constant
);
hb_test_add
(
test_get_math_italic_correction
);
hb_test_add
(
test_get_math_italic
s
_correction
);
hb_test_add
(
test_get_math_top_accent_attachment
);
hb_test_add
(
test_is_math_extended_shape
);
hb_test_add
(
test_get_math_kerning
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录