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,
// FIXME: change tracking
// Is this correct WRT change tracking?
Encoding const & encoding = *(runparams.encoding);
- docstring const latex1 = encoding.latexChar(next);
- docstring const latex2 = encoding.latexChar(c);
+ docstring const latex1 = encoding.latexChar(next).first;
+ docstring const latex2 = encoding.latexChar(c).first;
if (docstring(1, next) == latex1) {
// the encoding supports the combination
os << latex2 << latex1;
// Stop here if there is a font attribute or encoding change.
if (found && cit != end && prev_font != cit->font())
break;
- docstring const latex = encoding.latexChar(next);
+ docstring const latex = encoding.latexChar(next).first;
docstring::size_type const b1 =
latex.find_first_of(from_ascii("{"));
docstring::size_type const b2 =
if (style.pass_thru || runparams.pass_thru) {
if (c != '\0') {
Encoding const * const enc = runparams.encoding;
- if (enc && enc->latexChar(c, true).empty())
+ if (enc && !enc->encodable(c))
throw EncodingException(c);
os.put(c);
}
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);
+ pair<docstring, bool> latex = encoding.latexChar(c);
+ docstring nextlatex;
+ if (next != '\0' && next != META_INSET)
+ nextlatex = encoding.latexChar(next).first;
+ bool tipas = false;
+ if (runparams.inIPA) {
+ string const tipashortcut = Encodings::TIPAShortcut(c);
+ if (!tipashortcut.empty()) {
+ latex.first = from_ascii(tipashortcut);
+ latex.second = false;
+ tipas = true;
+ }
+ }
if (Encodings::isKnownScriptChar(c, script)
- && prefixIs(latex, from_ascii("\\" + script)))
- column += writeScriptChars(os, latex,
+ && prefixIs(latex.first, from_ascii("\\" + script)))
+ column += writeScriptChars(os, latex.first,
running_change, encoding, i) - 1;
- else if (latex.length() > 1 && latex[latex.length() - 1] != '}') {
+ else if (latex.second
+ && !prefixIs(nextlatex, '\\')
+ && !prefixIs(nextlatex, '{')
+ && !prefixIs(nextlatex, '}')
+ && !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.first.length() + 1;
+ os << latex.first << "{}";
+ } else {
+ column += latex.first.length();
+ os << latex.first << " ";
+ }
} else {
- column += latex.length() - 1;
- os << latex;
+ column += latex.first.length() - 1;
+ os << latex.first;
}
break;
}
}
+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)
{