From 13b88d6166c24666007768672cf78fb9855db797 Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Thu, 31 Dec 2009 17:31:13 +0000 Subject: [PATCH] Fix MathML output of wide characters. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32699 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/InsetMathChar.cpp | 4 +-- src/mathed/MathStream.cpp | 59 ++++++++++++++++++++---------------- src/mathed/MathStream.h | 2 ++ 3 files changed, 37 insertions(+), 28 deletions(-) diff --git a/src/mathed/InsetMathChar.cpp b/src/mathed/InsetMathChar.cpp index 8e02c6a92c..7949c23099 100644 --- a/src/mathed/InsetMathChar.cpp +++ b/src/mathed/InsetMathChar.cpp @@ -175,10 +175,10 @@ void InsetMathChar::mathmlize(MathStream & ms) const } char const * type = - (isalpha(char_) || Encodings::isMathAlpha(char_)) + (isalpha(char_) || Encodings::isMathAlpha(char_)) ? "mi" : "mo"; // we don't use MTag and ETag because we do not want the spacing - ms << "<" << type << ">" << char(char_) << ""; + ms << "<" << type << ">" << char_type(char_) << ""; } diff --git a/src/mathed/MathStream.cpp b/src/mathed/MathStream.cpp index 9ce8f9051a..ac511dd917 100644 --- a/src/mathed/MathStream.cpp +++ b/src/mathed/MathStream.cpp @@ -250,6 +250,32 @@ MathStream::MathStream(odocstream & os) {} +void MathStream::cr() +{ + os() << '\n'; + for (int i = 0; i < tab(); ++i) + os() << ' '; +} + + +void MathStream::defer(docstring const & s) +{ + deferred_ << s; +} + + +void MathStream::defer(string const & s) +{ + deferred_ << from_utf8(s); +} + + +docstring MathStream::deferred() const +{ + return deferred_.str(); +} + + MathStream & operator<<(MathStream & ms, MathAtom const & at) { at->mathmlize(ms); @@ -278,6 +304,13 @@ MathStream & operator<<(MathStream & ms, char c) } +MathStream & operator<<(MathStream & ms, char_type c) +{ + ms.os() << c; + return ms; +} + + MathStream & operator<<(MathStream & ms, MTag const & t) { ++ms.tab(); @@ -297,32 +330,6 @@ MathStream & operator<<(MathStream & ms, ETag const & t) } -void MathStream::cr() -{ - os() << '\n'; - for (int i = 0; i < tab(); ++i) - os() << ' '; -} - - -void MathStream::defer(docstring const & s) -{ - deferred_ << s; -} - - -void MathStream::defer(string const & s) -{ - deferred_ << from_utf8(s); -} - - -docstring MathStream::deferred() const -{ - return deferred_.str(); -} - - MathStream & operator<<(MathStream & ms, docstring const & s) { ms.os() << s; diff --git a/src/mathed/MathStream.h b/src/mathed/MathStream.h index 51fbdd367e..c2eb3d2326 100644 --- a/src/mathed/MathStream.h +++ b/src/mathed/MathStream.h @@ -286,6 +286,8 @@ MathStream & operator<<(MathStream &, char const *); /// MathStream & operator<<(MathStream &, char); /// +MathStream & operator<<(MathStream &, char_type); +/// MathStream & operator<<(MathStream &, MTag const &); /// MathStream & operator<<(MathStream &, ETag const &);