From 38c29e4fa3e2decba69cb332aff1a995b1e0e560 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Fri, 9 Mar 2012 11:14:39 +0000 Subject: [PATCH] Consider specifics for TIPAs T3 font encoding and allow insertion of straight quote (stress shortcut) to IPA inset. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40893 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/Paragraph.cpp | 33 ++++++++++++++++++++++++++++++--- src/insets/InsetIPA.cpp | 16 ++++++++++++++++ src/insets/InsetIPA.h | 2 ++ 3 files changed, 48 insertions(+), 3 deletions(-) diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index 37c078b9c5..571089a607 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -345,6 +345,12 @@ public: pos_type i, unsigned int & column); /// + bool latexSpecialT3( + char_type const c, + otexstream & os, + pos_type i, + unsigned int & column); + /// bool latexSpecialTypewriter( char_type const c, otexstream & os, @@ -1169,17 +1175,21 @@ void Paragraph::Private::latexSpecialChar(otexstream & os, return; } + // TIPA uses its own T3 encoding + if (runparams.inIPA && latexSpecialT3(c, os, i, column)) + return; // If T1 font encoding is used, use the special // characters it provides. // NOTE: some languages reset the font encoding // internally - if (!running_font.language()->internalFontEncoding() + if (!runparams.inIPA && !running_font.language()->internalFontEncoding() && lyxrc.fontenc == "T1" && latexSpecialT1(c, os, i, column)) return; // \tt font needs special treatment - if (running_font.fontInfo().family() == TYPEWRITER_FAMILY - && latexSpecialTypewriter(c, os, i, column)) + if (!runparams.inIPA + && running_font.fontInfo().family() == TYPEWRITER_FAMILY + && latexSpecialTypewriter(c, os, i, column)) return; // Otherwise, we use what LaTeX provides us. @@ -1331,6 +1341,23 @@ bool Paragraph::Private::latexSpecialT1(char_type const c, otexstream & os, } +bool Paragraph::Private::latexSpecialT3(char_type const c, otexstream & os, + pos_type i, unsigned int & column) +{ + switch (c) { + case '*': + case '[': + case ']': + case '|': + case '\"': + os.put(c); + return true; + default: + return false; + } +} + + bool Paragraph::Private::latexSpecialTypewriter(char_type const c, otexstream & os, pos_type i, unsigned int & column) { diff --git a/src/insets/InsetIPA.cpp b/src/insets/InsetIPA.cpp index edee27e4b4..7363659ff7 100644 --- a/src/insets/InsetIPA.cpp +++ b/src/insets/InsetIPA.cpp @@ -63,6 +63,22 @@ void InsetIPA::write(ostream & os) const } +void InsetIPA::doDispatch(Cursor & cur, FuncRequest & cmd) +{ + switch (cmd.action()) { + case LFUN_QUOTE_INSERT: { + FuncRequest fr(LFUN_SELF_INSERT, "\""); + InsetText::doDispatch(cur, fr); + break; + } + default: + InsetText::doDispatch(cur, cmd); + break; + } + +} + + bool InsetIPA::getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus & flag) const { diff --git a/src/insets/InsetIPA.h b/src/insets/InsetIPA.h index 124516349c..4688696b99 100644 --- a/src/insets/InsetIPA.h +++ b/src/insets/InsetIPA.h @@ -55,6 +55,8 @@ public: void draw(PainterInfo & pi, int x, int y) const; + /// + void doDispatch(Cursor & cur, FuncRequest & cmd); /// bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const; -- 2.39.2