diff --git a/CMakeLists.txt b/CMakeLists.txt index 66e4a8388..2a8fd8b97 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -108,7 +108,7 @@ endmacro () if (UNIX) list(APPEND CMAKE_REQUIRED_LIBRARIES m) endif () -check_funcs(atexit mprotect sysconf getpagesize mmap isatty newlocale strtod_l) +check_funcs(atexit mprotect sysconf getpagesize mmap isatty newlocale strtod_l roundf) check_include_file(unistd.h HAVE_UNISTD_H) if (${HAVE_UNISTD_H}) add_definitions(-DHAVE_UNISTD_H) diff --git a/src/hb.hh b/src/hb.hh index 0e7b890b2..3a824fdcd 100644 --- a/src/hb.hh +++ b/src/hb.hh @@ -477,6 +477,15 @@ static_assert ((sizeof (hb_var_int_t) == 4), ""); /* Size signifying variable-sized array */ #define VAR 1 +static inline double +_hb_roundf (float x) +{ + return x >= 0 ? floor ((double) x + .5) : ceil ((double) x - .5); +} +#ifndef HAVE_ROUNDF +#define roundf(x) _hb_roundf(x) +#endif + /* Endian swap, used in Windows related backends */ static inline uint16_t hb_uint16_swap (const uint16_t v) { return (v >> 8) | (v << 8); }