]> git.lyx.org Git - lyx.git/blobdiff - src/Font.cpp
* Only enter inset which return true on isActive(). This is the behavior in the curso...
[lyx.git] / src / Font.cpp
index ccbc937e797573360c7d62f41bd81295cc7ba8ef..78b79ed8c2faf12f77c8d3a060e9cec779995611 100644 (file)
@@ -510,21 +510,21 @@ docstring const Font::stateText(BufferParams * params) const
                os << lcolor.getGUIName(color()) << ", ";
        if (emph() != INHERIT)
                os << bformat(_("Emphasis %1$s, "),
-                             _(GUIMiscNames[emph()]));
+                             _(GUIMiscNames[emph()]));
        if (underbar() != INHERIT)
                os << bformat(_("Underline %1$s, "),
-                             _(GUIMiscNames[underbar()]));
+                             _(GUIMiscNames[underbar()]));
        if (noun() != INHERIT)
                os << bformat(_("Noun %1$s, "),
-                             _(GUIMiscNames[noun()]));
+                             _(GUIMiscNames[noun()]));
        if (bits == inherit)
                os << _("Default") << ", ";
        if (!params || (language() != params->language))
                os << bformat(_("Language: %1$s, "),
-                             _(language()->display()));
+                             _(language()->display()));
        if (number() != OFF)
                os << bformat(_("  Number %1$s"),
-                             _(GUIMiscNames[number()]));
+                             _(GUIMiscNames[number()]));
        return rtrim(os.str(), ", ");
 }
 
@@ -674,7 +674,7 @@ Font & Font::lyxRead(Lexer & lex)
                        } else if (ttok == "noun") {
                                setNoun(ON);
                        } else {
-                               lex.printError("Illegal misc type `$$Tokenยด");
+                               lex.printError("Illegal misc type `$$Token'");
                        }
                } else if (tok == "color") {
                        lex.next();
@@ -740,16 +740,23 @@ void Font::lyxWriteChanges(Font const & orgfont,
 /// Writes the head of the LaTeX needed to impose this font
 // Returns number of chars written.
 int Font::latexWriteStartChanges(odocstream & os, BufferParams const & bparams,
-                                    OutputParams const & runparams,
-                                    Font const & base,
-                                    Font const & prev) const
+                                   OutputParams const & runparams,
+                                   Font const & base,
+                                   Font const & prev) const
 {
        bool env = false;
 
        int count = 0;
        if (language()->babel() != base.language()->babel() &&
            language() != prev.language()) {
-               if (isRightToLeft() != prev.isRightToLeft()) {
+               if (language()->lang() == "farsi") {
+                       os << "\\textFR{";
+                       count += 8;
+               } else if (!isRightToLeft() &&
+                           base.language()->lang() == "farsi") {
+                       os << "\\textLR{";
+                       count += 8;
+               } else if (isRightToLeft() != prev.isRightToLeft()) {
                        if (isRightToLeft()) {
                                os << "\\R{";
                                count += 3;
@@ -781,8 +788,12 @@ int Font::latexWriteStartChanges(odocstream & os, BufferParams const & bparams,
        }
 
        // When the current language is Hebrew, Arabic, or Farsi
-       // the numbers are written Left-to-Right.
-       if (number() == ON && prev.number() != ON && isRightToLeft()) {
+       // the numbers are written Left-to-Right. ArabTeX package
+       // reorders the number automatically but the packages used
+       // for Hebrew and Farsi (Arabi) do not.
+       if (number() == ON && prev.number() != ON
+               && (language()->lang() == "hebrew"
+                       || language()->lang() == "farsi")) {
                os << "{\\beginL ";
                count += 9;
        }
@@ -853,9 +864,9 @@ int Font::latexWriteStartChanges(odocstream & os, BufferParams const & bparams,
 // Returns number of chars written
 // This one corresponds to latexWriteStartChanges(). (Asger)
 int Font::latexWriteEndChanges(odocstream & os, BufferParams const & bparams,
-                                  OutputParams const & runparams,
-                                  Font const & base,
-                                  Font const & next) const
+                                 OutputParams const & runparams,
+                                 Font const & base,
+                                 Font const & next) const
 {
        int count = 0;
        bool env = false;
@@ -910,8 +921,12 @@ int Font::latexWriteEndChanges(odocstream & os, BufferParams const & bparams,
        }
 
        // When the current language is Hebrew, Arabic, or Farsi
-       // the numbers are written Left-to-Right.
-       if (number() == ON && next.number() != ON && isRightToLeft()) {
+       // the numbers are written Left-to-Right. ArabTeX package
+       // reorders the number automatically but the packages used
+       // for Hebrew and Farsi (Arabi) do not.
+       if (number() == ON && next.number() != ON
+               && (language()->lang() == "hebrew"
+                       || language()->lang() == "farsi")) {
                os << "\\endL}";
                count += 6;
        }