Jürgen Spitzmüller wrote:
> > No, I meant output rhe {} only when there are two consecutive blanks.
>
> You mean, pass information to Font::latexWriteStartChanges that the
> character following the font change will be a blank? That could be doable.

As in the attached? This looks like a pretty safe approach to me.

Jürgen
Index: src/Font.cpp
===================================================================
--- src/Font.cpp	(Revision 19033)
+++ src/Font.cpp	(Arbeitskopie)
@@ -743,7 +743,7 @@
 int Font::latexWriteStartChanges(odocstream & os, BufferParams const & bparams,
 				    OutputParams const & runparams,
 				    Font const & base,
-				    Font const & prev) const
+				    Font const & prev, bool blank_follows) const
 {
 	bool env = false;
 
@@ -803,8 +803,13 @@
 	if (number() == ON && prev.number() != ON
 		&& (language()->lang() == "hebrew"
 			|| language()->lang() == "farsi")) {
-		os << "{\\beginL ";
-		count += 9;
+		if (blank_follows) {
+			os << "{\\beginL{}";
+			count += 10;
+		} else {
+			os << "{\\beginL ";
+			count += 9;
+		}
 	}
 
 	Font f = *this;
@@ -861,9 +866,14 @@
 			++count;
 		}
 		os << '\\'
-		   << LaTeXSizeNames[f.size()]
-		   << ' ';
-		count += strlen(LaTeXSizeNames[f.size()]) + 2;
+		   << LaTeXSizeNames[f.size()];
+		if (blank_follows) {
+			os << "{}";
+			count += strlen(LaTeXSizeNames[f.size()]) + 3;
+		} else {
+			os << ' ';
+			count += strlen(LaTeXSizeNames[f.size()]) + 2;
+		}
 	}
 	return count;
 }
Index: src/Font.h
===================================================================
--- src/Font.h	(Revision 19033)
+++ src/Font.h	(Arbeitskopie)
@@ -300,7 +300,8 @@
 	int latexWriteStartChanges(odocstream &, BufferParams const & bparams,
 				   OutputParams const & runparams,
 				   Font const & base,
-				   Font const & prev) const;
+				   Font const & prev,
+				   bool blank_follows) const;
 
 	/** Writes the tail of the LaTeX needed to change to this font.
 	    Returns number of chars written. Base is the font state we want
Index: src/Paragraph.cpp
===================================================================
--- src/Paragraph.cpp	(Revision 19033)
+++ src/Paragraph.cpp	(Arbeitskopie)
@@ -2070,9 +2070,12 @@
 		     font.language() != running_font.language()) &&
 			i != body_pos - 1)
 		{
+			bool blank_follows = false;
+			if (c == ' ')
+				blank_follows = true;
 			column += font.latexWriteStartChanges(os, bparams,
 							      runparams, basefont,
-							      last_font);
+							      last_font, blank_follows);
 			running_font = font;
 			open_font = true;
 		}

Reply via email to