- Fileformat change: rename "arabic" to "arabic_arabtex"

- Split the language Arabic into "arabic_arabi" that uses the arabi-package and "arabic-arabtex" that uses the arabTeX-package to typeset Arabic. This is needed because both packages have some advantages over the other people need.
(This change is a consequence of a long and fruitful discussion with Mostafa, Dov, and me.)

Patch by Dov and me.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18887 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Uwe Stöhr 2007-06-26 00:11:03 +00:00
parent 5586ef0ff6
commit d8993d2d6c
10 changed files with 60 additions and 8 deletions

View File

@ -1,6 +1,12 @@
LyX file-format changes
-----------------------
2007-06-26 Uwe Stöhr <uwestoehr@web.de> and Dov Feldstern <dov@lyx.org>
* format incremented to 276: switching exsting language 'arabic' to
'arabic_arabtex'; this is to differentiate from the new arabic support
using the arabi package.
2007-05-04 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* format incremented to 275: add graphics params scaleBeforeRotation
@ -783,3 +789,4 @@ renamed as "size_kind" and "lyxsize_kind" respectively.
\end_inset

View File

@ -1,7 +1,8 @@
# name babel name GUI name RTL? encoding code latex options
afrikaans afrikaans "Afrikaans" false iso8859-15 af_ZA ""
american american "American" false iso8859-15 en_US ""
arabic arabic "Arabic" true cp1256 ar_SA ""
arabic_arabtex "" "Arabic (ArabTeX)" true cp1256 ar_SA ""
arabic_arabi arabic "Arabic (Arabi)" true cp1256 ar_SA ""
armenian "" "Armenian" false armscii8 hy_AM ""
austrian austrian "Austrian" false iso8859-15 de_AT ""
naustrian naustrian "Austrian (new spelling)" false iso8859-15 de_AT ""

View File

@ -77,7 +77,7 @@ format_relation = [("0_06", [200], generate_minor_versions("0.6" , 4)),
("1_2", [220], generate_minor_versions("1.2" , 4)),
("1_3", [221], generate_minor_versions("1.3" , 7)),
("1_4", range(222,246), generate_minor_versions("1.4" , 4)),
("1_5", range(246,276), generate_minor_versions("1.5" , 0))]
("1_5", range(246,277), generate_minor_versions("1.5" , 0))]
def formats_list():

View File

@ -1808,6 +1808,34 @@ something
r'\end_layout'
]
def convert_arabic (document):
if document.language == "arabic":
document.language = "arabic_arabtex"
i = find_token(document.header, "\\language", 0)
if i != -1:
document.header[i] = "\\language arabic_arabtex"
i = 0
while i < len(document.body):
h = document.body[i].find("\lang arabic", 0, len(document.body[i]))
if (h != -1):
# change the language name
document.body[i] = '\lang arabic_arabtex'
i = i + 1
def revert_arabic (document):
if document.language == "arabic_arabtex":
document.language = "arabic"
i = find_token(document.header, "\\language", 0)
if i != -1:
document.header[i] = "\\language arabic"
i = 0
while i < len(document.body):
h = document.body[i].find("\lang arabic_arabtex", 0, len(document.body[i]))
if (h != -1):
# change the language name
document.body[i] = '\lang arabic'
i = i + 1
##
# Conversion hub
#
@ -1842,10 +1870,12 @@ convert = [[246, []],
[272, []],
[273, []],
[274, [normalize_font_whitespace_274]],
[275, [convert_graphics_rotation]]
[275, [convert_graphics_rotation]],
[276, [convert_arabic]]
]
revert = [
[275, [revert_arabic]],
[274, [revert_graphics_rotation]],
[273, []],
[272, [revert_separator_layout]],
@ -1882,3 +1912,4 @@ if __name__ == "__main__":
pass

View File

@ -142,7 +142,7 @@ using std::string;
namespace {
int const LYX_FORMAT = 275;
int const LYX_FORMAT = 276;
} // namespace anon

View File

@ -895,9 +895,9 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
// set font encoding
// this one is not per buffer
// for Farsi we also need to load the LAE and LFE encoding
// for arabic_arabi and farsi we also need to load the LAE and LFE encoding
if (lyxrc.fontenc != "default") {
if (language->lang() == "farsi") {
if (language->lang() == "arabic_arabi" || language->lang() == "farsi") {
os << "\\usepackage[" << from_ascii(lyxrc.fontenc)
<< ",LFE,LAE]{fontenc}\n";
texrow.newline();

View File

@ -756,6 +756,14 @@ int Font::latexWriteStartChanges(odocstream & os, BufferParams const & bparams,
base.language()->lang() == "farsi") {
os << "\\textLR{";
count += 8;
} else if (language()->lang() == "arabic_arabi") {
os << "\\textAR{";
count += 8;
} else if (!isRightToLeft() &&
base.language()->lang() == "arabic_arabi") {
os << "\\textLR{";
count += 8;
// currently the remaining RTL languages are arabic_arabtex and hebrew
} else if (isRightToLeft() != prev.isRightToLeft()) {
if (isRightToLeft()) {
os << "\\R{";

View File

@ -369,7 +369,8 @@ int Text::singleWidth(Paragraph const & par,
if (isPrintable(c)) {
Language const * language = font.language();
if (language->rightToLeft()) {
if (language->lang() == "arabic" ||
if (language->lang() == "arabic_arabtex" ||
language->lang() == "arabic_arabi" ||
language->lang() == "farsi") {
if (Encodings::isComposeChar_arabic(c))
return 0;

View File

@ -2286,6 +2286,9 @@ int Tabular::TeXRow(odocstream & os, row_type i, Buffer const & buf,
if (par.getParLanguage(buf.params())->lang() ==
"farsi")
os << "\\textFR{";
else if (par.getParLanguage(buf.params())->lang() == "arabic_arabi")
os << "\\textAR{";
// currently, remaning RTL languages are arabic_arabtex and hebrew
else
os << "\\R{";
}

View File

@ -429,7 +429,8 @@ void RowPainter::paintFromPos(pos_type & vpos)
// special case languages
std::string const & lang = orig_font.language()->lang();
bool const hebrew = lang == "hebrew";
bool const arabic = lang == "arabic" || lang == "farsi";
bool const arabic = lang == "arabic_arabtex" || lang == "arabic_arabi" ||
lang == "farsi";
// draw as many chars as we can
if ((!hebrew && !arabic)