diff --git a/tabulon_dxf/src/lib.rs b/tabulon_dxf/src/lib.rs
index 3e119db..27a8624 100644
--- a/tabulon_dxf/src/lib.rs
+++ b/tabulon_dxf/src/lib.rs
@@ -71,6 +71,258 @@ enum BlockChunk {
Text(i16, TextItem),
}
+fn decode_dxf_text_value(text: &str) -> String {
+ text.replace("%%c", "∅")
+ .replace("%%d", "°")
+ .replace("%%p", "±")
+ .replace("%%C", "∅")
+ .replace("%%D", "°")
+ .replace("%%P", "±")
+ .replace("%%%", "%")
+ // TODO: implement toggle underline with styled text.
+ .replace("%%u", "")
+ // TODO: implement toggle overline with styled text.
+ .replace("%%o", "")
+}
+
+fn decode_dxf_mtext_value(text: &str, extended_text: &[String]) -> String {
+ let mut combined = text.to_owned();
+ for ext in extended_text.iter() {
+ combined.push_str(ext);
+ }
+
+ // TODO: Implement a shared parser for scanning formatting codes into styled text
+ // and doing unicode substitution for special character codes.
+ // TODO: Implement start/stop underline/overline/strikethrough with styled text.
+ combined
+ .replace("%%c", "∅")
+ .replace("%%d", "°")
+ .replace("%%p", "±")
+ .replace("%%C", "∅")
+ .replace("%%D", "°")
+ .replace("%%P", "±")
+ .replace("%%%", "%")
+ .replace("\\L", "")
+ .replace("\\l", "")
+ .replace("\\O", "")
+ .replace("\\o", "")
+ .replace("\\S", "")
+ .replace("\\s", "")
+ .replace("\\P", "\n")
+ .replace("\\A1;", "")
+ .replace("\\A0;", "")
+ .replace("\\pxqc;", "")
+ .replace("\\pxql;", "")
+ .replace("\\pxqr;", "")
+}
+
+#[allow(clippy::cast_possible_truncation, reason = "It doesn't matter")]
+fn style_for_text_height(
+ styles: &BTreeMap<&str, StyleSet