Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
6d9d3c55
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,发现更多精彩内容 >>
提交
6d9d3c55
编写于
3月 01, 2016
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[GX] Add data types for encoding numerical variations
上级
b843c6d8
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
126 addition
and
0 deletion
+126
-0
src/hb-font-private.hh
src/hb-font-private.hh
+10
-0
src/hb-font.cc
src/hb-font.cc
+3
-0
src/hb-ot-layout-common-private.hh
src/hb-ot-layout-common-private.hh
+113
-0
未找到文件。
src/hb-font-private.hh
浏览文件 @
6d9d3c55
...
...
@@ -108,6 +108,10 @@ struct hb_font_t {
unsigned
int
x_ppem
;
unsigned
int
y_ppem
;
/* Font variation coordinates. */
int
*
coords
;
unsigned
int
coord_count
;
hb_font_funcs_t
*
klass
;
void
*
user_data
;
hb_destroy_func_t
destroy
;
...
...
@@ -120,6 +124,8 @@ struct hb_font_t {
{
return
HB_DIRECTION_IS_VERTICAL
(
direction
)
?
y_scale
:
x_scale
;
}
inline
hb_position_t
em_scale_x
(
int16_t
v
)
{
return
em_scale
(
v
,
x_scale
);
}
inline
hb_position_t
em_scale_y
(
int16_t
v
)
{
return
em_scale
(
v
,
y_scale
);
}
inline
hb_position_t
em_scalef_x
(
float
v
)
{
return
em_scalef
(
v
,
this
->
x_scale
);
}
inline
hb_position_t
em_scalef_y
(
float
v
)
{
return
em_scalef
(
v
,
this
->
y_scale
);
}
inline
hb_position_t
em_scale_dir
(
int16_t
v
,
hb_direction_t
direction
)
{
return
em_scale
(
v
,
dir_scale
(
direction
));
}
...
...
@@ -531,6 +537,10 @@ struct hb_font_t {
scaled
+=
scaled
>=
0
?
upem
/
2
:
-
upem
/
2
;
/* Round. */
return
(
hb_position_t
)
(
scaled
/
upem
);
}
inline
hb_position_t
em_scalef
(
float
v
,
int
scale
)
{
return
(
hb_position_t
)
(
v
*
scale
/
face
->
get_upem
());
}
};
#define HB_SHAPER_DATA_CREATE_FUNC_EXTRA_ARGS
...
...
src/hb-font.cc
浏览文件 @
6d9d3c55
...
...
@@ -1194,6 +1194,9 @@ hb_font_get_empty (void)
0
,
/* x_ppem */
0
,
/* y_ppem */
NULL
,
/* coords */
0
,
/* coord_count */
const_cast
<
hb_font_funcs_t
*>
(
&
_hb_font_funcs_nil
),
/* klass */
NULL
,
/* user_data */
NULL
,
/* destroy */
...
...
src/hb-ot-layout-common-private.hh
浏览文件 @
6d9d3c55
...
...
@@ -1236,6 +1236,119 @@ struct Device
};
struct
VariationAxis
{
inline
float
evaluate
(
int
*
coords
,
unsigned
int
coord_len
)
const
{
unsigned
int
i
=
axisIndex
;
int
coord
=
i
<
coord_len
?
coords
[
i
]
:
0
;
int
start
=
startCoord
,
peak
=
peakCoord
,
end
=
endCoord
;
if
(
coord
<
start
||
coord
>
end
)
return
0.
;
if
(
coord
==
peak
)
return
1.
;
/* Interpolate */
if
(
coord
<
peak
)
return
float
(
coord
-
start
)
/
(
peak
-
start
);
else
return
float
(
end
-
coord
)
/
(
end
-
peak
);
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_struct
(
this
));
}
public:
Index
axisIndex
;
F2DOT14
startCoord
;
F2DOT14
peakCoord
;
F2DOT14
endCoord
;
public:
DEFINE_SIZE_STATIC
(
8
);
};
struct
VariationTuple
{
inline
float
evaluate
(
int
*
coords
,
unsigned
int
coord_len
)
const
{
float
v
=
1.
;
unsigned
int
count
=
axes
.
len
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
v
*=
(
this
+
axes
[
i
]).
evaluate
(
coords
,
coord_len
);
return
v
;
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
axes
.
sanitize
(
c
,
this
));
}
OffsetArrayOf
<
VariationAxis
>
axes
;
public:
DEFINE_SIZE_ARRAY
(
2
,
axes
);
};
struct
VariationMap
{
inline
const
VariationTuple
&
operator
[]
(
unsigned
int
i
)
const
{
return
this
+
tuples
[
i
];
}
inline
unsigned
int
get_len
(
void
)
const
{
return
tuples
.
len
;
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
tuples
.
sanitize
(
c
,
this
));
}
OffsetArrayOf
<
VariationTuple
>
tuples
;
public:
DEFINE_SIZE_ARRAY
(
2
,
tuples
);
};
struct
VariationDevice
{
inline
hb_position_t
get_x_delta
(
hb_font_t
*
font
)
const
{
return
font
->
em_scalef_x
(
get_delta
(
font
->
coords
,
font
->
coord_count
));
}
inline
hb_position_t
get_y_delta
(
hb_font_t
*
font
)
const
{
return
font
->
em_scalef_y
(
get_delta
(
font
->
coords
,
font
->
coord_count
));
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_struct
(
this
)
&&
c
->
check_range
(
&
deltaValue
,
numDeltas
*
SHORT
::
static_size
));
}
private:
inline
float
get_delta
(
int
*
coords
,
unsigned
int
coord_count
)
const
{
float
v
=
0
;
const
VariationMap
&
map
=
this
+
variationMap
;
unsigned
int
count
=
MIN
((
unsigned
int
)
numDeltas
,
map
.
get_len
());
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
v
+=
deltaValue
[
i
]
*
map
[
i
].
evaluate
(
coords
,
coord_count
);
return
v
;
}
protected:
OffsetTo
<
VariationMap
>
variationMap
;
/* Offset to variation mapping for this table. */
USHORT
numDeltas
;
/* Number of deltas for in this table. */
USHORT
deltaFormat
;
/* Format identifier for this table: 0x10 */
SHORT
deltaValue
[
VAR
];
/* Deltas as signed values in design space. */
public:
DEFINE_SIZE_ARRAY
(
6
,
deltaValue
);
};
}
/* namespace OT */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录