* lib/languages:

change default for latin1-languages to latin9 (bug 845)
* src/paragraph_pimpl.C:
	add support for the subset of symbols that is only covered by
	latin1 (not latin9) to make the above switch painless.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16239 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2006-12-11 07:42:43 +00:00
parent 23366b930e
commit 9667cb3836
2 changed files with 106 additions and 52 deletions

View File

@ -1,63 +1,63 @@
# name babel name GUI name RTL? encoding code latex options # name babel name GUI name RTL? encoding code latex options
afrikaans afrikaans "Afrikaans" false iso8859-1 af_ZA "" afrikaans afrikaans "Afrikaans" false iso8859-15 af_ZA ""
american american "American" false iso8859-1 en_US "" american american "American" false iso8859-15 en_US ""
arabic arabic "Arabic" true iso8859-6 ar_SA "" arabic arabic "Arabic" true iso8859-6 ar_SA ""
austrian austrian "Austrian" false iso8859-1 de_AT "" austrian austrian "Austrian" false iso8859-15 de_AT ""
naustrian naustrian "Austrian (new spelling)" false iso8859-1 de_AT "" naustrian naustrian "Austrian (new spelling)" false iso8859-15 de_AT ""
bahasa bahasa "Bahasa" false iso8859-1 in_ID "" bahasa bahasa "Bahasa" false iso8859-15 in_ID ""
belarusian belarusian "Belarusian" false cp1251 be_BY "" belarusian belarusian "Belarusian" false cp1251 be_BY ""
basque basque "Basque" false iso8859-1 eu_ES "" basque basque "Basque" false iso8859-15 eu_ES ""
brazil brazil "Portuguese (Brazil)" false iso8859-1 pt_BR "" brazil brazil "Portuguese (Brazil)" false iso8859-15 pt_BR ""
breton breton "Breton" false iso8859-1 br_FR "" breton breton "Breton" false iso8859-15 br_FR ""
british british "British" false iso8859-1 en_GB "" british british "British" false iso8859-15 en_GB ""
bulgarian bulgarian "Bulgarian" false cp1251 bg_BG "" bulgarian bulgarian "Bulgarian" false cp1251 bg_BG ""
canadian canadian "Canadian" false iso8859-1 en_CA "" canadian canadian "Canadian" false iso8859-15 en_CA ""
canadien canadien "French Canadian" false iso8859-1 fr_CA "" canadien canadien "French Canadian" false iso8859-15 fr_CA ""
catalan catalan "Catalan" false iso8859-1 ca_ES "" catalan catalan "Catalan" false iso8859-15 ca_ES ""
croatian croatian "Croatian" false iso8859-2 hr_HR "" croatian croatian "Croatian" false iso8859-2 hr_HR ""
czech czech "Czech" false iso8859-2 cs_CZ "" czech czech "Czech" false iso8859-2 cs_CZ ""
danish danish "Danish" false iso8859-1 da_DK "" danish danish "Danish" false iso8859-15 da_DK ""
dutch dutch "Dutch" false iso8859-1 nl_NL "" dutch dutch "Dutch" false iso8859-15 nl_NL ""
english english "English" false iso8859-1 en_US "" english english "English" false iso8859-15 en_US ""
esperanto esperanto "Esperanto" false iso8859-3 eo "" esperanto esperanto "Esperanto" false iso8859-3 eo ""
#and what country code should esperanto have?? (Garst) #and what country code should esperanto have?? (Garst)
estonian estonian "Estonian" false iso8859-1 et_EE "" estonian estonian "Estonian" false iso8859-15 et_EE ""
finnish finnish "Finnish" false iso8859-1 fi_FI "" finnish finnish "Finnish" false iso8859-15 fi_FI ""
# We redefine \og and \fg (guillemets) for older french language definitions # We redefine \og and \fg (guillemets) for older french language definitions
french french "French" false iso8859-1 fr_FR "\addto\extrasfrench{\providecommand{\og}{\leavevmode\flqq~}\providecommand{\fg}{\ifdim\lastskip>\z@\unskip\fi~\frqq}}" french french "French" false iso8859-15 fr_FR "\addto\extrasfrench{\providecommand{\og}{\leavevmode\flqq~}\providecommand{\fg}{\ifdim\lastskip>\z@\unskip\fi~\frqq}}"
galician galician "Galician" false iso8859-1 gl_ES "" galician galician "Galician" false iso8859-15 gl_ES ""
# There are two Galicia's one in Spain one in E.Europe. Because of # There are two Galicia's one in Spain one in E.Europe. Because of
# the font encoding I am assuming this is the one in Spain. (Garst) # the font encoding I am assuming this is the one in Spain. (Garst)
german german "German" false iso8859-1 de_DE "" german german "German" false iso8859-15 de_DE ""
ngerman ngerman "German (new spelling)" false iso8859-1 de_DE "" ngerman ngerman "German (new spelling)" false iso8859-15 de_DE ""
greek greek "Greek" false iso8859-7 el_GR "" greek greek "Greek" false iso8859-7 el_GR ""
hebrew hebrew "Hebrew" true cp1255 he_IL "" hebrew hebrew "Hebrew" true cp1255 he_IL ""
#hungarian hungarian "Hungarian" false iso8859-2 "" "" #hungarian hungarian "Hungarian" false iso8859-2 "" ""
irish irish "Irish" false iso8859-1 ga_IE "" irish irish "Irish" false iso8859-15 ga_IE ""
italian italian "Italian" false iso8859-1 it_IT "" italian italian "Italian" false iso8859-15 it_IT ""
kazakh kazakh "Kazakh" false pt154 kk_KZ "" kazakh kazakh "Kazakh" false pt154 kk_KZ ""
#lsorbian lsorbian "Lsorbian" false iso8859-2 "" "" #lsorbian lsorbian "Lsorbian" false iso8859-2 "" ""
# no ISO listing for lsorbian (Garst) # no ISO listing for lsorbian (Garst)
lithuanian lithuanian "Lithuanian" false iso8859-13 lt_LT "" lithuanian lithuanian "Lithuanian" false iso8859-13 lt_LT ""
latvian latvian "Latvian" false iso8859-13 lv_LV "" latvian latvian "Latvian" false iso8859-13 lv_LV ""
icelandic icelandic "Icelandic" false iso8859-1 "is_IS" "" icelandic icelandic "Icelandic" false iso8859-15 "is_IS" ""
magyar magyar "Magyar" false iso8859-2 hu_HU "" magyar magyar "Magyar" false iso8859-2 hu_HU ""
norsk norsk "Norsk" false iso8859-1 nb_NO "" norsk norsk "Norsk" false iso8859-15 nb_NO ""
nynorsk nynorsk "Nynorsk" false iso8859-1 nn_NO "" nynorsk nynorsk "Nynorsk" false iso8859-15 nn_NO ""
polish polish "Polish" false iso8859-2 pl_PL "" polish polish "Polish" false iso8859-2 pl_PL ""
portuges portuges "Portugese" false iso8859-1 pt_PT "" portuges portuges "Portugese" false iso8859-15 pt_PT ""
romanian romanian "Romanian" false iso8859-2 ro_RO "" romanian romanian "Romanian" false iso8859-2 ro_RO ""
russian russian "Russian" false koi8 ru_RU "" russian russian "Russian" false koi8 ru_RU ""
scottish scottish "Scottish" false iso8859-1 gd_GB "" scottish scottish "Scottish" false iso8859-15 gd_GB ""
serbian croatian "Serbian" false iso8859-5 sr_HR "" serbian croatian "Serbian" false iso8859-5 sr_HR ""
serbocroatian croatian "Serbo-Croatian" false iso8859-2 sh_HR "" serbocroatian croatian "Serbo-Croatian" false iso8859-2 sh_HR ""
spanish spanish "Spanish" false iso8859-1 es_ES "\deactivatetilden" spanish spanish "Spanish" false iso8859-15 es_ES "\deactivatetilden"
slovak slovak "Slovak" false iso8859-2 sk_SK "" slovak slovak "Slovak" false iso8859-2 sk_SK ""
slovene slovene "Slovene" false iso8859-2 sl_SI "" slovene slovene "Slovene" false iso8859-2 sl_SI ""
swedish swedish "Swedish" false iso8859-1 sv_SE "" swedish swedish "Swedish" false iso8859-15 sv_SE ""
thai thai "Thai" false tis620-0 th_TH "\usepackage{thswitch}" thai thai "Thai" false tis620-0 th_TH "\usepackage{thswitch}"
turkish turkish "Turkish" false iso8859-9 tr_TR "" turkish turkish "Turkish" false iso8859-9 tr_TR ""
ukrainian ukrainian "Ukrainian" false koi8-u uk_UA "" ukrainian ukrainian "Ukrainian" false koi8-u uk_UA ""
#usorbian usorbian "Usorbian" false iso8859-2 "" "" #usorbian usorbian "Usorbian" false iso8859-2 "" ""
# no ISO listing for usorbian (Garst) # no ISO listing for usorbian (Garst)
welsh welsh "Welsh" false iso8859-1 cy_GB "" welsh welsh "Welsh" false iso8859-15 cy_GB ""

View File

@ -58,6 +58,15 @@ special_phrase const special_phrases[] = {
size_t const phrases_nr = sizeof(special_phrases)/sizeof(special_phrase); size_t const phrases_nr = sizeof(special_phrases)/sizeof(special_phrase);
bool isEncoding(BufferParams const & bparams, LyXFont const & font,
string const & encoding)
{
return (bparams.inputenc == encoding
|| (bparams.inputenc == "auto"
&& font.language()->encoding()->latexName() == encoding));
}
} // namespace anon } // namespace anon
@ -569,13 +578,8 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const & buf,
case 0xb9: // ¹ SUPERSCRIPT ONE case 0xb9: // ¹ SUPERSCRIPT ONE
case 0xac: // ¬ NOT SIGN case 0xac: // ¬ NOT SIGN
case 0xb5: // µ MICRO SIGN case 0xb5: // µ MICRO SIGN
if ((bparams.inputenc == "latin1" || if (isEncoding(bparams, font, "latin1")
bparams.inputenc == "latin9") || || isEncoding(bparams, font, "latin9")) {
(bparams.inputenc == "auto" &&
(font.language()->encoding()->latexName()
== "latin1" ||
font.language()->encoding()->latexName()
== "latin9"))) {
os << "\\ensuremath{"; os << "\\ensuremath{";
os.put(c); os.put(c);
os << '}'; os << '}';
@ -652,16 +656,9 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const & buf,
break; break;
case 0x20ac: // EURO SIGN case 0x20ac: // EURO SIGN
if ((bparams.inputenc == "latin9" || if (isEncoding(bparams, font, "latin9")
bparams.inputenc == "cp1251"|| || isEncoding(bparams, font, "cp1251")
bparams.inputenc == "utf8") || || isEncoding(bparams, font, "utf8")) {
(bparams.inputenc == "auto" &&
(font.language()->encoding()->latexName()
== "latin9" ||
font.language()->encoding()->latexName()
== "cp1251"||
font.language()->encoding()->latexName()
== "utf8"))) {
os.put(c); os.put(c);
} else { } else {
os << "\\texteuro{}"; os << "\\texteuro{}";
@ -669,6 +666,60 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const & buf,
} }
break; break;
// These characters are covered by latin1, but not
// by latin9 (a.o.). We have to support them because
// we switched the default of latin1-languages to latin9
case 0xa4: // CURRENCY SYMBOL
case 0xa6: // BROKEN BAR
case 0xa8: // DIAERESIS
case 0xb4: // ACUTE ACCENT
case 0xb8: // CEDILLA
case 0xbd: // 1/2 FRACTION
case 0xbc: // 1/4 FRACTION
case 0xbe: // 3/4 FRACTION
if (isEncoding(bparams, font, "latin1")
|| isEncoding(bparams, font, "latin5")
|| isEncoding(bparams, font, "utf8")) {
os.put(c);
break;
} else {
switch (c) {
case 0xa4:
os << "\\textcurrency{}";
column += 15;
break;
case 0xa6:
os << "\\textbrokenbar{}";
column += 16;
break;
case 0xa8:
os << "\\textasciidieresis{}";
column += 20;
break;
case 0xb4:
os << "\\textasciiacute{}";
column += 17;
break;
case 0xb8: // from latin1.def:
os << "\\c\\ ";
column += 3;
break;
case 0xbd:
os << "\\textonehalf{}";
column += 14;
break;
case 0xbc:
os << "\\textonequarter{}";
column += 17;
break;
case 0xbe:
os << "\\textthreequarters{}";
column += 20;
break;
}
break;
}
case '$': case '&': case '$': case '&':
case '%': case '#': case '{': case '%': case '#': case '{':
case '}': case '_': case '}': case '_':
@ -819,8 +870,11 @@ void Paragraph::Pimpl::validate(LaTeXFeatures & features,
break; break;
} }
} }
// the euro sign requires the textcomp package // these glyphs require the textcomp package
if (getChar(i) == 0x20ac) if (getChar(i) == 0x20ac || getChar(i) == 0xa4
|| getChar(i) == 0xa6 || getChar(i) == 0xa8
|| getChar(i) == 0xb4 || getChar(i) == 0xbd
|| getChar(i) == 0xbc || getChar(i) == 0xbe)
features.require("textcomp"); features.require("textcomp");
} }
} }