summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Zimmermann <madroach@gmerlin.de>2020-07-06 22:50:23 +0200
committerPeter Hutterer <peter.hutterer@who-t.net>2020-09-22 22:00:38 +0000
commit58cbf737557f34744b950668e3354ec2f2dae766 (patch)
tree1341d0f1fe397dc272aa50325a77e520d62e49e9
parentf8fa7919397659fb0ac5dade75152343d57f20ce (diff)
use standard C rounding functions
-rw-r--r--fonttosfnt.h11
1 files changed, 5 insertions, 6 deletions
diff --git a/fonttosfnt.h b/fonttosfnt.h
index 159535f..202ab5a 100644
--- a/fonttosfnt.h
+++ b/fonttosfnt.h
@@ -29,6 +29,7 @@ THE SOFTWARE.
#endif
#include <stdarg.h>
+#include <math.h>
#include <ft2build.h>
#include FT_FREETYPE_H
@@ -69,17 +70,15 @@ extern int reencode_flag;
#define UNITS_PER_EM 2048
-#define EPSILON 0.000000001
-#define FLOOR(x) ((x) < 0.0 ? -(int)(-(x)) : (x))
-#define CEIL(x) FLOOR((x) + 1.0 - EPSILON)
+#define UNDEF 0x80000000
/* Convert a fixed-point value into FUnits */
#define FONT_UNITS(x) \
- FLOOR(((double)(x)) / TWO_SIXTEENTH * UNITS_PER_EM + 0.5)
+ round(((double)(x)) / TWO_SIXTEENTH * UNITS_PER_EM)
#define FONT_UNITS_FLOOR(x) \
- FLOOR(((double)(x)) / TWO_SIXTEENTH * UNITS_PER_EM)
+ floor(((double)(x)) / TWO_SIXTEENTH * UNITS_PER_EM)
#define FONT_UNITS_CEIL(x) \
- CEIL(((double)(x)) / TWO_SIXTEENTH * UNITS_PER_EM)
+ ceil(((double)(x)) / TWO_SIXTEENTH * UNITS_PER_EM)
typedef struct _FontNameEntry {
int nid; /* name id */