summaryrefslogtreecommitdiff
path: root/include/fitz
diff options
context:
space:
mode:
Diffstat (limited to 'include/fitz')
-rw-r--r--include/fitz/font.h2
-rw-r--r--include/fitz/math.h15
2 files changed, 16 insertions, 1 deletions
diff --git a/include/fitz/font.h b/include/fitz/font.h
index 4d9fb5e8..9fd9218b 100644
--- a/include/fitz/font.h
+++ b/include/fitz/font.h
@@ -8,7 +8,7 @@ struct fz_hmtx_s
{
unsigned short lo;
unsigned short hi;
- short w;
+ int w; /* type3 fonts can be big! */
};
struct fz_vmtx_s
diff --git a/include/fitz/math.h b/include/fitz/math.h
index bcbfee00..bfc1f8e6 100644
--- a/include/fitz/math.h
+++ b/include/fitz/math.h
@@ -4,6 +4,21 @@ static inline unsigned char fz_mul255(unsigned char a, unsigned char b)
return ((a + 1) * b) >> 8;
}
+/* floor / ceil towards/from +/- inf */
+static inline float fz_floor(float x)
+{
+ if (x > 0)
+ return floor(x);
+ return ceil(x);
+}
+
+static inline float fz_ceil(float x)
+{
+ if (x > 0)
+ return ceil(x);
+ return floor(x);
+}
+
/* divide and floor towards -inf */
static inline int fz_idiv(int a, int b)
{