tmpfont = layout.font;
else
tmpfont = layout.labelfont;
+ if (current_view->text->GetParDirection((LyXParagraph *)this) == LYX_DIR_RIGHT_TO_LEFT)
+ tmpfont.setDirection(LyXFont::RTL_DIR);
}
// check for environment font information
texrow.newline();
}
+ LyXDirection direction = current_view->text->GetParDirection((LyXParagraph *)this);
+ LyXDirection global_direction = current_view->text->GetDocumentDirection();
+ if (direction != global_direction) {
+ if (direction == LYX_DIR_LEFT_TO_RIGHT)
+ file += "{\\unsethebrew\n";
+ else
+ file += "{\\sethebrew\n";
+ texrow.newline();
+ }
+
+
switch (style.latextype) {
case LATEX_COMMAND:
file += '\\';
} else if (style.resfont.size() != font.size()){
file += "{\\" + font.latexSize() + " \\par}";
}
+
+ if (direction != global_direction)
+ file += "\\par}";
switch (style.latextype) {
case LATEX_ITEM_ENVIRONMENT:
bool return_value = false;
LyXLayout const & style = textclasslist.Style(current_view->buffer()->params.textclass, GetLayout());
- LyXFont basefont;
+ LyXFont basefont, last_font;
// Maybe we have to create a optional argument.
if (style.labeltype != LABEL_MANUAL)
if (i == main_body && !IsDummy()) {
if (main_body > 0) {
if (open_font) {
- column += running_font.latexWriteEndChanges(file, basefont);
+ column += running_font.latexWriteEndChanges(file, basefont, basefont);
open_font = false;
}
basefont = getFont(-1); // Now use the layout font
// Fully instantiated font
LyXFont font = getFont(i);
+ last_font = running_font;
// Spaces at end of font change are simulated to be
// outside font change, i.e. we write "\textXX{text} "
// We end font definition before blanks
if (!font.equalExceptLatex(running_font) && open_font) {
column += running_font.latexWriteEndChanges(file,
- basefont);
+ basefont,
+ (i == main_body-1) ? basefont : font);
running_font = basefont;
open_font = false;
}
// Do we need to change font?
if (!font.equalExceptLatex(running_font)
&& i != main_body-1) {
- column += font.latexWriteStartChanges(file, basefont);
+ column += font.latexWriteStartChanges(file, basefont, last_font);
running_font = font;
open_font = true;
}
file += '\n';
} else {
if (open_font) {
- column += running_font.latexWriteEndChanges(file, basefont);
+ column += running_font.latexWriteEndChanges(file, basefont, basefont);
open_font = false;
}
basefont = getFont(-1);
// If we have an open font definition, we have to close it
if (open_font) {
- running_font.latexWriteEndChanges(file, basefont);
+ running_font.latexWriteEndChanges(file, basefont, basefont);
}
// Needed if there is an optional argument but no contents.
LyXFont basefont = getFont(-1); // Get layout font
// Which font is currently active?
LyXFont running_font = basefont;
+ LyXFont last_font;
// Do we have an open font change?
bool open_font = false;
int current_cell_number = -1;
// Fully instantiated font
LyXFont font = getFont(i);
+ last_font = running_font;
// Spaces at end of font change are simulated to be
// outside font change.
// We end font definition before blanks
if (font != running_font && open_font) {
column += running_font.latexWriteEndChanges(file,
- basefont);
+ basefont, font);
running_font = basefont;
open_font = false;
}
}
// Do we need to change font?
if (font != running_font) {
- column += font.latexWriteStartChanges(file, basefont);
+ column += font.latexWriteStartChanges(file, basefont, last_font);
running_font = font;
open_font = true;
}
// SimpleTeXSpecialChars()
if (open_font) {
column += running_font
- .latexWriteEndChanges(file, basefont);
+ .latexWriteEndChanges(file, basefont, basefont);
open_font = false;
}
basefont = getFont(-1);
// If we have an open font definition, we have to close it
if (open_font) {
- running_font.latexWriteEndChanges(file, basefont);
+ running_font.latexWriteEndChanges(file, basefont, basefont);
}
++current_cell_number;
tmp = table->TexEndOfCell(file, current_cell_number);
textclasslist.Style(current_view->buffer()->params.textclass,
GetLayout());
LyXFont basefont = getFont(-1); // Get layout font
+ LyXFont last_font;
// Which font is currently active?
LyXFont running_font = basefont;
// Do we have an open font change?
// Fully instantiated font
LyXFont font = getFont(i);
+ last_font = running_font;
// Spaces at end of font change are simulated to
// be outside font change. i.e. we write
// We end font definition before blanks
if (font != running_font && open_font) {
- column += running_font.latexWriteEndChanges(file, basefont);
+ column += running_font.latexWriteEndChanges(file, basefont, font);
running_font = basefont;
open_font = false;
}
if (font != running_font) {
column +=
font.latexWriteStartChanges(file,
- basefont);
+ basefont, last_font);
running_font = font;
open_font = true;
}
}
// If we have an open font definition, we have to close it
if (open_font) {
- running_font.latexWriteEndChanges(file, basefont);
+ running_font.latexWriteEndChanges(file, basefont, basefont);
open_font = false;
}
basefont = getFont(-1);
case LyXParagraph::META_INSET: {
Inset * inset = GetInset(i);
if (inset) {
+ bool close = false;
int len = file.length();
+ if ( (inset->LyxCode() == Inset::GRAPHICS_CODE
+ || inset->LyxCode() == Inset::MATH_CODE)
+ && current_view->text->GetFontDirection(running_font)
+ == LYX_DIR_RIGHT_TO_LEFT) {
+ file += "\\L{";
+ close = true;
+ }
int tmp = inset->Latex(file, style.isCommand());
+ if (close)
+ file += "}";
if (tmp) {
column = 0;
case LyXParagraph::META_NEWLINE:
if (open_font) {
column += running_font.latexWriteEndChanges(file,
- basefont);
+ basefont, basefont);
open_font = false;
}
basefont = getFont(-1);