// We only arrive here when a proper language for character text_[i] has
// not been specified (i.e., it could not be translated in the current
- // latex encoding) and it belongs to a known script.
- // Parameter ltx contains the latex translation of text_[i] as specified in
- // the unicodesymbols file and is something like "\textXXX{<spec>}".
+ // latex encoding) or its latex translation has been forced, and it
+ // belongs to a known script.
+ // Parameter ltx contains the latex translation of text_[i] as specified
+ // in the unicodesymbols file and is something like "\textXXX{<spec>}".
// The latex macro name "textXXX" specifies the script to which text_[i]
// belongs and we use it in order to check whether characters from the
// same script immediately follow, such that we can collect them in a
docstring::size_type const brace1 = ltx.find_first_of(from_ascii("{"));
docstring::size_type const brace2 = ltx.find_last_of(from_ascii("}"));
string script = to_ascii(ltx.substr(1, brace1 - 1));
- int length = ltx.substr(0, brace2).length();
- os << ltx.substr(0, brace2);
+ int pos = 0;
+ int length = brace2;
+ bool closing_brace = true;
+ if (script == "textgreek" && encoding.latexName() == "iso-8859-7") {
+ // Correct encoding is being used, so we can avoid \textgreek.
+ pos = brace1 + 1;
+ length -= pos;
+ closing_brace = false;
+ }
+ os << ltx.substr(pos, length);
int size = text_.size();
while (i + 1 < size) {
char_type const next = text_[i + 1];
length += len;
++i;
}
- os << '}';
- ++length;
+ if (closing_brace) {
+ os << '}';
+ ++length;
+ }
return length;
}
}
if (runparams.verbatim) {
+ // FIXME UNICODE: This can fail if c cannot
+ // be encoded in the current encoding.
os.put(c);
return;
}
break;
default:
-
// LyX, LaTeX etc.
if (latexSpecialPhrase(os, i, column, runparams))
return;
{
switch (c) {
case '-':
+ // within \ttfamily, "--" is merged to "-" (no endash)
+ // so we avoid this rather irritating ligature
if (i + 1 < int(text_.size()) && text_[i + 1] == '-') {
- // "--" in Typewriter mode -> "-{}-"
os << "-{}";
column += 2;
} else
os << '-';
return true;
- // FIXME I assume this is hack treating typewriter as verbatim
- // This should be re-evaluated eventually.
-
- case '\0':
- return true;
-
-// // Those characters are not directly supported.
-// case '\\':
-// case '\"':
-// case '$': case '&':
-// case '%': case '#': case '{':
-// case '}': case '_':
-// case '~':
-// case '^':
-// case '*': case '[':
-// case ' ':
-// return false;
-
+ // everything else has to be checked separately
+ // (depending on the encoding)
default:
return false;
}
}
-bool Paragraph::forceEmptyLayout() const
+bool Paragraph::forcePlainLayout() const
{
Inset const * const inset = inInset();
if (!inset)
return true;
- return inset->forceEmptyLayout();
+ return inset->forcePlainLayout();
}
}
-bool Paragraph::useEmptyLayout() const
+bool Paragraph::usePlainLayout() const
{
Inset const * const inset = inInset();
if (!inset)
return false;
- return inset->useEmptyLayout();
+ return inset->usePlainLayout();
}
bool return_value = false;
- bool asdefault = forceEmptyLayout();
+ bool asdefault = forcePlainLayout();
Layout const & style = asdefault ?
bparams.documentClass().emptyLayout() :
}
}
- // Set the encoding to that returned from simpleTeXSpecialChars (see
+ // Set the encoding to that returned from latexSpecialChar (see
// comment for encoding member in OutputParams.h)
runparams.encoding = rp.encoding;
}
}
-void Paragraph::setEmptyOrDefaultLayout(DocumentClass const & tclass)
+void Paragraph::setPlainOrDefaultLayout(DocumentClass const & tclass)
{
- if (useEmptyLayout())
+ if (usePlainLayout())
setLayout(tclass.emptyLayout());
else
setLayout(tclass.defaultLayout());
}
+void Paragraph::setBuffer(Buffer & b)
+{
+ d->insetlist_.setBuffer(b);
+}
+
+
Inset * Paragraph::releaseInset(pos_type pos)
{
Inset * inset = d->insetlist_.release(pos);