aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabrice Di Meglio <fdimeglio@google.com>2012-01-26 16:21:33 -0800
committerFabrice Di Meglio <fdimeglio@google.com>2012-01-27 13:24:25 -0800
commitd3671e03f6c96f8498ddccd3b175005537302bb5 (patch)
tree50c28325263bc4d253325546554f934214e3cbb4
parentdb0ba8cf3183e1c6296b2d1bde2af3f83e1affc7 (diff)
downloadharfbuzz-d3671e03f6c96f8498ddccd3b175005537302bb5.tar.gz
Add Android logging to Harfbuzz
Change-Id: I680fb93599192adbf8c9895e98e3b5a98fe26247
-rw-r--r--Android.mk3
-rwxr-xr-xsrc/Makefile.am6
-rw-r--r--src/harfbuzz-debug.c21
-rw-r--r--src/harfbuzz-debug.h21
-rwxr-xr-xsrc/harfbuzz-shaper.cpp7
5 files changed, 53 insertions, 5 deletions
diff --git a/Android.mk b/Android.mk
index 691e20c..c68d62a 100644
--- a/Android.mk
+++ b/Android.mk
@@ -48,7 +48,8 @@ LOCAL_SRC_FILES:= \
src/harfbuzz-hangul.c \
src/harfbuzz-myanmar.c \
src/harfbuzz-thai.c \
- src/harfbuzz-greek.c
+ src/harfbuzz-greek.c \
+ src/harfbuzz-debug.c
LOCAL_SHARED_LIBRARIES := \
libcutils \
diff --git a/src/Makefile.am b/src/Makefile.am
index 51d0652..a4b58da 100755
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -20,7 +20,8 @@ MAINSOURCES = \
harfbuzz-arabic.c \
harfbuzz-hangul.c \
harfbuzz-myanmar.c \
- harfbuzz-thai.c
+ harfbuzz-thai.c \
+ harfbuzz-debug.c
EXTRA_SOURCES = harfbuzz.c
@@ -35,7 +36,8 @@ PUBLICHEADERS = \
harfbuzz-global.h \
harfbuzz-external.h \
harfbuzz-shaper.h \
- harfbuzz-stream.h
+ harfbuzz-stream.h \
+ harfbuzz-debug.h
PRIVATEHEADERS = \
harfbuzz-impl.h \
diff --git a/src/harfbuzz-debug.c b/src/harfbuzz-debug.c
new file mode 100644
index 0000000..cfaa48d
--- /dev/null
+++ b/src/harfbuzz-debug.c
@@ -0,0 +1,21 @@
+/*
+ * harfbuzz-debug.c
+ *
+ */
+#include "harfbuzz-debug.h"
+
+#define LOG_TAG "Harfbuzz"
+#include <utils/Log.h>
+
+void Android_Debug(const char* file, int line,
+ const char* function, const char* format, ...) {
+ if (format[0] == '\n' && format[1] == '\0')
+ return;
+ va_list args;
+ va_start(args, format);
+ android_vprintLog(ANDROID_LOG_DEBUG, NULL, LOG_TAG, format, args);
+ va_end(args);
+}
+
+
+
diff --git a/src/harfbuzz-debug.h b/src/harfbuzz-debug.h
new file mode 100644
index 0000000..15108bd
--- /dev/null
+++ b/src/harfbuzz-debug.h
@@ -0,0 +1,21 @@
+/*
+ * harfbuzz-debug.h
+ *
+ */
+
+#ifndef HARFBUZZ_DEBUG_H_
+#define HARFBUZZ_DEBUG_H_
+
+#define ANDROID_DEBUG 0
+
+#if ANDROID_DEBUG
+#define HBDebug(...) Android_Debug(__FILE__, __LINE__, \
+ __FUNCTION__, __VA_ARGS__)
+#else
+#define HBDebug
+#endif
+
+void Android_Debug(const char* file, int line, const char* function, const char* format, ...)
+ __attribute__((format(printf, 4, 5))); /* 4=format 5=params */;
+
+#endif /* HARFBUZZ_DEBUG_H_ */
diff --git a/src/harfbuzz-shaper.cpp b/src/harfbuzz-shaper.cpp
index 9b91c19..5a66d13 100755
--- a/src/harfbuzz-shaper.cpp
+++ b/src/harfbuzz-shaper.cpp
@@ -24,7 +24,9 @@
#include "harfbuzz-shaper.h"
#include "harfbuzz-shaper-private.h"
-
+extern "C" {
+#include "harfbuzz-debug.h"
+}
#include "harfbuzz-stream-private.h"
#include <assert.h>
#include <stdio.h>
@@ -818,7 +820,7 @@ static void dump_string(HB_Buffer buffer)
}
#define DEBUG printf
#else
-#define DEBUG if (1) ; else printf
+#define DEBUG HBDebug
#endif
#define DefaultLangSys 0xffff
@@ -1310,6 +1312,7 @@ HB_Bool HB_OpenTypePosition(HB_ShaperItem *item, int availableGlyphs, HB_Bool do
}
// DEBUG(" ->\tadv=%d\tpos=(%d/%d)",
// glyphs[i].advance.x.toInt(), glyphs[i].offset.x.toInt(), glyphs[i].offset.y.toInt());
+ DEBUG("Glyph offset[%d] x:%d, y: %d)", i, offsets[i].x, offsets[i].y);
}
item->kerning_applied = face->has_opentype_kerning;
} else {