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,
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.
return;
Encoding const & encoding = *(runparams.encoding);
+ char_type next = '\0';
if (i + 1 < int(text_.size())) {
- char_type next = text_[i + 1];
+ next = text_[i + 1];
if (Encodings::isCombiningChar(next)) {
column += latexSurrogatePair(os, c, next, runparams) - 1;
++i;
}
}
string script;
- docstring const latex = encoding.latexChar(c);
+ docstring latex = encoding.latexChar(c);
+ docstring nextlatex;
+ if (next != '\0' && next != META_INSET)
+ nextlatex = encoding.latexChar(next);
+ bool tipas = false;
+ if (runparams.inIPA) {
+ string const tipashortcut = Encodings::TIPAShortcut(c);
+ if (!tipashortcut.empty()) {
+ latex = from_ascii(tipashortcut);
+ tipas = true;
+ }
+ }
if (Encodings::isKnownScriptChar(c, script)
&& prefixIs(latex, from_ascii("\\" + script)))
column += writeScriptChars(os, latex,
running_change, encoding, i) - 1;
- else if (latex.length() > 1 && latex[latex.length() - 1] != '}') {
+ else if (Encodings::needsTermination(c)
+ && !prefixIs(nextlatex, from_ascii("\\"))
+ && !prefixIs(nextlatex, from_ascii("{"))
+ && !prefixIs(nextlatex, from_ascii("}"))
+ && latex.length() > 1 && latex[latex.length() - 1] != '}'
+ && latex[latex.length() - 1] != '-' && !tipas) {
// Prevent eating of a following
// space or command corruption by
// following characters
- column += latex.length() + 1;
- os << latex << "{}";
+ if (next == ' ' || next == '\0') {
+ column += latex.length() + 1;
+ os << latex << "{}";
+ } else {
+ column += latex.length();
+ os << latex << " ";
+ }
} else {
column += latex.length() - 1;
os << latex;
}
+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)
{