Merge pull request #3707 from kleisauke/workaround-gcc-bug

Fix build on GCC < 7
This commit is contained in:
Behdad Esfahbod 2022-07-06 09:38:18 -06:00 committed by GitHub
commit 2587dced4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 31 additions and 17 deletions

View File

@ -7,6 +7,9 @@
#include "PosLookup.hh" #include "PosLookup.hh"
namespace OT { namespace OT {
using Layout::GPOS_impl::PosLookup;
namespace Layout { namespace Layout {
static void static void
@ -25,10 +28,10 @@ struct GPOS : GSUBGPOS
{ {
static constexpr hb_tag_t tableTag = HB_OT_TAG_GPOS; static constexpr hb_tag_t tableTag = HB_OT_TAG_GPOS;
using Lookup = GPOS_impl::PosLookup; using Lookup = PosLookup;
const GPOS_impl::PosLookup& get_lookup (unsigned int i) const const PosLookup& get_lookup (unsigned int i) const
{ return static_cast<const GPOS_impl::PosLookup &> (GSUBGPOS::get_lookup (i)); } { return static_cast<const PosLookup &> (GSUBGPOS::get_lookup (i)); }
static inline void position_start (hb_font_t *font, hb_buffer_t *buffer); static inline void position_start (hb_font_t *font, hb_buffer_t *buffer);
static inline void position_finish_advances (hb_font_t *font, hb_buffer_t *buffer); static inline void position_finish_advances (hb_font_t *font, hb_buffer_t *buffer);
@ -37,11 +40,11 @@ struct GPOS : GSUBGPOS
bool subset (hb_subset_context_t *c) const bool subset (hb_subset_context_t *c) const
{ {
hb_subset_layout_context_t l (c, tableTag, c->plan->gpos_lookups, c->plan->gpos_langsys, c->plan->gpos_features); hb_subset_layout_context_t l (c, tableTag, c->plan->gpos_lookups, c->plan->gpos_langsys, c->plan->gpos_features);
return GSUBGPOS::subset<GPOS_impl::PosLookup> (&l); return GSUBGPOS::subset<PosLookup> (&l);
} }
bool sanitize (hb_sanitize_context_t *c) const bool sanitize (hb_sanitize_context_t *c) const
{ return GSUBGPOS::sanitize<GPOS_impl::PosLookup> (c); } { return GSUBGPOS::sanitize<PosLookup> (c); }
HB_INTERNAL bool is_blocklisted (hb_blob_t *blob, HB_INTERNAL bool is_blocklisted (hb_blob_t *blob,
hb_face_t *face) const; hb_face_t *face) const;
@ -51,7 +54,7 @@ struct GPOS : GSUBGPOS
for (unsigned i = 0; i < GSUBGPOS::get_lookup_count (); i++) for (unsigned i = 0; i < GSUBGPOS::get_lookup_count (); i++)
{ {
if (!c->gpos_lookups->has (i)) continue; if (!c->gpos_lookups->has (i)) continue;
const GPOS_impl::PosLookup &l = get_lookup (i); const PosLookup &l = get_lookup (i);
l.dispatch (c); l.dispatch (c);
} }
} }
@ -59,7 +62,7 @@ struct GPOS : GSUBGPOS
void closure_lookups (hb_face_t *face, void closure_lookups (hb_face_t *face,
const hb_set_t *glyphs, const hb_set_t *glyphs,
hb_set_t *lookup_indexes /* IN/OUT */) const hb_set_t *lookup_indexes /* IN/OUT */) const
{ GSUBGPOS::closure_lookups<GPOS_impl::PosLookup> (face, glyphs, lookup_indexes); } { GSUBGPOS::closure_lookups<PosLookup> (face, glyphs, lookup_indexes); }
typedef GSUBGPOS::accelerator_t<GPOS> accelerator_t; typedef GSUBGPOS::accelerator_t<GPOS> accelerator_t;
}; };

View File

@ -5,9 +5,10 @@
#include "Common.hh" #include "Common.hh"
#include "SubstLookup.hh" #include "SubstLookup.hh"
using OT::Layout::GSUB_impl::SubstLookup;
namespace OT { namespace OT {
using Layout::GSUB_impl::SubstLookup;
namespace Layout { namespace Layout {
/* /*

View File

@ -166,8 +166,14 @@ HB_DEFINE_VTABLE (unicode_funcs);
} // namespace hb } // namespace hb
/* Workaround for GCC < 7, see:
* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480
* https://stackoverflow.com/a/25594741 */
namespace std {
template<typename T> template<typename T>
struct std::hash<hb::shared_ptr<T>> struct hash<hb::shared_ptr<T>>
{ {
std::size_t operator()(const hb::shared_ptr<T>& v) const noexcept std::size_t operator()(const hb::shared_ptr<T>& v) const noexcept
{ {
@ -177,7 +183,7 @@ struct std::hash<hb::shared_ptr<T>>
}; };
template<typename T> template<typename T>
struct std::hash<hb::unique_ptr<T>> struct hash<hb::unique_ptr<T>>
{ {
std::size_t operator()(const hb::unique_ptr<T>& v) const noexcept std::size_t operator()(const hb::unique_ptr<T>& v) const noexcept
{ {
@ -187,6 +193,8 @@ struct std::hash<hb::unique_ptr<T>>
}; };
} // namespace std
#endif /* __cplusplus */ #endif /* __cplusplus */
#endif /* HB_CPLUSPLUS_HH */ #endif /* HB_CPLUSPLUS_HH */

View File

@ -32,8 +32,8 @@
#include "OT/Layout/GPOS/GPOS.hh" #include "OT/Layout/GPOS/GPOS.hh"
namespace OT { namespace OT {
namespace Layout {
using Layout::GPOS_impl::PosLookup; namespace GPOS_impl {
// TODO(garretrieger): Move into new layout directory. // TODO(garretrieger): Move into new layout directory.
/* Out-of-class implementation for methods recursing */ /* Out-of-class implementation for methods recursing */
@ -68,6 +68,8 @@ inline bool PosLookup::dispatch_recurse_func<hb_ot_apply_context_t> (hb_ot_apply
} }
#endif #endif
} /* namespace GPOS_impl */
} /* namespace Layout */
} /* namespace OT */ } /* namespace OT */

View File

@ -32,9 +32,8 @@
#include "OT/Layout/GSUB/GSUB.hh" #include "OT/Layout/GSUB/GSUB.hh"
namespace OT { namespace OT {
namespace Layout {
using Layout::GSUB_impl::SubstLookup; namespace GSUB_impl {
using Layout::GSUB_impl::ExtensionSubst;
// TODO(garretrieger): Move into the new layout directory. // TODO(garretrieger): Move into the new layout directory.
/* Out-of-class implementation for methods recursing */ /* Out-of-class implementation for methods recursing */
@ -82,7 +81,8 @@ inline bool SubstLookup::dispatch_recurse_func<hb_ot_apply_context_t> (hb_ot_app
} }
#endif #endif
} /* namespace GSUB_impl */
} /* namespace Layout */
} /* namespace OT */ } /* namespace OT */