Merge branch 'master' into var-subset

This commit is contained in:
Michiharu Ariza 2019-04-10 17:24:29 -07:00
commit 9e79285ef3
93 changed files with 47 additions and 393899 deletions

View File

@ -98,6 +98,17 @@ static const struct
operator () (const Pair& pair) const { return pair.second; }
} hb_second HB_UNUSED;
static const struct
{
template <typename T, typename T2> T
operator () (const T& a, const T2& b) const { return a <= b ? a : b; }
} hb_min HB_UNUSED;
static const struct
{
template <typename T, typename T2> T
operator () (const T& a, const T2& b) const { return a >= b ? a : b; }
} hb_max HB_UNUSED;
/*
* Bithacks.

View File

@ -43,11 +43,18 @@ struct hb_array_t : hb_iter_with_fallback_t<hb_array_t<Type>, Type&>
* Constructors.
*/
hb_array_t () : arrayZ (nullptr), length (0) {}
hb_array_t (const hb_array_t<Type> &o) : arrayZ (o.arrayZ), length (o.length) {}
template <typename U = Type, hb_enable_if (hb_is_const (U))>
hb_array_t (const hb_array_t<hb_remove_const (Type)> &o) : arrayZ (o.arrayZ), length (o.length) {}
hb_array_t (Type *array_, unsigned int length_) : arrayZ (array_), length (length_) {}
template <unsigned int length_> hb_array_t (Type (&array_)[length_]) : arrayZ (array_), length (length_) {}
template <typename U = Type, hb_enable_if (hb_is_const (U))>
hb_array_t& operator = (const hb_array_t<hb_remove_const (Type)> &o)
{ arrayZ = o.arrayZ; length = o.length; return *this; }
hb_array_t& operator = (const hb_array_t &o)
{ arrayZ = o.arrayZ; length = o.length; return *this; }
/*
* Iterator implementation.
*/

View File

@ -30,7 +30,7 @@
* http://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html
* https://www.oracle.com/technetwork/articles/servers-storage-dev/standardheaderfiles-453865.html
*/
#ifndef _POSIX_C_SOURCE
#if !defined(_POSIX_C_SOURCE) && !defined(_MSC_VER)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-macros"
#define _POSIX_C_SOURCE 200809L

View File

@ -1069,7 +1069,7 @@ resize_and_retry:
if (false)
{
/* Make sure all runs had the expected direction. */
bool backward = HB_DIRECTION_IS_BACKWARD (buffer->props.direction);
HB_UNUSED bool backward = HB_DIRECTION_IS_BACKWARD (buffer->props.direction);
assert (bool (status_and & kCTRunStatusRightToLeft) == backward);
assert (bool (status_or & kCTRunStatusRightToLeft) == backward);
}

View File

@ -202,15 +202,18 @@ struct hb_iter_with_fallback_t :
/* hb_is_iterable() */
template<typename T, typename B>
struct _hb_is_iterable
{ enum { value = false }; };
template<typename T>
struct _hb_is_iterable<T, hb_bool_tt<true || sizeof (hb_declval (T).iter ())> >
{ enum { value = true }; };
template <typename T>
struct hb_is_iterable
{
private:
template <typename U>
static auto test (int) -> decltype (hb_declval (U).iter (), hb_true_t ());
template <typename>
static hb_false_t test (...);
template<typename T>
struct hb_is_iterable { enum { value = _hb_is_iterable<T, hb_true_t>::value }; };
public:
enum { value = decltype (test<T> (0))::value };
};
#define hb_is_iterable(Iterable) hb_is_iterable<Iterable>::value
/* TODO Add hb_is_iterable_of().

View File

@ -92,15 +92,18 @@ template <bool b> struct hb_bool_tt { enum { value = b }; };
typedef hb_bool_tt<true> hb_true_t;
typedef hb_bool_tt<false> hb_false_t;
template<bool B, typename T = void>
struct hb_enable_if {};
template<typename T>
struct hb_enable_if<true, T> { typedef T type; };
#define hb_enable_if(Cond) typename hb_enable_if<(Cond)>::type* = nullptr
template <typename T, typename T2>
struct hb_is_same : hb_false_t {};
template <typename T>
struct hb_is_same<T, T> : hb_true_t {};
#define hb_is_same(T, T2) hb_is_same<T, T2>::value
/*
* Meta-functions.

View File

@ -538,7 +538,7 @@ struct FDSelect0 {
template <typename GID_TYPE, typename FD_TYPE>
struct FDSelect3_4_Range {
bool sanitize (hb_sanitize_context_t *c, const void */*nullptr*/, unsigned int fdcount) const
bool sanitize (hb_sanitize_context_t *c, const void * /*nullptr*/, unsigned int fdcount) const
{
TRACE_SANITIZE (this);
return_trace (first < c->get_num_glyphs () && (fd < fdcount));

View File

@ -1219,8 +1219,8 @@ struct ClassDefFormat1
return_trace (true);
}
hb_codepoint_t glyph_min = glyphs[0];
hb_codepoint_t glyph_max = glyphs[glyphs.length - 1];
hb_codepoint_t glyph_min = +glyphs | hb_reduce (hb_min, 0xFFFFu);
hb_codepoint_t glyph_max = +glyphs | hb_reduce (hb_max, 0u);
startGlyph = glyph_min;
classValue.len = glyph_max - glyph_min + 1;
@ -1511,8 +1511,8 @@ struct ClassDef
unsigned int format = 2;
if (likely (glyphs))
{
hb_codepoint_t glyph_min = glyphs[0];
hb_codepoint_t glyph_max = glyphs[glyphs.length - 1];
hb_codepoint_t glyph_min = +glyphs | hb_reduce (hb_min, 0xFFFFu);
hb_codepoint_t glyph_max = +glyphs | hb_reduce (hb_max, 0u);
unsigned int count = glyphs.len ();
unsigned int num_ranges = 1;

View File

@ -323,6 +323,9 @@ struct hb_serialize_context_t
return ret;
}
void
err_ran_out_of_room () { this->ran_out_of_room = true; }
template <typename Type>
Type *allocate_size (unsigned int size)
{
@ -330,7 +333,7 @@ struct hb_serialize_context_t
if (this->tail - this->head < ptrdiff_t (size))
{
this->ran_out_of_room = true;
err_ran_out_of_room ();
this->successful = false;
return nullptr;
}

View File

@ -1,5 +1,5 @@
FONTS:
SourceHanSans-Regular.otf
SourceHanSans-Regular_subset.otf
PROFILES:
default.txt