- UTF-8 works on Windows as well

- We even spit out the right usepackage chant



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15385 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Asger Ottar Alstrup 2006-10-19 19:28:27 +00:00
parent a2933867d1
commit 8e17851d87
3 changed files with 35 additions and 27 deletions

View File

@ -839,26 +839,32 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
texrow.newline(); texrow.newline();
} }
if (inputenc == "auto") { // TODO: Some people want to support more encodings than UTF-8. They can have a field day around here
string const doc_encoding = if (true) {
language->encoding()->latexName(); os << "\\usepackage[utf8]{inputenc}\n";
// Create a list with all the input encodings used
// in the document
std::set<string> encodings =
features.getEncodingSet(doc_encoding);
os << "\\usepackage[";
std::set<string>::const_iterator it = encodings.begin();
std::set<string>::const_iterator const end = encodings.end();
for (; it != end; ++it)
os << lyx::from_ascii(*it) << ',';
os << lyx::from_ascii(doc_encoding) << "]{inputenc}\n";
texrow.newline();
} else if (inputenc != "default") {
os << "\\usepackage[" << lyx::from_ascii(inputenc)
<< "]{inputenc}\n";
texrow.newline(); texrow.newline();
} else {
if (inputenc == "auto") {
string const doc_encoding =
language->encoding()->latexName();
// Create a list with all the input encodings used
// in the document
std::set<string> encodings =
features.getEncodingSet(doc_encoding);
os << "\\usepackage[";
std::set<string>::const_iterator it = encodings.begin();
std::set<string>::const_iterator const end = encodings.end();
for (; it != end; ++it)
os << lyx::from_ascii(*it) << ',';
os << lyx::from_ascii(doc_encoding) << "]{inputenc}\n";
texrow.newline();
} else if (inputenc != "default") {
os << "\\usepackage[" << lyx::from_ascii(inputenc)
<< "]{inputenc}\n";
texrow.newline();
}
} }
if (use_geometry || nonstandard_papersize) { if (use_geometry || nonstandard_papersize) {

View File

@ -292,12 +292,14 @@ TeXOnePar(Buffer const & buf,
} }
} }
if (bparams.inputenc == "auto" && if (false) {
language->encoding() != previous_language->encoding()) { if (bparams.inputenc == "auto" &&
os << "\\inputencoding{" language->encoding() != previous_language->encoding()) {
<< lyx::from_ascii(language->encoding()->latexName()) os << "\\inputencoding{"
<< "}\n"; << lyx::from_ascii(language->encoding()->latexName())
texrow.newline(); << "}\n";
texrow.newline();
}
} }
// In an an inset with unlimited length (all in one row), // In an an inset with unlimited length (all in one row),

View File

@ -666,7 +666,7 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const & buf,
// I assume this is hack treating typewriter as verbatim // I assume this is hack treating typewriter as verbatim
if (font.family() == LyXFont::TYPEWRITER_FAMILY) { if (font.family() == LyXFont::TYPEWRITER_FAMILY) {
if (c != '\0') { if (c != '\0') {
os << c; os.put(c);
} }
break; break;
} }
@ -691,7 +691,7 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const & buf,
} }
if (pnr == phrases_nr && c != '\0') { if (pnr == phrases_nr && c != '\0') {
os << c; os.put(c);
} }
break; break;
} }