From 4d5fa0a3970abdc8522a098fc83263feed16bdd0 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Mon, 4 Feb 2013 23:26:58 +0000 Subject: Android: Use HTML output in reflow mode. This gets us styles. --- android/src/com/artifex/mupdfdemo/MuPDFCore.java | 27 ++++++------------------ 1 file changed, 6 insertions(+), 21 deletions(-) (limited to 'android/src') diff --git a/android/src/com/artifex/mupdfdemo/MuPDFCore.java b/android/src/com/artifex/mupdfdemo/MuPDFCore.java index b74c6593..af726760 100644 --- a/android/src/com/artifex/mupdfdemo/MuPDFCore.java +++ b/android/src/com/artifex/mupdfdemo/MuPDFCore.java @@ -38,6 +38,7 @@ public class MuPDFCore int patchW, int patchH); private native RectF[] searchPage(String text); private native TextChar[][][][] text(); + private native byte[] textAsHtml(); private native void addStrikeOutAnnotationInternal(RectF[] lines); private native int passClickEventInternal(int page, float x, float y); private native void setFocusedWidgetChoiceSelectedInternal(String [] selected); @@ -202,31 +203,15 @@ public class MuPDFCore public synchronized String html(int page) { gotoPage(page); - TextChar[][][][] chars = text(); + byte chars[] = textAsHtml(); String res = new String(); + int i; + int len = chars.length; - res += "
"; - - boolean first = true; - for (TextChar[][][] bl: chars) { - if (!first) res += "

"; - first = false; - for (TextChar[][] ln: bl) { - for (TextChar[] sp: ln) { - for (TextChar tc: sp) { - switch (tc.c) { - case '<': res += "<";break; - case '>': res += ">";break; - case '&': res += "&";break; - default: res += tc.c; - } - } - } - } + for (i = 0; i < len; i++) { + res += (char)(chars[i] & 0xFF); } - res += "

"; - return res; } -- cgit v1.2.3