diff --git a/src/bitmap.cpp b/src/bitmap.cpp
index 5c43af5..b06517f 100644
--- a/src/bitmap.cpp
+++ b/src/bitmap.cpp
@@ -798,10 +798,28 @@ void Bitmap::drawText(int x, int y,
 	drawText(IntRect(x, y, width, height), str, align);
 }
 
+static std::string fixupString(const char *str)
+{
+	std::string s(str);
+
+	/* RMXP actually draws LF as a "missing gylph" box,
+	 * but since we might have accidentally converted CRs
+	 * to LFs when editing scripts on a Unix OS, treat them
+	 * as white space too */
+	for (size_t i = 0; i < s.size(); ++i)
+		if (s[i] == '\r' || s[i] == '\n')
+			s[i] = ' ';
+
+	return s;
+}
+
 void Bitmap::drawText(const IntRect &rect, const char *str, int align)
 {
 	GUARD_MEGA;
 
+	std::string fixed = fixupString(str);
+	str = fixed.c_str();
+
 	if (*str == '\0')
 		return;
 
@@ -1029,6 +1047,9 @@ IntRect Bitmap::textSize(const char *str)
 
 	TTF_Font *font = p->font->getSdlFont();
 
+	std::string fixed = fixupString(str);
+	str = fixed.c_str();
+
 	int w, h;
 	TTF_SizeUTF8(font, str, &w, &h);