Re: [patch] Re: UTF-8 and layouts - bugs

2007-07-13 Thread Martin Vermeer
On Thu, Jul 12, 2007 at 05:15:38PM +0100, José Matos wrote:
> On Thursday 12 July 2007 13:59:08 Jean-Marc Lasgouttes wrote:
> > Java?
> >
> > JMarc
> 
> Python is more likely. ;-)

Curses -- and that's not entirely a joke.

- Martin
 


Re: [patch] Re: UTF-8 and layouts - bugs

2007-07-12 Thread Andre Poenitz
On Thu, Jul 12, 2007 at 02:59:08PM +0200, Jean-Marc Lasgouttes wrote:
> [EMAIL PROTECTED] (Jürgen Spitzmüller) writes:
> > Jean-Marc Lasgouttes wrote:
> >> Yes. It is not fair to see always the same people having fun (what
> >> about replacing qt4 with Xaw?)
> >
> > Or just ditch Unix and use the Windows API.
> 
> Java?

*grmpf*

Andre'


Re: [patch] Re: UTF-8 and layouts - bugs

2007-07-12 Thread Andre Poenitz
On Thu, Jul 12, 2007 at 02:52:31PM +0200, Jürgen Spitzmüller wrote:
> Jean-Marc Lasgouttes wrote:
> > Yes. It is not fair to see always the same people having fun (what
> > about replacing qt4 with Xaw?)
> 
> Or just ditch Unix and use the Windows API.

Or use Java.

Andre'


Re: [patch] Re: UTF-8 and layouts - bugs

2007-07-12 Thread José Matos
On Thursday 12 July 2007 13:59:08 Jean-Marc Lasgouttes wrote:
> Java?
>
> JMarc

Python is more likely. ;-)

-- 
José Abílio


Re: [patch] Re: UTF-8 and layouts - bugs

2007-07-12 Thread Andre Poenitz
On Thu, Jul 12, 2007 at 02:44:21PM +0200, Jean-Marc Lasgouttes wrote:
> 
> [EMAIL PROTECTED] (Jürgen Spitzmüller) writes:
> > Jean-Marc Lasgouttes wrote:
> >> I have other plans, but we'll see :)
> >
> > Break some eggs perhaps? ;-)
> 
> Yes. It is not fair to see always the same people having fun (what
> about replacing qt4 with Xaw?)

Xt. At most.

Andre'


Re: [patch] Re: UTF-8 and layouts - bugs

2007-07-12 Thread Andre Poenitz
On Thu, Jul 12, 2007 at 02:17:57PM +0200, Jürgen Spitzmüller wrote:
> Jean-Marc Lasgouttes wrote:
> > I have other plans, but we'll see :)
> 
> Break some eggs perhaps? ;-)

I wonder what I will do this year... after all, there are not too many
frontends left to kill...

Andre'
> 


Re: [patch] Re: UTF-8 and layouts - bugs

2007-07-12 Thread Jean-Marc Lasgouttes
Jean-Marc Lasgouttes <[EMAIL PROTECTED]> writes:
> [EMAIL PROTECTED] (Jürgen Spitzmüller) writes:
>> You mean, pass information to Font::latexWriteStartChanges that the 
>> character 
>> following the font change will be a blank? That could be doable.
>
> It is even simpler than that.

I appled this patch.

JMarc


Re: [patch] Re: UTF-8 and layouts - bugs

2007-07-12 Thread Jean-Marc Lasgouttes
Abdelrazak Younes <[EMAIL PROTECTED]> writes:

> Ajax

Basix (http://www.tex.ac.uk/tex-archive/help/Catalogue/entries/basix.html)

JMarc


Re: [patch] Re: UTF-8 and layouts - bugs

2007-07-12 Thread Abdelrazak Younes

Jean-Marc Lasgouttes wrote:

[EMAIL PROTECTED] (Jürgen Spitzmüller) writes:

Jean-Marc Lasgouttes wrote:

Yes. It is not fair to see always the same people having fun (what
about replacing qt4 with Xaw?)

Or just ditch Unix and use the Windows API.


Java?


Ajax

Abdel.



Re: [patch] Re: UTF-8 and layouts - bugs

2007-07-12 Thread Jean-Marc Lasgouttes
[EMAIL PROTECTED] (Jürgen Spitzmüller) writes:
> Jean-Marc Lasgouttes wrote:
>> Yes. It is not fair to see always the same people having fun (what
>> about replacing qt4 with Xaw?)
>
> Or just ditch Unix and use the Windows API.

Java?

JMarc


Re: [patch] Re: UTF-8 and layouts - bugs

2007-07-12 Thread Jürgen Spitzmüller
Jean-Marc Lasgouttes wrote:
> Yes. It is not fair to see always the same people having fun (what
> about replacing qt4 with Xaw?)

Or just ditch Unix and use the Windows API.

Jürgen


Re: [patch] Re: UTF-8 and layouts - bugs

2007-07-12 Thread Jean-Marc Lasgouttes

[EMAIL PROTECTED] (Jürgen Spitzmüller) writes:
> Jean-Marc Lasgouttes wrote:
>> I have other plans, but we'll see :)
>
> Break some eggs perhaps? ;-)

Yes. It is not fair to see always the same people having fun (what
about replacing qt4 with Xaw?)

JMarc


Re: [patch] Re: UTF-8 and layouts - bugs

2007-07-12 Thread Jürgen Spitzmüller
Jean-Marc Lasgouttes wrote:
> I have other plans, but we'll see :)

Break some eggs perhaps? ;-)

Jürgen


Re: [patch] Re: UTF-8 and layouts - bugs

2007-07-12 Thread Jean-Marc Lasgouttes

Alfredo Braunstein <[EMAIL PROTECTED]> writes:
> Jean-Marc Lasgouttes wrote:
>
>> Yes, it is IMO simpler. Note that this would be moot if we had the
>> latexstream I've been dreaming about for ages :)
>
> Like the one you'll give us in Bromarv? ;-)

I have other plans, but we'll see :)

JMarc


Re: [patch] Re: UTF-8 and layouts - bugs

2007-07-12 Thread Alfredo Braunstein
Jean-Marc Lasgouttes wrote:

> Yes, it is IMO simpler. Note that this would be moot if we had the
> latexstream I've been dreaming about for ages :)

Like the one you'll give us in Bromarv? ;-)

A/




Re: [patch] Re: UTF-8 and layouts - bugs

2007-07-12 Thread Jean-Marc Lasgouttes

[EMAIL PROTECTED] (Jürgen Spitzmüller) writes:
> I also think this should be ported back to 1.4.

No, the bug does not exist in 1.4, where spaces are kept outside of
font changes.

JMarc


Re: [patch] Re: UTF-8 and layouts - bugs

2007-07-12 Thread Jean-Marc Lasgouttes

[EMAIL PROTECTED] (Jürgen Spitzmüller) writes:
> On a second thought, I think you should just commit yours. 

Yes, it is IMO simpler. Note that this would be moot if we had the
latexstream I've been dreaming about for ages :)

JMarc



Re: [patch] Re: UTF-8 and layouts - bugs

2007-07-12 Thread José Matos
On Thursday 12 July 2007 12:00:14 Jürgen Spitzmüller wrote:
> On a second thought, I think you should just commit yours. José?
>
> Jürgen

As I said before if you agree on one version, as it seems to be case, you have 
my OK.

-- 
José Abílio


Re: [patch] Re: UTF-8 and layouts - bugs

2007-07-12 Thread Jürgen Spitzmüller
Jürgen Spitzmüller wrote:
> On a second thought, I think you should just commit yours

I also think this should be ported back to 1.4.

Jürgen


Re: [patch] Re: UTF-8 and layouts - bugs

2007-07-12 Thread Jürgen Spitzmüller
Jürgen Spitzmüller wrote:
> So which one should we take? I think either one is ok. Yours is
> probably simpler. I'll let you and José decide.

On a second thought, I think you should just commit yours. José?

Jürgen


Re: [patch] Re: UTF-8 and layouts - bugs

2007-07-12 Thread José Matos
On Thursday 12 July 2007 11:54:39 Jürgen Spitzmüller wrote:
> Sight. So which one should we take? I think either one is ok. Yours is
> probably simpler. I'll let you and José decide.

  If you agree on one of the versions you have my OK.

  As you see I am learning. Now instead of throwing a coin I expect you to do 
so. ;-)

> Jürgen

-- 
José Abílio


Re: [patch] Re: UTF-8 and layouts - bugs

2007-07-12 Thread Jürgen Spitzmüller
Jean-Marc Lasgouttes wrote:
> It is even simpler than that.

Sight. So which one should we take? I think either one is ok. Yours is 
probably simpler. I'll let you and José decide.

Jürgen


Re: [patch] Re: UTF-8 and layouts - bugs

2007-07-12 Thread Jürgen Spitzmüller
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;
 		}


Re: [patch] Re: UTF-8 and layouts - bugs

2007-07-12 Thread Jean-Marc Lasgouttes
[EMAIL PROTECTED] (Jürgen Spitzmüller) writes:
> You mean, pass information to Font::latexWriteStartChanges that the character 
> following the font change will be a blank? That could be doable.

It is even simpler than that.

JMarc

Index: src/Paragraph.cpp
===
--- src/Paragraph.cpp	(révision 19050)
+++ src/Paragraph.cpp	(copie de travail)
@@ -67,6 +67,7 @@ using std::ostream;
 namespace lyx {
 
 using support::contains;
+using support::suffixIs;
 using support::rsplit;
 
 
@@ -2076,11 +2077,19 @@ bool Paragraph::simpleTeXOnePar(Buffer c
 		 font.language() != running_font.language()) &&
 			i != body_pos - 1)
 		{
-			column += font.latexWriteStartChanges(os, bparams,
+			odocstringstream ods;
+			column += font.latexWriteStartChanges(ods, bparams,
 			  runparams, basefont,
 			  last_font);
 			running_font = font;
 			open_font = true;
+			docstring fontchange = ods.str();
+			// check if the fontchange ends with a trailing blank
+			if (suffixIs(fontchange, 0x0020) && c == ' ')
+os << fontchange.substr(0, fontchange.size() - 1) 
+   << from_ascii("{}");
+			else
+os << fontchange;
 		}
 
 		if (c == ' ') {


Re: [patch] Re: UTF-8 and layouts - bugs

2007-07-12 Thread Jürgen Spitzmüller
Jean-Marc Lasgouttes 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.

Jürgen


Re: [patch] Re: UTF-8 and layouts - bugs

2007-07-12 Thread Jean-Marc Lasgouttes
[EMAIL PROTECTED] (Jürgen Spitzmüller) writes:


> This is what I proposed first, but Uwe doesn't like it ;-)
> It is of course much easier, but it's less elegant LaTeX code, even more so 
> as 
> the {} is always output, whereas the "\ " in my recent patch is only output 
> if there are really two subsequent blanks.

No, I meant output rhe {} only when there are two consecutive blanks.

JMarc


Re: [patch] Re: UTF-8 and layouts - bugs

2007-07-12 Thread Jürgen Spitzmüller
Jean-Marc Lasgouttes wrote:
> What about replacing the final blank by {} instead , and output
> \textcolor{red}{\small a}{\small{}  word}
>
> It should be easy with what you have already done.

This is what I proposed first, but Uwe doesn't like it ;-)
It is of course much easier, but it's less elegant LaTeX code, even more so as 
the {} is always output, whereas the "\ " in my recent patch is only output 
if there are really two subsequent blanks.

Jürgen


Re: [patch] Re: UTF-8 and layouts - bugs

2007-07-12 Thread Jean-Marc Lasgouttes
> "Jürgen" == Jürgen Spitzmüller <[EMAIL PROTECTED]> writes:

Jürgen> The attached patch is a bit more complicated than my first
Jürgen> attempt on bugzilla that just ends every font size command by
Jürgen> '{}' instead of a blank, but it results in better LaTeX
Jürgen> output. It checks whether a font switch command with a
Jürgen> trailing blank has occured, and if so, it outputs a normal
Jürgen> space ("\ ") instead of a blank, i.e. in the case above:
Jürgen> \textcolor{red}{\small a}{\small \ word}

What about replacing the final blank by {} instead , and output
\textcolor{red}{\small a}{\small{}  word}

It should be easy with what you have already done.

JMarc