After r40612, the check for isFullUnicode is redundant. So, partially

revert r40607 and accordingly adapt the code.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40613 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Enrico Forestieri 2012-01-14 14:27:55 +00:00
parent 76c376c427
commit 07b2898afe
3 changed files with 21 additions and 35 deletions

View File

@ -1153,17 +1153,14 @@ docstring const LaTeXFeatures::getTClassHTMLStyles() const
namespace {
docstring const getFloatI18nPreamble(docstring const & type,
docstring const & name, Language const * lang,
Encoding const & enc, bool const polyglossia,
bool const unicode)
Encoding const & enc, bool const polyglossia)
{
// Check whether name can be encoded in the buffer encoding
bool encodable = true;
if (!unicode) {
for (size_t i = 0; i < name.size(); ++i) {
if (enc.latexChar(name[i], true)[0] != name[i]) {
encodable = false;
break;
}
for (size_t i = 0; i < name.size(); ++i) {
if (enc.latexChar(name[i], true)[0] != name[i]) {
encodable = false;
break;
}
}
@ -1201,21 +1198,18 @@ docstring const LaTeXFeatures::getTClassI18nPreamble(bool use_babel, bool use_po
// language dependent commands (once per document)
snippets.insert(tclass[*cit].langpreamble(buffer().language(),
buffer().params().encoding(),
use_polyglossia,
runparams().isFullUnicode()));
use_polyglossia));
// commands for language changing (for multilanguage documents)
if ((use_babel || use_polyglossia) && !UsedLanguages_.empty()) {
snippets.insert(tclass[*cit].babelpreamble(
buffer().language(),
buffer().params().encoding(),
use_polyglossia,
runparams().isFullUnicode()));
use_polyglossia));
for (lang_it lit = lbeg; lit != lend; ++lit)
snippets.insert(tclass[*cit].babelpreamble(
*lit,
buffer().params().encoding(),
use_polyglossia,
runparams().isFullUnicode()));
use_polyglossia));
}
}
if ((use_babel || use_polyglossia) && !UsedLanguages_.empty()) {
@ -1236,8 +1230,7 @@ docstring const LaTeXFeatures::getTClassI18nPreamble(bool use_babel, bool use_po
snippets.insert(getFloatI18nPreamble(
type, name, buffer().language(),
buffer().params().encoding(),
use_polyglossia,
runparams().isFullUnicode()));
use_polyglossia));
for (lang_it lit = lbeg; lit != lend; ++lit) {
string const code = (*lit)->code();
name = (*lit)->translateLayout(fl.name());
@ -1252,8 +1245,7 @@ docstring const LaTeXFeatures::getTClassI18nPreamble(bool use_babel, bool use_po
snippets.insert(getFloatI18nPreamble(
type, name, *lit,
buffer().params().encoding(),
use_polyglossia,
runparams().isFullUnicode()));
use_polyglossia));
}
}
}

View File

@ -862,8 +862,7 @@ void Layout::readSpacing(Lexer & lex)
namespace {
docstring const i18npreamble(Language const * lang, Encoding const & enc,
docstring const & templ, bool const polyglossia,
bool const unicode)
docstring const & templ, bool const polyglossia)
{
if (templ.empty())
return templ;
@ -876,7 +875,6 @@ docstring const i18npreamble(Language const * lang, Encoding const & enc,
// tex2lyx does not have getMessages()
LASSERT(false, /**/);
(void)enc;
(void)unicode;
#else
string const langenc = lang->encoding()->iconvName();
string const texenc = lang->encoding()->latexName();
@ -894,12 +892,10 @@ docstring const i18npreamble(Language const * lang, Encoding const & enc,
docstring const name = lang->translateLayout(key);
// Check whether name can be encoded in the buffer encoding
bool encodable = true;
if (!unicode) {
for (size_t i = 0; i < name.size(); ++i) {
if (enc.latexChar(name[i], true)[0] != name[i]) {
encodable = false;
break;
}
for (size_t i = 0; i < name.size(); ++i) {
if (enc.latexChar(name[i], true)[0] != name[i]) {
encodable = false;
break;
}
}
string const translated = encodable ? to_utf8(name)
@ -916,18 +912,16 @@ docstring const i18npreamble(Language const * lang, Encoding const & enc,
docstring const Layout::langpreamble(Language const * lang,
Encoding const & enc, bool const polyglossia,
bool const unicode) const
Encoding const & enc, bool const polyglossia) const
{
return i18npreamble(lang, enc, langpreamble_, polyglossia, unicode);
return i18npreamble(lang, enc, langpreamble_, polyglossia);
}
docstring const Layout::babelpreamble(Language const * lang,
Encoding const & enc, bool const polyglossia,
bool const unicode) const
Encoding const & enc, bool const polyglossia) const
{
return i18npreamble(lang, enc, babelpreamble_, polyglossia, unicode);
return i18npreamble(lang, enc, babelpreamble_, polyglossia);
}

View File

@ -96,10 +96,10 @@ public:
docstring const & preamble() const { return preamble_; }
/// Get language dependent macro definitions needed for this layout
/// for language \p lang
docstring const langpreamble(Language const * lang, Encoding const & enc, bool const polyglossia, bool const unicode) const;
docstring const langpreamble(Language const * lang, Encoding const & enc, bool const polyglossia) const;
/// Get language and babel dependent macro definitions needed for
/// this layout for language \p lang
docstring const babelpreamble(Language const * lang, Encoding const & enc, bool const polyglossia, bool const unicode) const;
docstring const babelpreamble(Language const * lang, Encoding const & enc, bool const polyglossia) const;
///
std::set<std::string> const & requires() const { return requires_; }
///