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
This commit is contained in:
Jürgen Spitzmüller 2012-03-09 11:14:39 +00:00
parent 0deee5d230
commit 38c29e4fa3
3 changed files with 48 additions and 3 deletions

View File

@ -345,6 +345,12 @@ public:
pos_type i, pos_type i,
unsigned int & column); unsigned int & column);
/// ///
bool latexSpecialT3(
char_type const c,
otexstream & os,
pos_type i,
unsigned int & column);
///
bool latexSpecialTypewriter( bool latexSpecialTypewriter(
char_type const c, char_type const c,
otexstream & os, otexstream & os,
@ -1169,16 +1175,20 @@ void Paragraph::Private::latexSpecialChar(otexstream & os,
return; 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 // If T1 font encoding is used, use the special
// characters it provides. // characters it provides.
// NOTE: some languages reset the font encoding // NOTE: some languages reset the font encoding
// internally // internally
if (!running_font.language()->internalFontEncoding() if (!runparams.inIPA && !running_font.language()->internalFontEncoding()
&& lyxrc.fontenc == "T1" && latexSpecialT1(c, os, i, column)) && lyxrc.fontenc == "T1" && latexSpecialT1(c, os, i, column))
return; return;
// \tt font needs special treatment // \tt font needs special treatment
if (running_font.fontInfo().family() == TYPEWRITER_FAMILY if (!runparams.inIPA
&& running_font.fontInfo().family() == TYPEWRITER_FAMILY
&& latexSpecialTypewriter(c, os, i, column)) && latexSpecialTypewriter(c, os, i, column))
return; return;
@ -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, bool Paragraph::Private::latexSpecialTypewriter(char_type const c, otexstream & os,
pos_type i, unsigned int & column) pos_type i, unsigned int & column)
{ {

View File

@ -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, bool InsetIPA::getStatus(Cursor & cur, FuncRequest const & cmd,
FuncStatus & flag) const FuncStatus & flag) const
{ {

View File

@ -55,6 +55,8 @@ public:
void draw(PainterInfo & pi, int x, int y) const; void draw(PainterInfo & pi, int x, int y) const;
///
void doDispatch(Cursor & cur, FuncRequest & cmd);
/// ///
bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const; bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;