summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ghostscript.com>2010-06-21 19:12:54 +0200
committerTor Andersson <tor@ghostscript.com>2010-06-21 19:12:54 +0200
commit7c2008556ad928cfa2845f1532c63dfdedbd768b (patch)
tree185b3d642255fd272bac1a4109c979ba73a29236
parentb8ff5fa4b93f0f6e7f5cd25290f7719d58930796 (diff)
downloadmupdf-7c2008556ad928cfa2845f1532c63dfdedbd768b.tar.xz
Put magic numbers in #defines.
-rw-r--r--fitz/dev_text.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/fitz/dev_text.c b/fitz/dev_text.c
index 3e0c063e..d08b2f64 100644
--- a/fitz/dev_text.c
+++ b/fitz/dev_text.c
@@ -1,5 +1,8 @@
#include "fitz.h"
+#define LINEDIST 0.9f
+#define SPACEDIST 0.25f
+
#include <ft2build.h>
#include FT_FREETYPE_H
@@ -305,17 +308,17 @@ fz_textextractspan(fz_textspan **last, fz_text *text, fz_matrix ctm, fz_point *p
dist = sqrtf(delta.x * delta.x + delta.y * delta.y);
/* Add space and newlines based on pen movement */
- if (dist > size * 0.1f)
+ if (dist > 0)
{
ndelta.x = delta.x / dist;
ndelta.y = delta.y / dist;
dot = ndelta.x * ndir.x + ndelta.y * ndir.y;
- if (dist > size * 0.9f)
+ if (dist > size * LINEDIST)
{
fz_addtextnewline(last, font, size, text->wmode);
}
- else if (fabsf(dot) > 0.95f && dist > size * 0.1f)
+ else if (fabsf(dot) > 0.95f && dist > size * SPACEDIST)
{
if ((*last)->len == 0 || (*last)->text[(*last)->len - 1].c != ' ')
{