Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
41248cce
T
Third Party Harfbuzz
项目概览
OpenHarmony
/
Third Party Harfbuzz
接近 2 年 前同步成功
通知
1
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看板
提交
41248cce
编写于
5月 07, 2019
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove MIN/MAX in favor of hb_min/hb_max
上级
5c0f62ad
变更
38
隐藏空白更改
内联
并排
Showing
38 changed file
with
111 addition
and
115 deletion
+111
-115
src/hb-aat-layout-common.hh
src/hb-aat-layout-common.hh
+4
-4
src/hb-aat-layout-feat-table.hh
src/hb-aat-layout-feat-table.hh
+1
-1
src/hb-aat-layout-kerx-table.hh
src/hb-aat-layout-kerx-table.hh
+1
-1
src/hb-aat-layout-morx-table.hh
src/hb-aat-layout-morx-table.hh
+9
-9
src/hb-algs.hh
src/hb-algs.hh
+5
-9
src/hb-array.hh
src/hb-array.hh
+2
-2
src/hb-blob.cc
src/hb-blob.cc
+1
-1
src/hb-buffer-serialize.cc
src/hb-buffer-serialize.cc
+16
-16
src/hb-buffer.cc
src/hb-buffer.cc
+2
-2
src/hb-buffer.hh
src/hb-buffer.hh
+1
-1
src/hb-common.cc
src/hb-common.cc
+10
-10
src/hb-coretext.cc
src/hb-coretext.cc
+3
-3
src/hb-debug.hh
src/hb-debug.hh
+1
-1
src/hb-directwrite.cc
src/hb-directwrite.cc
+1
-1
src/hb-ft.cc
src/hb-ft.cc
+1
-1
src/hb-iter.hh
src/hb-iter.hh
+1
-1
src/hb-open-file.hh
src/hb-open-file.hh
+1
-1
src/hb-open-type.hh
src/hb-open-type.hh
+1
-1
src/hb-ot-cmap-table.hh
src/hb-ot-cmap-table.hh
+4
-4
src/hb-ot-color-cbdt-table.hh
src/hb-ot-color-cbdt-table.hh
+3
-3
src/hb-ot-color-cpal-table.hh
src/hb-ot-color-cpal-table.hh
+1
-1
src/hb-ot-color-sbix-table.hh
src/hb-ot-color-sbix-table.hh
+1
-1
src/hb-ot-glyf-table.hh
src/hb-ot-glyf-table.hh
+7
-7
src/hb-ot-hmtx-table.hh
src/hb-ot-hmtx-table.hh
+1
-1
src/hb-ot-layout-gpos-table.hh
src/hb-ot-layout-gpos-table.hh
+1
-1
src/hb-ot-layout-gsub-table.hh
src/hb-ot-layout-gsub-table.hh
+2
-2
src/hb-ot-layout-gsubgpos.hh
src/hb-ot-layout-gsubgpos.hh
+3
-3
src/hb-ot-layout.cc
src/hb-ot-layout.cc
+1
-1
src/hb-ot-map.cc
src/hb-ot-map.cc
+4
-4
src/hb-ot-post-table.hh
src/hb-ot-post-table.hh
+1
-1
src/hb-ot-shape-complex-indic.cc
src/hb-ot-shape-complex-indic.cc
+4
-4
src/hb-ot-shape-complex-use.cc
src/hb-ot-shape-complex-use.cc
+1
-1
src/hb-ot-shape.cc
src/hb-ot-shape.cc
+2
-2
src/hb-ot-tag.cc
src/hb-ot-tag.cc
+1
-1
src/hb-ot-var-avar-table.hh
src/hb-ot-var-avar-table.hh
+1
-1
src/hb-ot-var-fvar-table.hh
src/hb-ot-var-fvar-table.hh
+9
-9
src/hb-sanitize.hh
src/hb-sanitize.hh
+2
-2
src/hb-uniscribe.cc
src/hb-uniscribe.cc
+1
-1
未找到文件。
src/hb-aat-layout-common.hh
浏览文件 @
41248cce
...
@@ -576,7 +576,7 @@ struct StateTable
...
@@ -576,7 +576,7 @@ struct StateTable
if
(
unlikely
(
stop
>
states
))
if
(
unlikely
(
stop
>
states
))
return_trace
(
false
);
return_trace
(
false
);
for
(
const
HBUSHORT
*
p
=
states
;
stop
<
p
;
p
--
)
for
(
const
HBUSHORT
*
p
=
states
;
stop
<
p
;
p
--
)
num_entries
=
MAX
<
unsigned
int
>
(
num_entries
,
*
(
p
-
1
)
+
1
);
num_entries
=
hb_max
(
num_entries
,
*
(
p
-
1
)
+
1
);
state_neg
=
min_state
;
state_neg
=
min_state
;
}
}
}
}
...
@@ -597,7 +597,7 @@ struct StateTable
...
@@ -597,7 +597,7 @@ struct StateTable
if
(
unlikely
(
stop
<
states
))
if
(
unlikely
(
stop
<
states
))
return_trace
(
false
);
return_trace
(
false
);
for
(
const
HBUSHORT
*
p
=
&
states
[
state_pos
*
num_classes
];
p
<
stop
;
p
++
)
for
(
const
HBUSHORT
*
p
=
&
states
[
state_pos
*
num_classes
];
p
<
stop
;
p
++
)
num_entries
=
MAX
<
unsigned
int
>
(
num_entries
,
*
p
+
1
);
num_entries
=
hb_max
(
num_entries
,
*
p
+
1
);
state_pos
=
max_state
+
1
;
state_pos
=
max_state
+
1
;
}
}
}
}
...
@@ -611,8 +611,8 @@ struct StateTable
...
@@ -611,8 +611,8 @@ struct StateTable
for
(
const
Entry
<
Extra
>
*
p
=
&
entries
[
entry
];
p
<
stop
;
p
++
)
for
(
const
Entry
<
Extra
>
*
p
=
&
entries
[
entry
];
p
<
stop
;
p
++
)
{
{
int
newState
=
new_state
(
p
->
newState
);
int
newState
=
new_state
(
p
->
newState
);
min_state
=
MIN
(
min_state
,
newState
);
min_state
=
hb_min
(
min_state
,
newState
);
max_state
=
MAX
(
max_state
,
newState
);
max_state
=
hb_max
(
max_state
,
newState
);
}
}
entry
=
num_entries
;
entry
=
num_entries
;
}
}
...
...
src/hb-aat-layout-feat-table.hh
浏览文件 @
41248cce
...
@@ -165,7 +165,7 @@ struct feat
...
@@ -165,7 +165,7 @@ struct feat
unsigned
int
feature_count
=
featureNameCount
;
unsigned
int
feature_count
=
featureNameCount
;
if
(
count
&&
*
count
)
if
(
count
&&
*
count
)
{
{
unsigned
int
len
=
MIN
(
feature_count
-
start_offset
,
*
count
);
unsigned
int
len
=
hb_min
(
feature_count
-
start_offset
,
*
count
);
for
(
unsigned
int
i
=
0
;
i
<
len
;
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
len
;
i
++
)
features
[
i
]
=
namesZ
[
i
+
start_offset
].
get_feature_type
();
features
[
i
]
=
namesZ
[
i
+
start_offset
].
get_feature_type
();
*
count
=
len
;
*
count
=
len
;
...
...
src/hb-aat-layout-kerx-table.hh
浏览文件 @
41248cce
...
@@ -251,7 +251,7 @@ struct KerxSubTableFormat1
...
@@ -251,7 +251,7 @@ struct KerxSubTableFormat1
if
(
Format1EntryT
::
performAction
(
entry
)
&&
depth
)
if
(
Format1EntryT
::
performAction
(
entry
)
&&
depth
)
{
{
unsigned
int
tuple_count
=
MAX
(
1u
,
table
->
header
.
tuple_count
());
unsigned
int
tuple_count
=
hb_max
(
1u
,
table
->
header
.
tuple_count
());
unsigned
int
kern_idx
=
Format1EntryT
::
kernActionIndex
(
entry
);
unsigned
int
kern_idx
=
Format1EntryT
::
kernActionIndex
(
entry
);
kern_idx
=
Types
::
byteOffsetToIndex
(
kern_idx
,
&
table
->
machine
,
kernAction
.
arrayZ
);
kern_idx
=
Types
::
byteOffsetToIndex
(
kern_idx
,
&
table
->
machine
,
kernAction
.
arrayZ
);
...
...
src/hb-aat-layout-morx-table.hh
浏览文件 @
41248cce
...
@@ -88,7 +88,7 @@ struct RearrangementSubtable
...
@@ -88,7 +88,7 @@ struct RearrangementSubtable
start
=
buffer
->
idx
;
start
=
buffer
->
idx
;
if
(
flags
&
MarkLast
)
if
(
flags
&
MarkLast
)
end
=
MIN
(
buffer
->
idx
+
1
,
buffer
->
len
);
end
=
hb_min
(
buffer
->
idx
+
1
,
buffer
->
len
);
if
((
flags
&
Verb
)
&&
start
<
end
)
if
((
flags
&
Verb
)
&&
start
<
end
)
{
{
...
@@ -117,14 +117,14 @@ struct RearrangementSubtable
...
@@ -117,14 +117,14 @@ struct RearrangementSubtable
};
};
unsigned
int
m
=
map
[
flags
&
Verb
];
unsigned
int
m
=
map
[
flags
&
Verb
];
unsigned
int
l
=
MIN
<
unsigned
int
>
(
2
,
m
>>
4
);
unsigned
int
l
=
hb_min
(
2u
,
m
>>
4
);
unsigned
int
r
=
MIN
<
unsigned
int
>
(
2
,
m
&
0x0F
);
unsigned
int
r
=
hb_min
(
2u
,
m
&
0x0F
);
bool
reverse_l
=
3
==
(
m
>>
4
);
bool
reverse_l
=
3
==
(
m
>>
4
);
bool
reverse_r
=
3
==
(
m
&
0x0F
);
bool
reverse_r
=
3
==
(
m
&
0x0F
);
if
(
end
-
start
>=
l
+
r
)
if
(
end
-
start
>=
l
+
r
)
{
{
buffer
->
merge_clusters
(
start
,
MIN
(
buffer
->
idx
+
1
,
buffer
->
len
));
buffer
->
merge_clusters
(
start
,
hb_min
(
buffer
->
idx
+
1
,
buffer
->
len
));
buffer
->
merge_clusters
(
start
,
end
);
buffer
->
merge_clusters
(
start
,
end
);
hb_glyph_info_t
*
info
=
buffer
->
info
;
hb_glyph_info_t
*
info
=
buffer
->
info
;
...
@@ -261,13 +261,13 @@ struct ContextualSubtable
...
@@ -261,13 +261,13 @@ struct ContextualSubtable
}
}
if
(
replacement
)
if
(
replacement
)
{
{
buffer
->
unsafe_to_break
(
mark
,
MIN
(
buffer
->
idx
+
1
,
buffer
->
len
));
buffer
->
unsafe_to_break
(
mark
,
hb_min
(
buffer
->
idx
+
1
,
buffer
->
len
));
buffer
->
info
[
mark
].
codepoint
=
*
replacement
;
buffer
->
info
[
mark
].
codepoint
=
*
replacement
;
ret
=
true
;
ret
=
true
;
}
}
replacement
=
nullptr
;
replacement
=
nullptr
;
unsigned
int
idx
=
MIN
(
buffer
->
idx
,
buffer
->
len
-
1
);
unsigned
int
idx
=
hb_min
(
buffer
->
idx
,
buffer
->
len
-
1
);
if
(
Types
::
extended
)
if
(
Types
::
extended
)
{
{
if
(
entry
.
data
.
currentIndex
!=
0xFFFF
)
if
(
entry
.
data
.
currentIndex
!=
0xFFFF
)
...
@@ -337,9 +337,9 @@ struct ContextualSubtable
...
@@ -337,9 +337,9 @@ struct ContextualSubtable
const
EntryData
&
data
=
entries
[
i
].
data
;
const
EntryData
&
data
=
entries
[
i
].
data
;
if
(
data
.
markIndex
!=
0xFFFF
)
if
(
data
.
markIndex
!=
0xFFFF
)
num_lookups
=
MAX
<
unsigned
int
>
(
num_lookups
,
1
+
data
.
markIndex
);
num_lookups
=
hb_max
(
num_lookups
,
1
+
data
.
markIndex
);
if
(
data
.
currentIndex
!=
0xFFFF
)
if
(
data
.
currentIndex
!=
0xFFFF
)
num_lookups
=
MAX
<
unsigned
int
>
(
num_lookups
,
1
+
data
.
currentIndex
);
num_lookups
=
hb_max
(
num_lookups
,
1
+
data
.
currentIndex
);
}
}
return_trace
(
substitutionTables
.
sanitize
(
c
,
this
,
num_lookups
));
return_trace
(
substitutionTables
.
sanitize
(
c
,
this
,
num_lookups
));
...
@@ -744,7 +744,7 @@ struct InsertionSubtable
...
@@ -744,7 +744,7 @@ struct InsertionSubtable
buffer
->
move_to
(
end
+
count
);
buffer
->
move_to
(
end
+
count
);
buffer
->
unsafe_to_break_from_outbuffer
(
mark
,
MIN
(
buffer
->
idx
+
1
,
buffer
->
len
));
buffer
->
unsafe_to_break_from_outbuffer
(
mark
,
hb_min
(
buffer
->
idx
+
1
,
buffer
->
len
));
}
}
if
(
flags
&
SetMark
)
if
(
flags
&
SetMark
)
...
...
src/hb-algs.hh
浏览文件 @
41248cce
...
@@ -186,6 +186,10 @@ struct
...
@@ -186,6 +186,10 @@ struct
}
}
HB_FUNCOBJ
(
hb_second
);
HB_FUNCOBJ
(
hb_second
);
/* Note. In min/max, we can use hb_type_identity<T> for second argument.
* However, that would silently convert between different-signedness integers.
* Instead we accept two different types, such that compiler can err if
* comparing integers of different signedness. */
struct
struct
{
{
template
<
typename
T
,
typename
T2
>
auto
template
<
typename
T
,
typename
T2
>
auto
...
@@ -409,14 +413,6 @@ static inline unsigned char TOUPPER (unsigned char c)
...
@@ -409,14 +413,6 @@ static inline unsigned char TOUPPER (unsigned char c)
static
inline
unsigned
char
TOLOWER
(
unsigned
char
c
)
static
inline
unsigned
char
TOLOWER
(
unsigned
char
c
)
{
return
(
c
>=
'A'
&&
c
<=
'Z'
)
?
c
-
'A'
+
'a'
:
c
;
}
{
return
(
c
>=
'A'
&&
c
<=
'Z'
)
?
c
-
'A'
+
'a'
:
c
;
}
#undef MIN
template
<
typename
Type
>
static
inline
Type
MIN
(
const
Type
&
a
,
const
Type
&
b
)
{
return
a
<
b
?
a
:
b
;
}
#undef MAX
template
<
typename
Type
>
static
inline
Type
MAX
(
const
Type
&
a
,
const
Type
&
b
)
{
return
a
>
b
?
a
:
b
;
}
static
inline
unsigned
int
DIV_CEIL
(
const
unsigned
int
a
,
unsigned
int
b
)
static
inline
unsigned
int
DIV_CEIL
(
const
unsigned
int
a
,
unsigned
int
b
)
{
return
(
a
+
(
b
-
1
))
/
b
;
}
{
return
(
a
+
(
b
-
1
))
/
b
;
}
...
@@ -668,7 +664,7 @@ hb_codepoint_parse (const char *s, unsigned int len, int base, hb_codepoint_t *o
...
@@ -668,7 +664,7 @@ hb_codepoint_parse (const char *s, unsigned int len, int base, hb_codepoint_t *o
{
{
/* Pain because we don't know whether s is nul-terminated. */
/* Pain because we don't know whether s is nul-terminated. */
char
buf
[
64
];
char
buf
[
64
];
len
=
MIN
(
ARRAY_LENGTH
(
buf
)
-
1
,
len
);
len
=
hb_min
(
ARRAY_LENGTH
(
buf
)
-
1
,
len
);
strncpy
(
buf
,
s
,
len
);
strncpy
(
buf
,
s
,
len
);
buf
[
len
]
=
'\0'
;
buf
[
len
]
=
'\0'
;
...
...
src/hb-array.hh
浏览文件 @
41248cce
...
@@ -143,7 +143,7 @@ struct hb_array_t : hb_iter_with_fallback_t<hb_array_t<Type>, Type&>
...
@@ -143,7 +143,7 @@ struct hb_array_t : hb_iter_with_fallback_t<hb_array_t<Type>, Type&>
}
}
void
qsort
(
unsigned
int
start
,
unsigned
int
end
)
void
qsort
(
unsigned
int
start
,
unsigned
int
end
)
{
{
end
=
MIN
(
end
,
length
);
end
=
hb_min
(
end
,
length
);
assert
(
start
<=
end
);
assert
(
start
<=
end
);
if
(
likely
(
start
<
end
))
if
(
likely
(
start
<
end
))
::
qsort
(
arrayZ
+
start
,
end
-
start
,
this
->
item_size
,
Type
::
cmp
);
::
qsort
(
arrayZ
+
start
,
end
-
start
,
this
->
item_size
,
Type
::
cmp
);
...
@@ -166,7 +166,7 @@ struct hb_array_t : hb_iter_with_fallback_t<hb_array_t<Type>, Type&>
...
@@ -166,7 +166,7 @@ struct hb_array_t : hb_iter_with_fallback_t<hb_array_t<Type>, Type&>
else
else
count
-=
start_offset
;
count
-=
start_offset
;
if
(
seg_count
)
if
(
seg_count
)
count
=
*
seg_count
=
MIN
(
count
,
*
seg_count
);
count
=
*
seg_count
=
hb_min
(
count
,
*
seg_count
);
return
hb_array_t
<
Type
>
(
arrayZ
+
start_offset
,
count
);
return
hb_array_t
<
Type
>
(
arrayZ
+
start_offset
,
count
);
}
}
hb_array_t
<
Type
>
sub_array
(
unsigned
int
start_offset
,
unsigned
int
seg_count
)
const
hb_array_t
<
Type
>
sub_array
(
unsigned
int
start_offset
,
unsigned
int
seg_count
)
const
...
...
src/hb-blob.cc
浏览文件 @
41248cce
...
@@ -155,7 +155,7 @@ hb_blob_create_sub_blob (hb_blob_t *parent,
...
@@ -155,7 +155,7 @@ hb_blob_create_sub_blob (hb_blob_t *parent,
hb_blob_make_immutable
(
parent
);
hb_blob_make_immutable
(
parent
);
blob
=
hb_blob_create
(
parent
->
data
+
offset
,
blob
=
hb_blob_create
(
parent
->
data
+
offset
,
MIN
(
length
,
parent
->
length
-
offset
),
hb_min
(
length
,
parent
->
length
-
offset
),
HB_MEMORY_MODE_READONLY
,
HB_MEMORY_MODE_READONLY
,
hb_blob_reference
(
parent
),
hb_blob_reference
(
parent
),
_hb_blob_destroy
);
_hb_blob_destroy
);
...
...
src/hb-buffer-serialize.cc
浏览文件 @
41248cce
...
@@ -138,34 +138,34 @@ _hb_buffer_serialize_glyphs_json (hb_buffer_t *buffer,
...
@@ -138,34 +138,34 @@ _hb_buffer_serialize_glyphs_json (hb_buffer_t *buffer,
*
p
++
=
'"'
;
*
p
++
=
'"'
;
}
}
else
else
p
+=
MAX
(
0
,
snprintf
(
p
,
ARRAY_LENGTH
(
b
)
-
(
p
-
b
),
"%u"
,
info
[
i
].
codepoint
));
p
+=
hb_max
(
0
,
snprintf
(
p
,
ARRAY_LENGTH
(
b
)
-
(
p
-
b
),
"%u"
,
info
[
i
].
codepoint
));
if
(
!
(
flags
&
HB_BUFFER_SERIALIZE_FLAG_NO_CLUSTERS
))
{
if
(
!
(
flags
&
HB_BUFFER_SERIALIZE_FLAG_NO_CLUSTERS
))
{
p
+=
MAX
(
0
,
snprintf
(
p
,
ARRAY_LENGTH
(
b
)
-
(
p
-
b
),
",
\"
cl
\"
:%u"
,
info
[
i
].
cluster
));
p
+=
hb_max
(
0
,
snprintf
(
p
,
ARRAY_LENGTH
(
b
)
-
(
p
-
b
),
",
\"
cl
\"
:%u"
,
info
[
i
].
cluster
));
}
}
if
(
!
(
flags
&
HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS
))
if
(
!
(
flags
&
HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS
))
{
{
p
+=
MAX
(
0
,
snprintf
(
p
,
ARRAY_LENGTH
(
b
)
-
(
p
-
b
),
",
\"
dx
\"
:%d,
\"
dy
\"
:%d"
,
p
+=
hb_max
(
0
,
snprintf
(
p
,
ARRAY_LENGTH
(
b
)
-
(
p
-
b
),
",
\"
dx
\"
:%d,
\"
dy
\"
:%d"
,
x
+
pos
[
i
].
x_offset
,
y
+
pos
[
i
].
y_offset
));
x
+
pos
[
i
].
x_offset
,
y
+
pos
[
i
].
y_offset
));
if
(
!
(
flags
&
HB_BUFFER_SERIALIZE_FLAG_NO_ADVANCES
))
if
(
!
(
flags
&
HB_BUFFER_SERIALIZE_FLAG_NO_ADVANCES
))
p
+=
MAX
(
0
,
snprintf
(
p
,
ARRAY_LENGTH
(
b
)
-
(
p
-
b
),
",
\"
ax
\"
:%d,
\"
ay
\"
:%d"
,
p
+=
hb_max
(
0
,
snprintf
(
p
,
ARRAY_LENGTH
(
b
)
-
(
p
-
b
),
",
\"
ax
\"
:%d,
\"
ay
\"
:%d"
,
pos
[
i
].
x_advance
,
pos
[
i
].
y_advance
));
pos
[
i
].
x_advance
,
pos
[
i
].
y_advance
));
}
}
if
(
flags
&
HB_BUFFER_SERIALIZE_FLAG_GLYPH_FLAGS
)
if
(
flags
&
HB_BUFFER_SERIALIZE_FLAG_GLYPH_FLAGS
)
{
{
if
(
info
[
i
].
mask
&
HB_GLYPH_FLAG_DEFINED
)
if
(
info
[
i
].
mask
&
HB_GLYPH_FLAG_DEFINED
)
p
+=
MAX
(
0
,
snprintf
(
p
,
ARRAY_LENGTH
(
b
)
-
(
p
-
b
),
",
\"
fl
\"
:%u"
,
info
[
i
].
mask
&
HB_GLYPH_FLAG_DEFINED
));
p
+=
hb_max
(
0
,
snprintf
(
p
,
ARRAY_LENGTH
(
b
)
-
(
p
-
b
),
",
\"
fl
\"
:%u"
,
info
[
i
].
mask
&
HB_GLYPH_FLAG_DEFINED
));
}
}
if
(
flags
&
HB_BUFFER_SERIALIZE_FLAG_GLYPH_EXTENTS
)
if
(
flags
&
HB_BUFFER_SERIALIZE_FLAG_GLYPH_EXTENTS
)
{
{
hb_glyph_extents_t
extents
;
hb_glyph_extents_t
extents
;
hb_font_get_glyph_extents
(
font
,
info
[
i
].
codepoint
,
&
extents
);
hb_font_get_glyph_extents
(
font
,
info
[
i
].
codepoint
,
&
extents
);
p
+=
MAX
(
0
,
snprintf
(
p
,
ARRAY_LENGTH
(
b
)
-
(
p
-
b
),
",
\"
xb
\"
:%d,
\"
yb
\"
:%d"
,
p
+=
hb_max
(
0
,
snprintf
(
p
,
ARRAY_LENGTH
(
b
)
-
(
p
-
b
),
",
\"
xb
\"
:%d,
\"
yb
\"
:%d"
,
extents
.
x_bearing
,
extents
.
y_bearing
));
extents
.
x_bearing
,
extents
.
y_bearing
));
p
+=
MAX
(
0
,
snprintf
(
p
,
ARRAY_LENGTH
(
b
)
-
(
p
-
b
),
",
\"
w
\"
:%d,
\"
h
\"
:%d"
,
p
+=
hb_max
(
0
,
snprintf
(
p
,
ARRAY_LENGTH
(
b
)
-
(
p
-
b
),
",
\"
w
\"
:%d,
\"
h
\"
:%d"
,
extents
.
width
,
extents
.
height
));
extents
.
width
,
extents
.
height
));
}
}
...
@@ -224,37 +224,37 @@ _hb_buffer_serialize_glyphs_text (hb_buffer_t *buffer,
...
@@ -224,37 +224,37 @@ _hb_buffer_serialize_glyphs_text (hb_buffer_t *buffer,
p
+=
strlen
(
p
);
p
+=
strlen
(
p
);
}
}
else
else
p
+=
MAX
(
0
,
snprintf
(
p
,
ARRAY_LENGTH
(
b
)
-
(
p
-
b
),
"%u"
,
info
[
i
].
codepoint
));
p
+=
hb_max
(
0
,
snprintf
(
p
,
ARRAY_LENGTH
(
b
)
-
(
p
-
b
),
"%u"
,
info
[
i
].
codepoint
));
if
(
!
(
flags
&
HB_BUFFER_SERIALIZE_FLAG_NO_CLUSTERS
))
{
if
(
!
(
flags
&
HB_BUFFER_SERIALIZE_FLAG_NO_CLUSTERS
))
{
p
+=
MAX
(
0
,
snprintf
(
p
,
ARRAY_LENGTH
(
b
)
-
(
p
-
b
),
"=%u"
,
info
[
i
].
cluster
));
p
+=
hb_max
(
0
,
snprintf
(
p
,
ARRAY_LENGTH
(
b
)
-
(
p
-
b
),
"=%u"
,
info
[
i
].
cluster
));
}
}
if
(
!
(
flags
&
HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS
))
if
(
!
(
flags
&
HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS
))
{
{
if
(
x
+
pos
[
i
].
x_offset
||
y
+
pos
[
i
].
y_offset
)
if
(
x
+
pos
[
i
].
x_offset
||
y
+
pos
[
i
].
y_offset
)
p
+=
MAX
(
0
,
snprintf
(
p
,
ARRAY_LENGTH
(
b
)
-
(
p
-
b
),
"@%d,%d"
,
x
+
pos
[
i
].
x_offset
,
y
+
pos
[
i
].
y_offset
));
p
+=
hb_max
(
0
,
snprintf
(
p
,
ARRAY_LENGTH
(
b
)
-
(
p
-
b
),
"@%d,%d"
,
x
+
pos
[
i
].
x_offset
,
y
+
pos
[
i
].
y_offset
));
if
(
!
(
flags
&
HB_BUFFER_SERIALIZE_FLAG_NO_ADVANCES
))
if
(
!
(
flags
&
HB_BUFFER_SERIALIZE_FLAG_NO_ADVANCES
))
{
{
*
p
++
=
'+'
;
*
p
++
=
'+'
;
p
+=
MAX
(
0
,
snprintf
(
p
,
ARRAY_LENGTH
(
b
)
-
(
p
-
b
),
"%d"
,
pos
[
i
].
x_advance
));
p
+=
hb_max
(
0
,
snprintf
(
p
,
ARRAY_LENGTH
(
b
)
-
(
p
-
b
),
"%d"
,
pos
[
i
].
x_advance
));
if
(
pos
[
i
].
y_advance
)
if
(
pos
[
i
].
y_advance
)
p
+=
MAX
(
0
,
snprintf
(
p
,
ARRAY_LENGTH
(
b
)
-
(
p
-
b
),
",%d"
,
pos
[
i
].
y_advance
));
p
+=
hb_max
(
0
,
snprintf
(
p
,
ARRAY_LENGTH
(
b
)
-
(
p
-
b
),
",%d"
,
pos
[
i
].
y_advance
));
}
}
}
}
if
(
flags
&
HB_BUFFER_SERIALIZE_FLAG_GLYPH_FLAGS
)
if
(
flags
&
HB_BUFFER_SERIALIZE_FLAG_GLYPH_FLAGS
)
{
{
if
(
info
[
i
].
mask
&
HB_GLYPH_FLAG_DEFINED
)
if
(
info
[
i
].
mask
&
HB_GLYPH_FLAG_DEFINED
)
p
+=
MAX
(
0
,
snprintf
(
p
,
ARRAY_LENGTH
(
b
)
-
(
p
-
b
),
"#%X"
,
info
[
i
].
mask
&
HB_GLYPH_FLAG_DEFINED
));
p
+=
hb_max
(
0
,
snprintf
(
p
,
ARRAY_LENGTH
(
b
)
-
(
p
-
b
),
"#%X"
,
info
[
i
].
mask
&
HB_GLYPH_FLAG_DEFINED
));
}
}
if
(
flags
&
HB_BUFFER_SERIALIZE_FLAG_GLYPH_EXTENTS
)
if
(
flags
&
HB_BUFFER_SERIALIZE_FLAG_GLYPH_EXTENTS
)
{
{
hb_glyph_extents_t
extents
;
hb_glyph_extents_t
extents
;
hb_font_get_glyph_extents
(
font
,
info
[
i
].
codepoint
,
&
extents
);
hb_font_get_glyph_extents
(
font
,
info
[
i
].
codepoint
,
&
extents
);
p
+=
MAX
(
0
,
snprintf
(
p
,
ARRAY_LENGTH
(
b
)
-
(
p
-
b
),
"<%d,%d,%d,%d>"
,
extents
.
x_bearing
,
extents
.
y_bearing
,
extents
.
width
,
extents
.
height
));
p
+=
hb_max
(
0
,
snprintf
(
p
,
ARRAY_LENGTH
(
b
)
-
(
p
-
b
),
"<%d,%d,%d,%d>"
,
extents
.
x_bearing
,
extents
.
y_bearing
,
extents
.
width
,
extents
.
height
));
}
}
unsigned
int
l
=
p
-
b
;
unsigned
int
l
=
p
-
b
;
...
@@ -380,7 +380,7 @@ static hb_bool_t
...
@@ -380,7 +380,7 @@ static hb_bool_t
parse_uint
(
const
char
*
pp
,
const
char
*
end
,
uint32_t
*
pv
)
parse_uint
(
const
char
*
pp
,
const
char
*
end
,
uint32_t
*
pv
)
{
{
char
buf
[
32
];
char
buf
[
32
];
unsigned
int
len
=
MIN
(
ARRAY_LENGTH
(
buf
)
-
1
,
(
unsigned
int
)
(
end
-
pp
));
unsigned
int
len
=
hb_min
(
ARRAY_LENGTH
(
buf
)
-
1
,
(
unsigned
int
)
(
end
-
pp
));
strncpy
(
buf
,
pp
,
len
);
strncpy
(
buf
,
pp
,
len
);
buf
[
len
]
=
'\0'
;
buf
[
len
]
=
'\0'
;
...
@@ -401,7 +401,7 @@ static hb_bool_t
...
@@ -401,7 +401,7 @@ static hb_bool_t
parse_int
(
const
char
*
pp
,
const
char
*
end
,
int32_t
*
pv
)
parse_int
(
const
char
*
pp
,
const
char
*
end
,
int32_t
*
pv
)
{
{
char
buf
[
32
];
char
buf
[
32
];
unsigned
int
len
=
MIN
(
ARRAY_LENGTH
(
buf
)
-
1
,
(
unsigned
int
)
(
end
-
pp
));
unsigned
int
len
=
hb_min
(
ARRAY_LENGTH
(
buf
)
-
1
,
(
unsigned
int
)
(
end
-
pp
));
strncpy
(
buf
,
pp
,
len
);
strncpy
(
buf
,
pp
,
len
);
buf
[
len
]
=
'\0'
;
buf
[
len
]
=
'\0'
;
...
...
src/hb-buffer.cc
浏览文件 @
41248cce
...
@@ -524,7 +524,7 @@ hb_buffer_t::merge_clusters_impl (unsigned int start,
...
@@ -524,7 +524,7 @@ hb_buffer_t::merge_clusters_impl (unsigned int start,
unsigned
int
cluster
=
info
[
start
].
cluster
;
unsigned
int
cluster
=
info
[
start
].
cluster
;
for
(
unsigned
int
i
=
start
+
1
;
i
<
end
;
i
++
)
for
(
unsigned
int
i
=
start
+
1
;
i
<
end
;
i
++
)
cluster
=
MIN
<
unsigned
int
>
(
cluster
,
info
[
i
].
cluster
);
cluster
=
hb_min
(
cluster
,
info
[
i
].
cluster
);
/* Extend end */
/* Extend end */
while
(
end
<
len
&&
info
[
end
-
1
].
cluster
==
info
[
end
].
cluster
)
while
(
end
<
len
&&
info
[
end
-
1
].
cluster
==
info
[
end
].
cluster
)
...
@@ -555,7 +555,7 @@ hb_buffer_t::merge_out_clusters (unsigned int start,
...
@@ -555,7 +555,7 @@ hb_buffer_t::merge_out_clusters (unsigned int start,
unsigned
int
cluster
=
out_info
[
start
].
cluster
;
unsigned
int
cluster
=
out_info
[
start
].
cluster
;
for
(
unsigned
int
i
=
start
+
1
;
i
<
end
;
i
++
)
for
(
unsigned
int
i
=
start
+
1
;
i
<
end
;
i
++
)
cluster
=
MIN
<
unsigned
int
>
(
cluster
,
out_info
[
i
].
cluster
);
cluster
=
hb_min
(
cluster
,
out_info
[
i
].
cluster
);
/* Extend start */
/* Extend start */
while
(
start
&&
out_info
[
start
-
1
].
cluster
==
out_info
[
start
].
cluster
)
while
(
start
&&
out_info
[
start
-
1
].
cluster
==
out_info
[
start
].
cluster
)
...
...
src/hb-buffer.hh
浏览文件 @
41248cce
...
@@ -379,7 +379,7 @@ struct hb_buffer_t
...
@@ -379,7 +379,7 @@ struct hb_buffer_t
unsigned
int
cluster
)
const
unsigned
int
cluster
)
const
{
{
for
(
unsigned
int
i
=
start
;
i
<
end
;
i
++
)
for
(
unsigned
int
i
=
start
;
i
<
end
;
i
++
)
cluster
=
MIN
<
unsigned
int
>
(
cluster
,
infos
[
i
].
cluster
);
cluster
=
hb_min
(
cluster
,
infos
[
i
].
cluster
);
return
cluster
;
return
cluster
;
}
}
void
void
...
...
src/hb-common.cc
浏览文件 @
41248cce
...
@@ -356,7 +356,7 @@ hb_language_from_string (const char *str, int len)
...
@@ -356,7 +356,7 @@ hb_language_from_string (const char *str, int len)
{
{
/* NUL-terminate it. */
/* NUL-terminate it. */
char
strbuf
[
64
];
char
strbuf
[
64
];
len
=
MIN
(
len
,
(
int
)
sizeof
(
strbuf
)
-
1
);
len
=
hb_min
(
len
,
(
int
)
sizeof
(
strbuf
)
-
1
);
memcpy
(
strbuf
,
str
,
len
);
memcpy
(
strbuf
,
str
,
len
);
strbuf
[
len
]
=
'\0'
;
strbuf
[
len
]
=
'\0'
;
item
=
lang_find_or_insert
(
strbuf
);
item
=
lang_find_or_insert
(
strbuf
);
...
@@ -720,7 +720,7 @@ static bool
...
@@ -720,7 +720,7 @@ static bool
parse_uint
(
const
char
**
pp
,
const
char
*
end
,
unsigned
int
*
pv
)
parse_uint
(
const
char
**
pp
,
const
char
*
end
,
unsigned
int
*
pv
)
{
{
char
buf
[
32
];
char
buf
[
32
];
unsigned
int
len
=
MIN
(
ARRAY_LENGTH
(
buf
)
-
1
,
(
unsigned
int
)
(
end
-
*
pp
));
unsigned
int
len
=
hb_min
(
ARRAY_LENGTH
(
buf
)
-
1
,
(
unsigned
int
)
(
end
-
*
pp
));
strncpy
(
buf
,
*
pp
,
len
);
strncpy
(
buf
,
*
pp
,
len
);
buf
[
len
]
=
'\0'
;
buf
[
len
]
=
'\0'
;
...
@@ -744,7 +744,7 @@ static bool
...
@@ -744,7 +744,7 @@ static bool
parse_uint32
(
const
char
**
pp
,
const
char
*
end
,
uint32_t
*
pv
)
parse_uint32
(
const
char
**
pp
,
const
char
*
end
,
uint32_t
*
pv
)
{
{
char
buf
[
32
];
char
buf
[
32
];
unsigned
int
len
=
MIN
(
ARRAY_LENGTH
(
buf
)
-
1
,
(
unsigned
int
)
(
end
-
*
pp
));
unsigned
int
len
=
hb_min
(
ARRAY_LENGTH
(
buf
)
-
1
,
(
unsigned
int
)
(
end
-
*
pp
));
strncpy
(
buf
,
*
pp
,
len
);
strncpy
(
buf
,
*
pp
,
len
);
buf
[
len
]
=
'\0'
;
buf
[
len
]
=
'\0'
;
...
@@ -825,7 +825,7 @@ static bool
...
@@ -825,7 +825,7 @@ static bool
parse_float
(
const
char
**
pp
,
const
char
*
end
,
float
*
pv
)
parse_float
(
const
char
**
pp
,
const
char
*
end
,
float
*
pv
)
{
{
char
buf
[
32
];
char
buf
[
32
];
unsigned
int
len
=
MIN
(
ARRAY_LENGTH
(
buf
)
-
1
,
(
unsigned
int
)
(
end
-
*
pp
));
unsigned
int
len
=
hb_min
(
ARRAY_LENGTH
(
buf
)
-
1
,
(
unsigned
int
)
(
end
-
*
pp
));
strncpy
(
buf
,
*
pp
,
len
);
strncpy
(
buf
,
*
pp
,
len
);
buf
[
len
]
=
'\0'
;
buf
[
len
]
=
'\0'
;
...
@@ -1071,21 +1071,21 @@ hb_feature_to_string (hb_feature_t *feature,
...
@@ -1071,21 +1071,21 @@ hb_feature_to_string (hb_feature_t *feature,
{
{
s
[
len
++
]
=
'['
;
s
[
len
++
]
=
'['
;
if
(
feature
->
start
)
if
(
feature
->
start
)
len
+=
MAX
(
0
,
snprintf
(
s
+
len
,
ARRAY_LENGTH
(
s
)
-
len
,
"%u"
,
feature
->
start
));
len
+=
hb_max
(
0
,
snprintf
(
s
+
len
,
ARRAY_LENGTH
(
s
)
-
len
,
"%u"
,
feature
->
start
));
if
(
feature
->
end
!=
feature
->
start
+
1
)
{
if
(
feature
->
end
!=
feature
->
start
+
1
)
{
s
[
len
++
]
=
':'
;
s
[
len
++
]
=
':'
;
if
(
feature
->
end
!=
(
unsigned
int
)
-
1
)
if
(
feature
->
end
!=
(
unsigned
int
)
-
1
)
len
+=
MAX
(
0
,
snprintf
(
s
+
len
,
ARRAY_LENGTH
(
s
)
-
len
,
"%u"
,
feature
->
end
));
len
+=
hb_max
(
0
,
snprintf
(
s
+
len
,
ARRAY_LENGTH
(
s
)
-
len
,
"%u"
,
feature
->
end
));
}
}
s
[
len
++
]
=
']'
;
s
[
len
++
]
=
']'
;
}
}
if
(
feature
->
value
>
1
)
if
(
feature
->
value
>
1
)
{
{
s
[
len
++
]
=
'='
;
s
[
len
++
]
=
'='
;
len
+=
MAX
(
0
,
snprintf
(
s
+
len
,
ARRAY_LENGTH
(
s
)
-
len
,
"%u"
,
feature
->
value
));
len
+=
hb_max
(
0
,
snprintf
(
s
+
len
,
ARRAY_LENGTH
(
s
)
-
len
,
"%u"
,
feature
->
value
));
}
}
assert
(
len
<
ARRAY_LENGTH
(
s
));
assert
(
len
<
ARRAY_LENGTH
(
s
));
len
=
MIN
(
len
,
size
-
1
);
len
=
hb_min
(
len
,
size
-
1
);
memcpy
(
buf
,
s
,
len
);
memcpy
(
buf
,
s
,
len
);
buf
[
len
]
=
'\0'
;
buf
[
len
]
=
'\0'
;
}
}
...
@@ -1152,10 +1152,10 @@ hb_variation_to_string (hb_variation_t *variation,
...
@@ -1152,10 +1152,10 @@ hb_variation_to_string (hb_variation_t *variation,
while
(
len
&&
s
[
len
-
1
]
==
' '
)
while
(
len
&&
s
[
len
-
1
]
==
' '
)
len
--
;
len
--
;
s
[
len
++
]
=
'='
;
s
[
len
++
]
=
'='
;
len
+=
MAX
(
0
,
snprintf
(
s
+
len
,
ARRAY_LENGTH
(
s
)
-
len
,
"%g"
,
(
double
)
variation
->
value
));
len
+=
hb_max
(
0
,
snprintf
(
s
+
len
,
ARRAY_LENGTH
(
s
)
-
len
,
"%g"
,
(
double
)
variation
->
value
));
assert
(
len
<
ARRAY_LENGTH
(
s
));
assert
(
len
<
ARRAY_LENGTH
(
s
));
len
=
MIN
(
len
,
size
-
1
);
len
=
hb_min
(
len
,
size
-
1
);
memcpy
(
buf
,
s
,
len
);
memcpy
(
buf
,
s
,
len
);
buf
[
len
]
=
'\0'
;
buf
[
len
]
=
'\0'
;
}
}
...
...
src/hb-coretext.cc
浏览文件 @
41248cce
...
@@ -771,7 +771,7 @@ resize_and_retry:
...
@@ -771,7 +771,7 @@ resize_and_retry:
feature
.
start
<
chars_len
&&
feature
.
start
<
feature
.
end
)
feature
.
start
<
chars_len
&&
feature
.
start
<
feature
.
end
)
{
{
CFRange
feature_range
=
CFRangeMake
(
feature
.
start
,
CFRange
feature_range
=
CFRangeMake
(
feature
.
start
,
MIN
(
feature
.
end
,
chars_len
)
-
feature
.
start
);
hb_min
(
feature
.
end
,
chars_len
)
-
feature
.
start
);
if
(
feature
.
value
)
if
(
feature
.
value
)
CFAttributedStringRemoveAttribute
(
attr_string
,
feature_range
,
kCTKernAttributeName
);
CFAttributedStringRemoveAttribute
(
attr_string
,
feature_range
,
kCTKernAttributeName
);
else
else
...
@@ -1116,7 +1116,7 @@ resize_and_retry:
...
@@ -1116,7 +1116,7 @@ resize_and_retry:
unsigned
int
cluster
=
info
[
count
-
1
].
cluster
;
unsigned
int
cluster
=
info
[
count
-
1
].
cluster
;
for
(
unsigned
int
i
=
count
-
1
;
i
>
0
;
i
--
)
for
(
unsigned
int
i
=
count
-
1
;
i
>
0
;
i
--
)
{
{
cluster
=
MIN
(
cluster
,
info
[
i
-
1
].
cluster
);
cluster
=
hb_min
(
cluster
,
info
[
i
-
1
].
cluster
);
info
[
i
-
1
].
cluster
=
cluster
;
info
[
i
-
1
].
cluster
=
cluster
;
}
}
}
}
...
@@ -1125,7 +1125,7 @@ resize_and_retry:
...
@@ -1125,7 +1125,7 @@ resize_and_retry:
unsigned
int
cluster
=
info
[
0
].
cluster
;
unsigned
int
cluster
=
info
[
0
].
cluster
;
for
(
unsigned
int
i
=
1
;
i
<
count
;
i
++
)
for
(
unsigned
int
i
=
1
;
i
<
count
;
i
++
)
{
{
cluster
=
MIN
(
cluster
,
info
[
i
].
cluster
);
cluster
=
hb_min
(
cluster
,
info
[
i
].
cluster
);
info
[
i
].
cluster
=
cluster
;
info
[
i
].
cluster
=
cluster
;
}
}
}
}
...
...
src/hb-debug.hh
浏览文件 @
41248cce
...
@@ -161,7 +161,7 @@ _hb_debug_msg_va (const char *what,
...
@@ -161,7 +161,7 @@ _hb_debug_msg_va (const char *what,
VBAR
VBAR
VBAR
VBAR
VBAR
VBAR
VBAR
VBAR
VBAR
VBAR
;
VBAR
VBAR
VBAR
VBAR
VBAR
VBAR
VBAR
VBAR
VBAR
VBAR
;
fprintf
(
stderr
,
"%2u %s"
VRBAR
"%s"
,
fprintf
(
stderr
,
"%2u %s"
VRBAR
"%s"
,
level
,
level
,
bars
+
sizeof
(
bars
)
-
1
-
MIN
((
unsigned
int
)
sizeof
(
bars
)
-
1
,
(
unsigned
int
)
(
sizeof
(
VBAR
)
-
1
)
*
level
),
bars
+
sizeof
(
bars
)
-
1
-
hb_min
((
unsigned
int
)
sizeof
(
bars
)
-
1
,
(
unsigned
int
)
(
sizeof
(
VBAR
)
-
1
)
*
level
),
level_dir
?
(
level_dir
>
0
?
DLBAR
:
ULBAR
)
:
LBAR
);
level_dir
?
(
level_dir
>
0
?
DLBAR
:
ULBAR
)
:
LBAR
);
}
else
}
else
fprintf
(
stderr
,
" "
VRBAR
LBAR
);
fprintf
(
stderr
,
" "
VRBAR
LBAR
);
...
...
src/hb-directwrite.cc
浏览文件 @
41248cce
...
@@ -778,7 +778,7 @@ retry_getglyphs:
...
@@ -778,7 +778,7 @@ retry_getglyphs:
{
{
uint32_t
*
p
=
uint32_t
*
p
=
&
vis_clusters
[
log_clusters
[
buffer
->
info
[
i
].
utf16_index
()]];
&
vis_clusters
[
log_clusters
[
buffer
->
info
[
i
].
utf16_index
()]];
*
p
=
MIN
(
*
p
,
buffer
->
info
[
i
].
cluster
);
*
p
=
hb_min
(
*
p
,
buffer
->
info
[
i
].
cluster
);
}
}
for
(
unsigned
int
i
=
1
;
i
<
glyphCount
;
i
++
)
for
(
unsigned
int
i
=
1
;
i
<
glyphCount
;
i
++
)
if
(
vis_clusters
[
i
]
==
(
uint32_t
)
-
1
)
if
(
vis_clusters
[
i
]
==
(
uint32_t
)
-
1
)
...
...
src/hb-ft.cc
浏览文件 @
41248cce
...
@@ -439,7 +439,7 @@ hb_ft_get_glyph_from_name (hb_font_t *font HB_UNUSED,
...
@@ -439,7 +439,7 @@ hb_ft_get_glyph_from_name (hb_font_t *font HB_UNUSED,
else
{
else
{
/* Make a nul-terminated version. */
/* Make a nul-terminated version. */
char
buf
[
128
];
char
buf
[
128
];
len
=
MIN
(
len
,
(
int
)
sizeof
(
buf
)
-
1
);
len
=
hb_min
(
len
,
(
int
)
sizeof
(
buf
)
-
1
);
strncpy
(
buf
,
name
,
len
);
strncpy
(
buf
,
name
,
len
);
buf
[
len
]
=
'\0'
;
buf
[
len
]
=
'\0'
;
*
glyph
=
FT_Get_Name_Index
(
ft_face
,
buf
);
*
glyph
=
FT_Get_Name_Index
(
ft_face
,
buf
);
...
...
src/hb-iter.hh
浏览文件 @
41248cce
...
@@ -464,7 +464,7 @@ struct hb_zip_iter_t :
...
@@ -464,7 +464,7 @@ struct hb_zip_iter_t :
__item_t__
__item__
()
const
{
return
__item_t__
(
*
a
,
*
b
);
}
__item_t__
__item__
()
const
{
return
__item_t__
(
*
a
,
*
b
);
}
__item_t__
__item_at__
(
unsigned
i
)
const
{
return
__item_t__
(
a
[
i
],
b
[
i
]);
}
__item_t__
__item_at__
(
unsigned
i
)
const
{
return
__item_t__
(
a
[
i
],
b
[
i
]);
}
bool
__more__
()
const
{
return
a
&&
b
;
}
bool
__more__
()
const
{
return
a
&&
b
;
}
unsigned
__len__
()
const
{
return
MIN
(
a
.
len
(),
b
.
len
());
}
unsigned
__len__
()
const
{
return
hb_min
(
a
.
len
(),
b
.
len
());
}
void
__next__
()
{
++
a
;
++
b
;
}
void
__next__
()
{
++
a
;
++
b
;
}
void
__forward__
(
unsigned
n
)
{
a
+=
n
;
b
+=
n
;
}
void
__forward__
(
unsigned
n
)
{
a
+=
n
;
b
+=
n
;
}
void
__prev__
()
{
--
a
;
--
b
;
}
void
__prev__
()
{
--
a
;
--
b
;
}
...
...
src/hb-open-file.hh
浏览文件 @
41248cce
...
@@ -94,7 +94,7 @@ typedef struct OffsetTable
...
@@ -94,7 +94,7 @@ typedef struct OffsetTable
if
(
start_offset
>=
tables
.
len
)
if
(
start_offset
>=
tables
.
len
)
*
table_count
=
0
;
*
table_count
=
0
;
else
else
*
table_count
=
MIN
<
unsigned
int
>
(
*
table_count
,
tables
.
len
-
start_offset
);
*
table_count
=
hb_min
(
*
table_count
,
tables
.
len
-
start_offset
);
const
TableRecord
*
sub_tables
=
tables
.
arrayZ
+
start_offset
;
const
TableRecord
*
sub_tables
=
tables
.
arrayZ
+
start_offset
;
unsigned
int
count
=
*
table_count
;
unsigned
int
count
=
*
table_count
;
...
...
src/hb-open-type.hh
浏览文件 @
41248cce
...
@@ -921,7 +921,7 @@ struct BinSearchHeader
...
@@ -921,7 +921,7 @@ struct BinSearchHeader
{
{
len
=
v
;
len
=
v
;
assert
(
len
==
v
);
assert
(
len
==
v
);
entrySelector
=
MAX
(
1u
,
hb_bit_storage
(
v
))
-
1
;
entrySelector
=
hb_max
(
1u
,
hb_bit_storage
(
v
))
-
1
;
searchRange
=
16
*
(
1u
<<
entrySelector
);
searchRange
=
16
*
(
1u
<<
entrySelector
);
rangeShift
=
v
*
16
>
searchRange
rangeShift
=
v
*
16
>
searchRange
?
16
*
v
-
searchRange
?
16
*
v
-
searchRange
...
...
src/hb-ot-cmap-table.hh
浏览文件 @
41248cce
...
@@ -93,7 +93,7 @@ struct CmapSubtableFormat4
...
@@ -93,7 +93,7 @@ struct CmapSubtableFormat4
this
->
length
=
get_sub_table_size
(
segments
);
this
->
length
=
get_sub_table_size
(
segments
);
this
->
segCountX2
=
segments
.
length
*
2
;
this
->
segCountX2
=
segments
.
length
*
2
;
this
->
entrySelector
=
MAX
(
1u
,
hb_bit_storage
(
segments
.
length
))
-
1
;
this
->
entrySelector
=
hb_max
(
1u
,
hb_bit_storage
(
segments
.
length
))
-
1
;
this
->
searchRange
=
2
*
(
1u
<<
this
->
entrySelector
);
this
->
searchRange
=
2
*
(
1u
<<
this
->
entrySelector
);
this
->
rangeShift
=
segments
.
length
*
2
>
this
->
searchRange
this
->
rangeShift
=
segments
.
length
*
2
>
this
->
searchRange
?
2
*
segments
.
length
-
this
->
searchRange
?
2
*
segments
.
length
-
this
->
searchRange
...
@@ -348,7 +348,7 @@ struct CmapSubtableFormat4
...
@@ -348,7 +348,7 @@ struct CmapSubtableFormat4
/* Some broken fonts have too long of a "length" value.
/* Some broken fonts have too long of a "length" value.
* If that is the case, just change the value to truncate
* If that is the case, just change the value to truncate
* the subtable at the end of the blob. */
* the subtable at the end of the blob. */
uint16_t
new_length
=
(
uint16_t
)
MIN
((
uintptr_t
)
65535
,
uint16_t
new_length
=
(
uint16_t
)
hb_min
((
uintptr_t
)
65535
,
(
uintptr_t
)
(
c
->
end
-
(
uintptr_t
)
(
c
->
end
-
(
char
*
)
this
));
(
char
*
)
this
));
if
(
!
c
->
try_set
(
&
length
,
new_length
))
if
(
!
c
->
try_set
(
&
length
,
new_length
))
...
@@ -478,7 +478,7 @@ struct CmapSubtableLongSegmented
...
@@ -478,7 +478,7 @@ struct CmapSubtableLongSegmented
{
{
for
(
unsigned
int
i
=
0
;
i
<
this
->
groups
.
len
;
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
this
->
groups
.
len
;
i
++
)
{
out
->
add_range
(
this
->
groups
[
i
].
startCharCode
,
out
->
add_range
(
this
->
groups
[
i
].
startCharCode
,
MIN
((
hb_codepoint_t
)
this
->
groups
[
i
].
endCharCode
,
hb_min
((
hb_codepoint_t
)
this
->
groups
[
i
].
endCharCode
,
(
hb_codepoint_t
)
HB_UNICODE_MAX
));
(
hb_codepoint_t
)
HB_UNICODE_MAX
));
}
}
}
}
...
@@ -623,7 +623,7 @@ struct DefaultUVS : SortedArrayOf<UnicodeValueRange, HBUINT32>
...
@@ -623,7 +623,7 @@ struct DefaultUVS : SortedArrayOf<UnicodeValueRange, HBUINT32>
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
{
{
hb_codepoint_t
first
=
arrayZ
[
i
].
startUnicodeValue
;
hb_codepoint_t
first
=
arrayZ
[
i
].
startUnicodeValue
;
hb_codepoint_t
last
=
MIN
((
hb_codepoint_t
)
(
first
+
arrayZ
[
i
].
additionalCount
),
hb_codepoint_t
last
=
hb_min
((
hb_codepoint_t
)
(
first
+
arrayZ
[
i
].
additionalCount
),
(
hb_codepoint_t
)
HB_UNICODE_MAX
);
(
hb_codepoint_t
)
HB_UNICODE_MAX
);
out
->
add_range
(
first
,
last
);
out
->
add_range
(
first
,
last
);
}
}
...
...
src/hb-ot-color-cbdt-table.hh
浏览文件 @
41248cce
...
@@ -349,15 +349,15 @@ struct CBLC
...
@@ -349,15 +349,15 @@ struct CBLC
if
(
unlikely
(
!
count
))
if
(
unlikely
(
!
count
))
return
Null
(
BitmapSizeTable
);
return
Null
(
BitmapSizeTable
);
unsigned
int
requested_ppem
=
MAX
(
font
->
x_ppem
,
font
->
y_ppem
);
unsigned
int
requested_ppem
=
hb_max
(
font
->
x_ppem
,
font
->
y_ppem
);
if
(
!
requested_ppem
)
if
(
!
requested_ppem
)
requested_ppem
=
1
<<
30
;
/* Choose largest strike. */
requested_ppem
=
1
<<
30
;
/* Choose largest strike. */
unsigned
int
best_i
=
0
;
unsigned
int
best_i
=
0
;
unsigned
int
best_ppem
=
MAX
(
sizeTables
[
0
].
ppemX
,
sizeTables
[
0
].
ppemY
);
unsigned
int
best_ppem
=
hb_max
(
sizeTables
[
0
].
ppemX
,
sizeTables
[
0
].
ppemY
);
for
(
unsigned
int
i
=
1
;
i
<
count
;
i
++
)
for
(
unsigned
int
i
=
1
;
i
<
count
;
i
++
)
{
{
unsigned
int
ppem
=
MAX
(
sizeTables
[
i
].
ppemX
,
sizeTables
[
i
].
ppemY
);
unsigned
int
ppem
=
hb_max
(
sizeTables
[
i
].
ppemX
,
sizeTables
[
i
].
ppemY
);
if
((
requested_ppem
<=
ppem
&&
ppem
<
best_ppem
)
||
if
((
requested_ppem
<=
ppem
&&
ppem
<
best_ppem
)
||
(
requested_ppem
>
best_ppem
&&
ppem
>
best_ppem
))
(
requested_ppem
>
best_ppem
&&
ppem
>
best_ppem
))
{
{
...
...
src/hb-ot-color-cpal-table.hh
浏览文件 @
41248cce
...
@@ -144,7 +144,7 @@ struct CPAL
...
@@ -144,7 +144,7 @@ struct CPAL
{
{
hb_array_t
<
const
BGRAColor
>
segment_colors
=
palette_colors
.
sub_array
(
start_offset
,
*
color_count
);
hb_array_t
<
const
BGRAColor
>
segment_colors
=
palette_colors
.
sub_array
(
start_offset
,
*
color_count
);
/* Always return numColors colors per palette even if it has out-of-bounds start index. */
/* Always return numColors colors per palette even if it has out-of-bounds start index. */
unsigned
int
count
=
MIN
<
unsigned
int
>
(
MAX
<
int
>
(
numColors
-
start_offset
,
0
),
*
color_count
);
unsigned
int
count
=
hb_min
((
unsigned
)
hb_max
((
int
)
(
numColors
-
start_offset
)
,
0
),
*
color_count
);
*
color_count
=
count
;
*
color_count
=
count
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
colors
[
i
]
=
segment_colors
[
i
];
/* Bound-checked read. */
colors
[
i
]
=
segment_colors
[
i
];
/* Bound-checked read. */
...
...
src/hb-ot-color-sbix-table.hh
浏览文件 @
41248cce
...
@@ -175,7 +175,7 @@ struct sbix
...
@@ -175,7 +175,7 @@ struct sbix
if
(
unlikely
(
!
count
))
if
(
unlikely
(
!
count
))
return
Null
(
SBIXStrike
);
return
Null
(
SBIXStrike
);
unsigned
int
requested_ppem
=
MAX
(
font
->
x_ppem
,
font
->
y_ppem
);
unsigned
int
requested_ppem
=
hb_max
(
font
->
x_ppem
,
font
->
y_ppem
);
if
(
!
requested_ppem
)
if
(
!
requested_ppem
)
requested_ppem
=
1
<<
30
;
/* Choose largest strike. */
requested_ppem
=
1
<<
30
;
/* Choose largest strike. */
/* TODO Add DPI sensitivity as well? */
/* TODO Add DPI sensitivity as well? */
...
...
src/hb-ot-glyf-table.hh
浏览文件 @
41248cce
...
@@ -58,7 +58,7 @@ struct loca
...
@@ -58,7 +58,7 @@ struct loca
public:
public:
DEFINE_SIZE_MIN
(
0
);
/* In reality, this is UNBOUNDED() type; but since we always
DEFINE_SIZE_MIN
(
0
);
/* In reality, this is UNBOUNDED() type; but since we always
* check the size externally, allow Null() object of it by
* check the size externally, allow Null() object of it by
* defining it
MIN()
instead. */
* defining it
_MIN
instead. */
};
};
...
@@ -241,7 +241,7 @@ struct glyf
...
@@ -241,7 +241,7 @@ struct glyf
loca_table
=
hb_sanitize_context_t
().
reference_table
<
loca
>
(
face
);
loca_table
=
hb_sanitize_context_t
().
reference_table
<
loca
>
(
face
);
glyf_table
=
hb_sanitize_context_t
().
reference_table
<
glyf
>
(
face
);
glyf_table
=
hb_sanitize_context_t
().
reference_table
<
glyf
>
(
face
);
num_glyphs
=
MAX
(
1u
,
loca_table
.
get_length
()
/
(
short_offset
?
2
:
4
))
-
1
;
num_glyphs
=
hb_max
(
1u
,
loca_table
.
get_length
()
/
(
short_offset
?
2
:
4
))
-
1
;
}
}
void
fini
()
void
fini
()
...
@@ -451,10 +451,10 @@ struct glyf
...
@@ -451,10 +451,10 @@ struct glyf
const
GlyphHeader
&
glyph_header
=
StructAtOffset
<
GlyphHeader
>
(
glyf_table
,
start_offset
);
const
GlyphHeader
&
glyph_header
=
StructAtOffset
<
GlyphHeader
>
(
glyf_table
,
start_offset
);
extents
->
x_bearing
=
MIN
(
glyph_header
.
xMin
,
glyph_header
.
xMax
);
extents
->
x_bearing
=
hb_min
(
glyph_header
.
xMin
,
glyph_header
.
xMax
);
extents
->
y_bearing
=
MAX
(
glyph_header
.
yMin
,
glyph_header
.
yMax
);
extents
->
y_bearing
=
hb_max
(
glyph_header
.
yMin
,
glyph_header
.
yMax
);
extents
->
width
=
MAX
(
glyph_header
.
xMin
,
glyph_header
.
xMax
)
-
extents
->
x_bearing
;
extents
->
width
=
hb_max
(
glyph_header
.
xMin
,
glyph_header
.
xMax
)
-
extents
->
x_bearing
;
extents
->
height
=
MIN
(
glyph_header
.
yMin
,
glyph_header
.
yMax
)
-
extents
->
y_bearing
;
extents
->
height
=
hb_min
(
glyph_header
.
yMin
,
glyph_header
.
yMax
)
-
extents
->
y_bearing
;
return
true
;
return
true
;
}
}
...
@@ -471,7 +471,7 @@ struct glyf
...
@@ -471,7 +471,7 @@ struct glyf
public:
public:
DEFINE_SIZE_MIN
(
0
);
/* In reality, this is UNBOUNDED() type; but since we always
DEFINE_SIZE_MIN
(
0
);
/* In reality, this is UNBOUNDED() type; but since we always
* check the size externally, allow Null() object of it by
* check the size externally, allow Null() object of it by
* defining it
MIN()
instead. */
* defining it
_MIN
instead. */
};
};
struct
glyf_accelerator_t
:
glyf
::
accelerator_t
{};
struct
glyf_accelerator_t
:
glyf
::
accelerator_t
{};
...
...
src/hb-ot-hmtx-table.hh
浏览文件 @
41248cce
...
@@ -240,7 +240,7 @@ struct hmtxvmtx
...
@@ -240,7 +240,7 @@ struct hmtxvmtx
return
default_advance
;
return
default_advance
;
}
}
return
table
->
longMetricZ
[
MIN
(
glyph
,
(
uint32_t
)
num_advances
-
1
)].
advance
;
return
table
->
longMetricZ
[
hb_min
(
glyph
,
(
uint32_t
)
num_advances
-
1
)].
advance
;
}
}
unsigned
int
get_advance
(
hb_codepoint_t
glyph
,
unsigned
int
get_advance
(
hb_codepoint_t
glyph
,
...
...
src/hb-ot-layout-gpos-table.hh
浏览文件 @
41248cce
...
@@ -1287,7 +1287,7 @@ struct MarkLigPosFormat1
...
@@ -1287,7 +1287,7 @@ struct MarkLigPosFormat1
unsigned
int
mark_id
=
_hb_glyph_info_get_lig_id
(
&
buffer
->
cur
());
unsigned
int
mark_id
=
_hb_glyph_info_get_lig_id
(
&
buffer
->
cur
());
unsigned
int
mark_comp
=
_hb_glyph_info_get_lig_comp
(
&
buffer
->
cur
());
unsigned
int
mark_comp
=
_hb_glyph_info_get_lig_comp
(
&
buffer
->
cur
());
if
(
lig_id
&&
lig_id
==
mark_id
&&
mark_comp
>
0
)
if
(
lig_id
&&
lig_id
==
mark_id
&&
mark_comp
>
0
)
comp_index
=
MIN
(
comp_count
,
_hb_glyph_info_get_lig_comp
(
&
buffer
->
cur
()))
-
1
;
comp_index
=
hb_min
(
comp_count
,
_hb_glyph_info_get_lig_comp
(
&
buffer
->
cur
()))
-
1
;
else
else
comp_index
=
comp_count
-
1
;
comp_index
=
comp_count
-
1
;
...
...
src/hb-ot-layout-gsub-table.hh
浏览文件 @
41248cce
...
@@ -484,7 +484,7 @@ struct AlternateSet
...
@@ -484,7 +484,7 @@ struct AlternateSet
unsigned
int
shift
=
hb_ctz
(
lookup_mask
);
unsigned
int
shift
=
hb_ctz
(
lookup_mask
);
unsigned
int
alt_index
=
((
lookup_mask
&
glyph_mask
)
>>
shift
);
unsigned
int
alt_index
=
((
lookup_mask
&
glyph_mask
)
>>
shift
);
/* If alt_index is MAX, randomize feature if it is the rand feature. */
/* If alt_index is MAX
_VALUE
, randomize feature if it is the rand feature. */
if
(
alt_index
==
HB_OT_MAP_MAX_VALUE
&&
c
->
random
)
if
(
alt_index
==
HB_OT_MAP_MAX_VALUE
&&
c
->
random
)
alt_index
=
c
->
random_number
()
%
count
+
1
;
alt_index
=
c
->
random_number
()
%
count
+
1
;
...
@@ -792,7 +792,7 @@ struct LigatureSet
...
@@ -792,7 +792,7 @@ struct LigatureSet
if
(
unlikely
(
!
ligature
.
serialize
(
c
,
ligatures
.
length
)))
return_trace
(
false
);
if
(
unlikely
(
!
ligature
.
serialize
(
c
,
ligatures
.
length
)))
return_trace
(
false
);
for
(
unsigned
int
i
=
0
;
i
<
ligatures
.
length
;
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
ligatures
.
length
;
i
++
)
{
{
unsigned
int
component_count
=
MAX
<
int
>
(
component_count_list
[
i
]
-
1
,
0
);
unsigned
int
component_count
=
(
unsigned
)
hb_max
((
int
)
component_count_list
[
i
]
-
1
,
0
);
if
(
unlikely
(
!
ligature
[
i
].
serialize
(
c
,
this
)
if
(
unlikely
(
!
ligature
[
i
].
serialize
(
c
,
this
)
.
serialize
(
c
,
.
serialize
(
c
,
ligatures
[
i
],
ligatures
[
i
],
...
...
src/hb-ot-layout-gsubgpos.hh
浏览文件 @
41248cce
...
@@ -973,7 +973,7 @@ static inline bool ligate_input (hb_ot_apply_context_t *c,
...
@@ -973,7 +973,7 @@ static inline bool ligate_input (hb_ot_apply_context_t *c,
if
(
this_comp
==
0
)
if
(
this_comp
==
0
)
this_comp
=
last_num_components
;
this_comp
=
last_num_components
;
unsigned
int
new_lig_comp
=
components_so_far
-
last_num_components
+
unsigned
int
new_lig_comp
=
components_so_far
-
last_num_components
+
MIN
(
this_comp
,
last_num_components
);
hb_min
(
this_comp
,
last_num_components
);
_hb_glyph_info_set_lig_props_for_mark
(
&
buffer
->
cur
(),
lig_id
,
new_lig_comp
);
_hb_glyph_info_set_lig_props_for_mark
(
&
buffer
->
cur
(),
lig_id
,
new_lig_comp
);
}
}
buffer
->
next_glyph
();
buffer
->
next_glyph
();
...
@@ -995,7 +995,7 @@ static inline bool ligate_input (hb_ot_apply_context_t *c,
...
@@ -995,7 +995,7 @@ static inline bool ligate_input (hb_ot_apply_context_t *c,
if
(
!
this_comp
)
if
(
!
this_comp
)
break
;
break
;
unsigned
int
new_lig_comp
=
components_so_far
-
last_num_components
+
unsigned
int
new_lig_comp
=
components_so_far
-
last_num_components
+
MIN
(
this_comp
,
last_num_components
);
hb_min
(
this_comp
,
last_num_components
);
_hb_glyph_info_set_lig_props_for_mark
(
&
buffer
->
info
[
i
],
lig_id
,
new_lig_comp
);
_hb_glyph_info_set_lig_props_for_mark
(
&
buffer
->
info
[
i
],
lig_id
,
new_lig_comp
);
}
else
}
else
break
;
break
;
...
@@ -1173,7 +1173,7 @@ static inline bool apply_lookup (hb_ot_apply_context_t *c,
...
@@ -1173,7 +1173,7 @@ static inline bool apply_lookup (hb_ot_apply_context_t *c,
else
else
{
{
/* NOTE: delta is negative. */
/* NOTE: delta is negative. */
delta
=
MAX
(
delta
,
(
int
)
next
-
(
int
)
count
);
delta
=
hb_max
(
delta
,
(
int
)
next
-
(
int
)
count
);
next
-=
delta
;
next
-=
delta
;
}
}
...
...
src/hb-ot-layout.cc
浏览文件 @
41248cce
...
@@ -1735,7 +1735,7 @@ hb_ot_layout_feature_get_characters (hb_face_t *face,
...
@@ -1735,7 +1735,7 @@ hb_ot_layout_feature_get_characters (hb_face_t *face,
unsigned
int
len
=
0
;
unsigned
int
len
=
0
;
if
(
char_count
&&
characters
&&
start_offset
<
cv_params
.
characters
.
len
)
if
(
char_count
&&
characters
&&
start_offset
<
cv_params
.
characters
.
len
)
{
{
len
=
MIN
(
cv_params
.
characters
.
len
-
start_offset
,
*
char_count
);
len
=
hb_min
(
cv_params
.
characters
.
len
-
start_offset
,
*
char_count
);
for
(
unsigned
int
i
=
0
;
i
<
len
;
++
i
)
for
(
unsigned
int
i
=
0
;
i
<
len
;
++
i
)
characters
[
i
]
=
cv_params
.
characters
[
start_offset
+
i
];
characters
[
i
]
=
cv_params
.
characters
[
start_offset
+
i
];
}
}
...
...
src/hb-ot-map.cc
浏览文件 @
41248cce
...
@@ -188,12 +188,12 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m,
...
@@ -188,12 +188,12 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m,
feature_infos
[
j
].
default_value
=
feature_infos
[
i
].
default_value
;
feature_infos
[
j
].
default_value
=
feature_infos
[
i
].
default_value
;
}
else
{
}
else
{
feature_infos
[
j
].
flags
&=
~
F_GLOBAL
;
feature_infos
[
j
].
flags
&=
~
F_GLOBAL
;
feature_infos
[
j
].
max_value
=
MAX
(
feature_infos
[
j
].
max_value
,
feature_infos
[
i
].
max_value
);
feature_infos
[
j
].
max_value
=
hb_max
(
feature_infos
[
j
].
max_value
,
feature_infos
[
i
].
max_value
);
/* Inherit default_value from j */
/* Inherit default_value from j */
}
}
feature_infos
[
j
].
flags
|=
(
feature_infos
[
i
].
flags
&
F_HAS_FALLBACK
);
feature_infos
[
j
].
flags
|=
(
feature_infos
[
i
].
flags
&
F_HAS_FALLBACK
);
feature_infos
[
j
].
stage
[
0
]
=
MIN
(
feature_infos
[
j
].
stage
[
0
],
feature_infos
[
i
].
stage
[
0
]);
feature_infos
[
j
].
stage
[
0
]
=
hb_min
(
feature_infos
[
j
].
stage
[
0
],
feature_infos
[
i
].
stage
[
0
]);
feature_infos
[
j
].
stage
[
1
]
=
MIN
(
feature_infos
[
j
].
stage
[
1
],
feature_infos
[
i
].
stage
[
1
]);
feature_infos
[
j
].
stage
[
1
]
=
hb_min
(
feature_infos
[
j
].
stage
[
1
],
feature_infos
[
i
].
stage
[
1
]);
}
}
feature_infos
.
shrink
(
j
+
1
);
feature_infos
.
shrink
(
j
+
1
);
}
}
...
@@ -213,7 +213,7 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m,
...
@@ -213,7 +213,7 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m,
bits_needed
=
0
;
bits_needed
=
0
;
else
else
/* Limit bits per feature. */
/* Limit bits per feature. */
bits_needed
=
MIN
(
HB_OT_MAP_MAX_BITS
,
hb_bit_storage
(
info
->
max_value
));
bits_needed
=
hb_min
(
HB_OT_MAP_MAX_BITS
,
hb_bit_storage
(
info
->
max_value
));
if
(
!
info
->
max_value
||
next_bit
+
bits_needed
>
8
*
sizeof
(
hb_mask_t
))
if
(
!
info
->
max_value
||
next_bit
+
bits_needed
>
8
*
sizeof
(
hb_mask_t
))
continue
;
/* Feature disabled, or not enough bits. */
continue
;
/* Feature disabled, or not enough bits. */
...
...
src/hb-ot-post-table.hh
浏览文件 @
41248cce
...
@@ -131,7 +131,7 @@ struct post
...
@@ -131,7 +131,7 @@ struct post
hb_bytes_t
s
=
find_glyph_name
(
glyph
);
hb_bytes_t
s
=
find_glyph_name
(
glyph
);
if
(
!
s
.
length
)
return
false
;
if
(
!
s
.
length
)
return
false
;
if
(
!
buf_len
)
return
true
;
if
(
!
buf_len
)
return
true
;
unsigned
int
len
=
MIN
(
buf_len
-
1
,
s
.
length
);
unsigned
int
len
=
hb_min
(
buf_len
-
1
,
s
.
length
);
strncpy
(
buf
,
s
.
arrayZ
,
len
);
strncpy
(
buf
,
s
.
arrayZ
,
len
);
buf
[
len
]
=
'\0'
;
buf
[
len
]
=
'\0'
;
return
true
;
return
true
;
...
...
src/hb-ot-shape-complex-indic.cc
浏览文件 @
41248cce
...
@@ -645,7 +645,7 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan,
...
@@ -645,7 +645,7 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan,
/* Reorder characters */
/* Reorder characters */
for
(
unsigned
int
i
=
start
;
i
<
base
;
i
++
)
for
(
unsigned
int
i
=
start
;
i
<
base
;
i
++
)
info
[
i
].
indic_position
()
=
MIN
(
POS_PRE_C
,
(
indic_position_t
)
info
[
i
].
indic_position
());
info
[
i
].
indic_position
()
=
hb_min
(
POS_PRE_C
,
(
indic_position_t
)
info
[
i
].
indic_position
());
if
(
base
<
end
)
if
(
base
<
end
)
info
[
base
].
indic_position
()
=
POS_BASE_C
;
info
[
base
].
indic_position
()
=
POS_BASE_C
;
...
@@ -801,7 +801,7 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan,
...
@@ -801,7 +801,7 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan,
unsigned
int
j
=
start
+
info
[
i
].
syllable
();
unsigned
int
j
=
start
+
info
[
i
].
syllable
();
while
(
j
!=
i
)
while
(
j
!=
i
)
{
{
max
=
MAX
(
max
,
j
);
max
=
hb_max
(
max
,
j
);
unsigned
int
next
=
start
+
info
[
j
].
syllable
();
unsigned
int
next
=
start
+
info
[
j
].
syllable
();
info
[
j
].
syllable
()
=
255
;
/* So we don't process j later again. */
info
[
j
].
syllable
()
=
255
;
/* So we don't process j later again. */
j
=
next
;
j
=
next
;
...
@@ -1231,14 +1231,14 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan,
...
@@ -1231,14 +1231,14 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan,
/* Note: this merge_clusters() is intentionally *after* the reordering.
/* Note: this merge_clusters() is intentionally *after* the reordering.
* Indic matra reordering is special and tricky... */
* Indic matra reordering is special and tricky... */
buffer
->
merge_clusters
(
new_pos
,
MIN
(
end
,
base
+
1
));
buffer
->
merge_clusters
(
new_pos
,
hb_min
(
end
,
base
+
1
));
new_pos
--
;
new_pos
--
;
}
}
}
else
{
}
else
{
for
(
unsigned
int
i
=
start
;
i
<
base
;
i
++
)
for
(
unsigned
int
i
=
start
;
i
<
base
;
i
++
)
if
(
info
[
i
].
indic_position
()
==
POS_PRE_M
)
{
if
(
info
[
i
].
indic_position
()
==
POS_PRE_M
)
{
buffer
->
merge_clusters
(
i
,
MIN
(
end
,
base
+
1
));
buffer
->
merge_clusters
(
i
,
hb_min
(
end
,
base
+
1
));
break
;
break
;
}
}
}
}
...
...
src/hb-ot-shape-complex-use.cc
浏览文件 @
41248cce
...
@@ -294,7 +294,7 @@ setup_rphf_mask (const hb_ot_shape_plan_t *plan,
...
@@ -294,7 +294,7 @@ setup_rphf_mask (const hb_ot_shape_plan_t *plan,
foreach_syllable
(
buffer
,
start
,
end
)
foreach_syllable
(
buffer
,
start
,
end
)
{
{
unsigned
int
limit
=
info
[
start
].
use_category
()
==
USE_R
?
1
:
MIN
(
3u
,
end
-
start
);
unsigned
int
limit
=
info
[
start
].
use_category
()
==
USE_R
?
1
:
hb_min
(
3u
,
end
-
start
);
for
(
unsigned
int
i
=
start
;
i
<
start
+
limit
;
i
++
)
for
(
unsigned
int
i
=
start
;
i
<
start
+
limit
;
i
++
)
info
[
i
].
mask
|=
mask
;
info
[
i
].
mask
|=
mask
;
}
}
...
...
src/hb-ot-shape.cc
浏览文件 @
41248cce
...
@@ -962,12 +962,12 @@ hb_ot_shape_internal (hb_ot_shape_context_t *c)
...
@@ -962,12 +962,12 @@ hb_ot_shape_internal (hb_ot_shape_context_t *c)
c
->
buffer
->
scratch_flags
=
HB_BUFFER_SCRATCH_FLAG_DEFAULT
;
c
->
buffer
->
scratch_flags
=
HB_BUFFER_SCRATCH_FLAG_DEFAULT
;
if
(
likely
(
!
hb_unsigned_mul_overflows
(
c
->
buffer
->
len
,
HB_BUFFER_MAX_LEN_FACTOR
)))
if
(
likely
(
!
hb_unsigned_mul_overflows
(
c
->
buffer
->
len
,
HB_BUFFER_MAX_LEN_FACTOR
)))
{
{
c
->
buffer
->
max_len
=
MAX
(
c
->
buffer
->
len
*
HB_BUFFER_MAX_LEN_FACTOR
,
c
->
buffer
->
max_len
=
hb_max
(
c
->
buffer
->
len
*
HB_BUFFER_MAX_LEN_FACTOR
,
(
unsigned
)
HB_BUFFER_MAX_LEN_MIN
);
(
unsigned
)
HB_BUFFER_MAX_LEN_MIN
);
}
}
if
(
likely
(
!
hb_unsigned_mul_overflows
(
c
->
buffer
->
len
,
HB_BUFFER_MAX_OPS_FACTOR
)))
if
(
likely
(
!
hb_unsigned_mul_overflows
(
c
->
buffer
->
len
,
HB_BUFFER_MAX_OPS_FACTOR
)))
{
{
c
->
buffer
->
max_ops
=
MAX
(
c
->
buffer
->
len
*
HB_BUFFER_MAX_OPS_FACTOR
,
c
->
buffer
->
max_ops
=
hb_max
(
c
->
buffer
->
len
*
HB_BUFFER_MAX_OPS_FACTOR
,
(
unsigned
)
HB_BUFFER_MAX_OPS_MIN
);
(
unsigned
)
HB_BUFFER_MAX_OPS_MIN
);
}
}
...
...
src/hb-ot-tag.cc
浏览文件 @
41248cce
...
@@ -212,7 +212,7 @@ struct LangTag
...
@@ -212,7 +212,7 @@ struct LangTag
p
=
strchr
(
b
,
'-'
);
p
=
strchr
(
b
,
'-'
);
db
=
p
?
(
unsigned
int
)
(
p
-
b
)
:
strlen
(
b
);
db
=
p
?
(
unsigned
int
)
(
p
-
b
)
:
strlen
(
b
);
return
strncmp
(
a
,
b
,
MAX
(
da
,
db
));
return
strncmp
(
a
,
b
,
hb_max
(
da
,
db
));
}
}
int
cmp
(
const
LangTag
*
that
)
const
int
cmp
(
const
LangTag
*
that
)
const
{
return
cmp
(
that
->
language
);
}
{
return
cmp
(
that
->
language
);
}
...
...
src/hb-ot-var-avar-table.hh
浏览文件 @
41248cce
...
@@ -123,7 +123,7 @@ struct avar
...
@@ -123,7 +123,7 @@ struct avar
void
map_coords
(
int
*
coords
,
unsigned
int
coords_length
)
const
void
map_coords
(
int
*
coords
,
unsigned
int
coords_length
)
const
{
{
unsigned
int
count
=
MIN
<
unsigned
int
>
(
coords_length
,
axisCount
);
unsigned
int
count
=
hb_min
(
coords_length
,
axisCount
);
const
SegmentMaps
*
map
=
&
firstAxisSegmentMaps
;
const
SegmentMaps
*
map
=
&
firstAxisSegmentMaps
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
...
...
src/hb-ot-var-fvar-table.hh
浏览文件 @
41248cce
...
@@ -122,8 +122,8 @@ struct fvar
...
@@ -122,8 +122,8 @@ struct fvar
info
->
name_id
=
axis
.
axisNameID
;
info
->
name_id
=
axis
.
axisNameID
;
info
->
default_value
=
axis
.
defaultValue
/
65536.
;
info
->
default_value
=
axis
.
defaultValue
/
65536.
;
/* Ensure order, to simplify client math. */
/* Ensure order, to simplify client math. */
info
->
min_value
=
MIN
<
float
>
(
info
->
default_value
,
axis
.
minValue
/
65536.
);
info
->
min_value
=
hb_min
(
info
->
default_value
,
axis
.
minValue
/
65536.
);
info
->
max_value
=
MAX
<
float
>
(
info
->
default_value
,
axis
.
maxValue
/
65536.
);
info
->
max_value
=
hb_max
(
info
->
default_value
,
axis
.
maxValue
/
65536.
);
}
}
void
get_axis_info
(
unsigned
int
axis_index
,
void
get_axis_info
(
unsigned
int
axis_index
,
...
@@ -136,8 +136,8 @@ struct fvar
...
@@ -136,8 +136,8 @@ struct fvar
info
->
flags
=
(
hb_ot_var_axis_flags_t
)
(
unsigned
int
)
axis
.
flags
;
info
->
flags
=
(
hb_ot_var_axis_flags_t
)
(
unsigned
int
)
axis
.
flags
;
info
->
default_value
=
axis
.
defaultValue
/
65536.
;
info
->
default_value
=
axis
.
defaultValue
/
65536.
;
/* Ensure order, to simplify client math. */
/* Ensure order, to simplify client math. */
info
->
min_value
=
MIN
<
float
>
(
info
->
default_value
,
axis
.
minValue
/
65536.
);
info
->
min_value
=
hb_min
(
info
->
default_value
,
axis
.
minValue
/
65536.
);
info
->
max_value
=
MAX
<
float
>
(
info
->
default_value
,
axis
.
maxValue
/
65536.
);
info
->
max_value
=
hb_max
(
info
->
default_value
,
axis
.
maxValue
/
65536.
);
info
->
reserved
=
0
;
info
->
reserved
=
0
;
}
}
...
@@ -149,12 +149,12 @@ struct fvar
...
@@ -149,12 +149,12 @@ struct fvar
{
{
/* TODO Rewrite as hb_array_t<>::sub-array() */
/* TODO Rewrite as hb_array_t<>::sub-array() */
unsigned
int
count
=
axisCount
;
unsigned
int
count
=
axisCount
;
start_offset
=
MIN
(
start_offset
,
count
);
start_offset
=
hb_min
(
start_offset
,
count
);
count
-=
start_offset
;
count
-=
start_offset
;
axes_array
+=
start_offset
;
axes_array
+=
start_offset
;
count
=
MIN
(
count
,
*
axes_count
);
count
=
hb_min
(
count
,
*
axes_count
);
*
axes_count
=
count
;
*
axes_count
=
count
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
...
@@ -171,12 +171,12 @@ struct fvar
...
@@ -171,12 +171,12 @@ struct fvar
{
{
/* TODO Rewrite as hb_array_t<>::sub-array() */
/* TODO Rewrite as hb_array_t<>::sub-array() */
unsigned
int
count
=
axisCount
;
unsigned
int
count
=
axisCount
;
start_offset
=
MIN
(
start_offset
,
count
);
start_offset
=
hb_min
(
start_offset
,
count
);
count
-=
start_offset
;
count
-=
start_offset
;
axes_array
+=
start_offset
;
axes_array
+=
start_offset
;
count
=
MIN
(
count
,
*
axes_count
);
count
=
hb_min
(
count
,
*
axes_count
);
*
axes_count
=
count
;
*
axes_count
=
count
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
...
@@ -223,7 +223,7 @@ struct fvar
...
@@ -223,7 +223,7 @@ struct fvar
hb_ot_var_axis_info_t
axis
;
hb_ot_var_axis_info_t
axis
;
get_axis_info
(
axis_index
,
&
axis
);
get_axis_info
(
axis_index
,
&
axis
);
v
=
MAX
(
MIN
(
v
,
axis
.
max_value
),
axis
.
min_value
);
/* Clamp. */
v
=
hb_max
(
hb_min
(
v
,
axis
.
max_value
),
axis
.
min_value
);
/* Clamp. */
if
(
v
==
axis
.
default_value
)
if
(
v
==
axis
.
default_value
)
return
0
;
return
0
;
...
...
src/hb-sanitize.hh
浏览文件 @
41248cce
...
@@ -175,7 +175,7 @@ struct hb_sanitize_context_t :
...
@@ -175,7 +175,7 @@ struct hb_sanitize_context_t :
else
else
{
{
this
->
start
=
obj_start
;
this
->
start
=
obj_start
;
this
->
end
=
obj_start
+
MIN
<
uintptr_t
>
(
this
->
end
-
obj_start
,
obj
->
get_size
());
this
->
end
=
obj_start
+
hb_min
(
this
->
end
-
obj_start
,
obj
->
get_size
());
}
}
}
}
...
@@ -189,7 +189,7 @@ struct hb_sanitize_context_t :
...
@@ -189,7 +189,7 @@ struct hb_sanitize_context_t :
void
start_processing
()
void
start_processing
()
{
{
reset_object
();
reset_object
();
this
->
max_ops
=
MAX
((
unsigned
int
)
(
this
->
end
-
this
->
start
)
*
HB_SANITIZE_MAX_OPS_FACTOR
,
this
->
max_ops
=
hb_max
((
unsigned
int
)
(
this
->
end
-
this
->
start
)
*
HB_SANITIZE_MAX_OPS_FACTOR
,
(
unsigned
)
HB_SANITIZE_MAX_OPS_MIN
);
(
unsigned
)
HB_SANITIZE_MAX_OPS_MIN
);
this
->
edit_count
=
0
;
this
->
edit_count
=
0
;
this
->
debug_depth
=
0
;
this
->
debug_depth
=
0
;
...
...
src/hb-uniscribe.cc
浏览文件 @
41248cce
...
@@ -967,7 +967,7 @@ retry:
...
@@ -967,7 +967,7 @@ retry:
vis_clusters
[
i
]
=
(
uint32_t
)
-
1
;
vis_clusters
[
i
]
=
(
uint32_t
)
-
1
;
for
(
unsigned
int
i
=
0
;
i
<
buffer
->
len
;
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
buffer
->
len
;
i
++
)
{
uint32_t
*
p
=
&
vis_clusters
[
log_clusters
[
buffer
->
info
[
i
].
utf16_index
()]];
uint32_t
*
p
=
&
vis_clusters
[
log_clusters
[
buffer
->
info
[
i
].
utf16_index
()]];
*
p
=
MIN
(
*
p
,
buffer
->
info
[
i
].
cluster
);
*
p
=
hb_min
(
*
p
,
buffer
->
info
[
i
].
cluster
);
}
}
for
(
unsigned
int
i
=
1
;
i
<
glyphs_len
;
i
++
)
for
(
unsigned
int
i
=
1
;
i
<
glyphs_len
;
i
++
)
if
(
vis_clusters
[
i
]
==
(
uint32_t
)
-
1
)
if
(
vis_clusters
[
i
]
==
(
uint32_t
)
-
1
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录