Avoid unnecessary exceptions.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_6_X@33517 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Enrico Forestieri 2010-02-19 16:33:20 +00:00
parent a03f6c9964
commit cff9254f1d
3 changed files with 12 additions and 16 deletions

View File

@ -1185,21 +1185,17 @@ void Buffer::writeLaTeXSource(odocstream & os,
// We don't know the encoding of inputpath
docstring const inputpath = from_utf8(latex_path(original_path));
docstring uncodable_glyphs;
for (size_t n = 0; n < inputpath.size(); ++n) {
docstring const glyph = docstring(1, inputpath[n]);
try {
if (runparams.encoding
&& runparams.encoding->latexChar(inputpath[n]) != glyph) {
Encoding const * const enc = runparams.encoding;
if (enc) {
for (size_t n = 0; n < inputpath.size(); ++n) {
docstring const glyph =
docstring(1, inputpath[n]);
if (enc->latexChar(inputpath[n], true) != glyph) {
LYXERR0("Uncodable character '"
<< glyph
<< "' in input path!");
uncodable_glyphs += glyph;
}
} catch (EncodingException & /* e */) {
LYXERR0("Uncodable character '"
<< glyph
<< "' in input path!");
uncodable_glyphs += glyph;
}
}
@ -1215,9 +1211,9 @@ void Buffer::writeLaTeXSource(odocstream & os,
"or change the path name."), inputpath, uncodable_glyphs));
} else {
os << "\\makeatletter\n"
<< "\\def\\input@path{{"
<< inputpath << "/}}\n"
<< "\\makeatother\n";
<< "\\def\\input@path{{"
<< inputpath << "/}}\n"
<< "\\makeatother\n";
d->texrow.newline();
d->texrow.newline();
d->texrow.newline();

View File

@ -344,7 +344,7 @@ void Encoding::init() const
}
docstring Encoding::latexChar(char_type c, bool for_mathed) const
docstring Encoding::latexChar(char_type c, bool no_commands) const
{
// assure the used encoding is properly initialized
init();
@ -355,7 +355,7 @@ docstring Encoding::latexChar(char_type c, bool for_mathed) const
return docstring(1, c);
if (encodable_.find(c) != encodable_.end())
return docstring(1, c);
if (for_mathed)
if (no_commands)
return docstring();
// c cannot (or should not) be encoded in this encoding

View File

@ -75,7 +75,7 @@ public:
* LaTeX macro is known, a warning is given of lyxerr, and the
* character is returned.
*/
docstring latexChar(char_type c, bool for_mathed = false) const;
docstring latexChar(char_type c, bool no_commands = false) const;
/// Which LaTeX package handles this encoding?
Package package() const { return package_; }
/// A list of all characters usable in this encoding