~singpolyma/cheogram-android

d2e9b26069d341171b70e01f3c63a605fcc11d0f — Stephen Paul Weber 7 months ago 1077dbc
Emit alternate non breaking space in XHTML

I don't love this, but android html rendering hardcodes space collapse
so maybe it's ok for now?
1 files changed, 6 insertions(+), 0 deletions(-)

M src/cheogram/java/com/cheogram/android/SpannedToXHTML.java
M src/cheogram/java/com/cheogram/android/SpannedToXHTML.java => src/cheogram/java/com/cheogram/android/SpannedToXHTML.java +6 -0
@@ 134,10 134,16 @@ public class SpannedToXHTML {
				}
			}
			String content = text.subSequence(i, next).toString();
			boolean prevSpace = false;
			for (int c = 0; c < content.length(); c++) {
				if (content.charAt(c) == '\n') {
					prevSpace = false;
					out.addChild("br");
				} else if (prevSpace && content.charAt(c) == ' ') {
					prevSpace = false;
					out.addChild(new TextNode("\u00A0"));
				} else {
					prevSpace = content.charAt(c) == ' ';
					out.addChild(new TextNode("" + content.charAt(c)));
				}
			}