Enrico Forestieri wrote:
> On Thu, Jul 10, 2014 at 10:33:14PM +0200, Georg Baum wrote:
>>
>> This breaks the tex2lyx tests with a german locale, probably since
>> support::convert<double>(std::string const s) wants now a comma instead
>> of a period as decimal point, so the string "0.3359375" gets now
>> converted to 0 instead of 0.3359375. Other conversions are probably
>> broken as well, and unfortunately this is also in 2.1.1.
>
> I don't know how to run those tests and, most probably, also packagers.
> So, this is not a big deal.
This is not the point. The point is that there was a regression in the code
which did not exist before. This regression was made visible by the tests
(and if you want to know how to run them: see section 3 of
lib/doc/Development.lyx).
> As regards other possible brekages, I only see one instance of
> convert<double> in the tex2lyx sources, namely in scale_as_percentage(),
> and this is about converting a scale parameter for fonts. So, I tried
> to import the attached latex document with either 2.1.0 and 2.1.1.
> Both were broken for different reasons. The 2.1.0 version produced
> a line "\font_sf_scale 92.5" which was later rejected as an integer
> and treated as 0. The 2.1.1 version directly produced 0, thus avoiding
> a warning ;-)
I am not sure whether restricting scale values to integers is a good idea.
Scales are inherently floating point values, and LaTeX uses floating point
values as well. Therefore, LyX should be fixed to accept floating point
values for all font scale parameters, and the integer restriction in tex2lyx
should be reverted.
> So, it seems there is no regression...
There was a regression, see the attached diff (which I should have attached
yesterday, but forgot). It might not be caused by convert<double>, but
tex2lyx created valid LyX files before the change, and after the change they
were still valid, but the contents was not in line with the TeX file
anymore. After your fix every test is fine again.
Georg
diff --git a/src/tex2lyx/test/XeTeX-polyglossia.lyx.lyx b/src/tex2lyx/test/XeTeX-polyglossia.lyx.lyx
index 99b5d0e..64b043e 100644
--- a/src/tex2lyx/test/XeTeX-polyglossia.lyx.lyx
+++ b/src/tex2lyx/test/XeTeX-polyglossia.lyx.lyx
@@ -27,7 +27,7 @@
\use_non_tex_fonts true
\font_sc false
\font_osf false
-\font_sf_scale 75
+\font_sf_scale 0
\font_tt_scale 100
\graphics default
\default_output_format pdf4
diff --git a/src/tex2lyx/test/box-color-size-space-align.lyx.lyx b/src/tex2lyx/test/box-color-size-space-align.lyx.lyx
index e83330b..d16997a 100644
--- a/src/tex2lyx/test/box-color-size-space-align.lyx.lyx
+++ b/src/tex2lyx/test/box-color-size-space-align.lyx.lyx
@@ -84,7 +84,7 @@
\justification true
\use_refstyle 0
\notefontcolor #0000ff
-\backgroundcolor #ff5500
+\backgroundcolor #ff0000
\boxbgcolor #ffff00
\index Index
\shortcut idx