Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
0e088a63
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,发现更多精彩内容 >>
You need to sign in or sign up before continuing.
提交
0e088a63
编写于
2月 14, 2018
作者:
R
Rod Sheeter
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[subset] hmtx space bracket. authors++
上级
1725c35d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
20 addition
and
20 deletion
+20
-20
src/hb-ot-hmtx-table.hh
src/hb-ot-hmtx-table.hh
+20
-20
未找到文件。
src/hb-ot-hmtx-table.hh
浏览文件 @
0e088a63
...
...
@@ -21,7 +21,7 @@
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Google Author(s): Behdad Esfahbod
* Google Author(s): Behdad Esfahbod
, Roderick Sheeter
*/
#ifndef HB_OT_HMTX_TABLE_HH
...
...
@@ -65,10 +65,10 @@ struct hmtxvmtx
}
inline
bool
subset_update_header
(
hb_subset_plan_t
*
plan
,
unsigned
int
num_hmetrics
)
const
inline
bool
subset_update_header
(
hb_subset_plan_t
*
plan
,
unsigned
int
num_hmetrics
)
const
{
hb_blob_t
*
src_blob
=
OT
::
Sanitizer
<
H
>
().
sanitize
(
plan
->
source
->
reference_table
(
H
::
tableTag
));
hb_blob_t
*
src_blob
=
OT
::
Sanitizer
<
H
>
().
sanitize
(
plan
->
source
->
reference_table
(
H
::
tableTag
));
hb_blob_t
*
dest_blob
=
hb_blob_copy_writable_or_fail
(
src_blob
);
hb_blob_destroy
(
src_blob
);
...
...
@@ -77,7 +77,7 @@ struct hmtxvmtx
}
unsigned
int
length
;
H
*
table
=
(
H
*
)
hb_blob_get_data
(
dest_blob
,
&
length
);
H
*
table
=
(
H
*
)
hb_blob_get_data
(
dest_blob
,
&
length
);
table
->
numberOfLongMetrics
.
set
(
num_hmetrics
);
bool
result
=
hb_subset_plan_add_table
(
plan
,
H
::
tableTag
,
dest_blob
);
...
...
@@ -89,15 +89,15 @@ struct hmtxvmtx
inline
bool
subset
(
hb_subset_plan_t
*
plan
)
const
{
typename
T
::
accelerator_t
_mtx
;
_mtx
.
init
(
plan
->
source
);
_mtx
.
init
(
plan
->
source
);
/* All the trailing glyphs with the same advance can use one LongMetric
* and just keep LSB */
hb_prealloced_array_t
<
hb_codepoint_t
>
&
gids
=
plan
->
gids_to_retain_sorted
;
unsigned
int
num_advances
=
gids
.
len
;
unsigned
int
last_advance
=
_mtx
.
get_advance
(
gids
[
num_advances
-
1
]);
unsigned
int
last_advance
=
_mtx
.
get_advance
(
gids
[
num_advances
-
1
]);
while
(
num_advances
>
1
&&
last_advance
==
_mtx
.
get_advance
(
gids
[
num_advances
-
2
]))
&&
last_advance
==
_mtx
.
get_advance
(
gids
[
num_advances
-
2
]))
{
num_advances
--
;
}
...
...
@@ -105,7 +105,7 @@ struct hmtxvmtx
/* alloc the new table */
size_t
dest_sz
=
num_advances
*
4
+
(
gids
.
len
-
num_advances
)
*
2
;
void
*
dest
=
(
void
*
)
calloc
(
dest_sz
,
1
);
void
*
dest
=
(
void
*
)
calloc
(
dest_sz
,
1
);
if
(
unlikely
(
!
dest
))
{
return
false
;
...
...
@@ -113,7 +113,7 @@ struct hmtxvmtx
DEBUG_MSG
(
SUBSET
,
nullptr
,
"%c%c%c%c in src has %d advances, %d lsbs"
,
HB_UNTAG
(
T
::
tableTag
),
_mtx
.
num_advances
,
_mtx
.
num_metrics
-
_mtx
.
num_advances
);
DEBUG_MSG
(
SUBSET
,
nullptr
,
"%c%c%c%c in dest has %d advances, %d lsbs, %d bytes"
,
HB_UNTAG
(
T
::
tableTag
),
num_advances
,
gids
.
len
-
num_advances
,
dest_sz
);
const
char
*
source_table
=
hb_blob_get_data
(
_mtx
.
blob
,
nullptr
);
const
char
*
source_table
=
hb_blob_get_data
(
_mtx
.
blob
,
nullptr
);
// Copy everything over
LongMetric
*
old_metrics
=
(
LongMetric
*
)
source_table
;
FWORD
*
lsbs
=
(
FWORD
*
)
(
old_metrics
+
_mtx
.
num_advances
);
...
...
@@ -121,7 +121,7 @@ struct hmtxvmtx
for
(
unsigned
int
i
=
0
;
i
<
gids
.
len
;
i
++
)
{
/* the last metric or the one for gids[i] */
LongMetric
*
src_metric
=
old_metrics
+
MIN
(
_mtx
.
num_advances
-
1
,
gids
[
i
]);
LongMetric
*
src_metric
=
old_metrics
+
MIN
(
_mtx
.
num_advances
-
1
,
gids
[
i
]);
if
(
gids
[
i
]
<
_mtx
.
num_advances
)
{
/* src is a LongMetric */
...
...
@@ -154,12 +154,12 @@ struct hmtxvmtx
}
dest_pos
+=
(
i
<
num_advances
?
4
:
2
);
}
_mtx
.
fini
();
_mtx
.
fini
();
// Amend header num hmetrics
if
(
unlikely
(
!
subset_update_header
(
plan
,
num_advances
)))
if
(
unlikely
(
!
subset_update_header
(
plan
,
num_advances
)))
{
free
(
dest
);
free
(
dest
);
return
false
;
}
...
...
@@ -168,7 +168,7 @@ struct hmtxvmtx
HB_MEMORY_MODE_READONLY
,
/* userdata */
nullptr
,
free
);
return
hb_subset_plan_add_table
(
plan
,
T
::
tableTag
,
result
);
return
hb_subset_plan_add_table
(
plan
,
T
::
tableTag
,
result
);
}
struct
accelerator_t
...
...
@@ -183,7 +183,7 @@ struct hmtxvmtx
bool
got_font_extents
=
false
;
if
(
T
::
os2Tag
)
{
hb_blob_t
*
os2_blob
=
Sanitizer
<
os2
>
().
sanitize
(
face
->
reference_table
(
T
::
os2Tag
));
hb_blob_t
*
os2_blob
=
Sanitizer
<
os2
>
().
sanitize
(
face
->
reference_table
(
T
::
os2Tag
));
const
os2
*
os2_table
=
Sanitizer
<
os2
>::
lock_instance
(
os2_blob
);
#define USE_TYPO_METRICS (1u<<7)
if
(
0
!=
(
os2_table
->
fsSelection
&
USE_TYPO_METRICS
))
...
...
@@ -196,7 +196,7 @@ struct hmtxvmtx
hb_blob_destroy
(
os2_blob
);
}
hb_blob_t
*
_hea_blob
=
Sanitizer
<
H
>
().
sanitize
(
face
->
reference_table
(
H
::
tableTag
));
hb_blob_t
*
_hea_blob
=
Sanitizer
<
H
>
().
sanitize
(
face
->
reference_table
(
H
::
tableTag
));
const
H
*
_hea_table
=
Sanitizer
<
H
>::
lock_instance
(
_hea_blob
);
num_advances
=
_hea_table
->
numberOfLongMetrics
;
if
(
!
got_font_extents
)
...
...
@@ -210,7 +210,7 @@ struct hmtxvmtx
has_font_extents
=
got_font_extents
;
blob
=
Sanitizer
<
hmtxvmtx
>
().
sanitize
(
face
->
reference_table
(
T
::
tableTag
));
blob
=
Sanitizer
<
hmtxvmtx
>
().
sanitize
(
face
->
reference_table
(
T
::
tableTag
));
/* Cap num_metrics() and num_advances() based on table length. */
unsigned
int
len
=
hb_blob_get_length
(
blob
);
...
...
@@ -228,7 +228,7 @@ struct hmtxvmtx
}
table
=
Sanitizer
<
hmtxvmtx
>::
lock_instance
(
blob
);
var_blob
=
Sanitizer
<
HVARVVAR
>
().
sanitize
(
face
->
reference_table
(
T
::
variationsTag
));
var_blob
=
Sanitizer
<
HVARVVAR
>
().
sanitize
(
face
->
reference_table
(
T
::
variationsTag
));
var_table
=
Sanitizer
<
HVARVVAR
>::
lock_instance
(
var_blob
);
}
...
...
@@ -257,7 +257,7 @@ struct hmtxvmtx
inline
unsigned
int
get_advance
(
hb_codepoint_t
glyph
,
hb_font_t
*
font
)
const
{
return
get_advance
(
glyph
)
return
get_advance
(
glyph
)
+
(
font
->
num_coords
?
var_table
->
get_advance_var
(
glyph
,
font
->
coords
,
font
->
num_coords
)
:
0
);
// TODO Optimize?!
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录