Angus Leeming <[EMAIL PROTECTED]> writes:
> 
> Enrico Forestieri wrote:
> > Perhaps you mean that the dpi variable is *proportional* to
> > preview_scale_factor. Indeed, when not setting preview_scale_factor I
> > obtain dpi=112, whereas setting it to 1.02 I obtain dpi=127. However, I
> > don't know the default value of preview_scale_factor (and obviously it is
> > not equal to 1), so I am not able to evaluate preview_scale_factor from
> > the knowledge of dpi.
> 
> 0.9

Uhm... this value is doesn't look right to me. Perhaps it was ok in the
old xforms days, but anyway...

> In src/graphics/PreviewLoader.C you'll find:
> 
>         font_scaling_factor_ = 0.01 * lyxrc.dpi * lyxrc.zoom *
>                 convert<double>(lyxrc.preview_scale_factor);
> 
>         ...
> 
>         cs << pconverter_->command << ' ' << pconverter_->to << ' '
>            << support::QuoteName(latexfile) << ' ' 
>            << int(font_scaling_factor_) << ' '
>            << lyx_gui::hexname(LColor::preview) << ' '
>            << lyx_gui::hexname(LColor::background);
> 
> This is the command used to launch the script. 'dpi' inside the script is
> 'int(font_scaling_factor_) outside it.
> 
> Thereafter, the metrics info is used in setAscentFractions() in the same
> file.

Thanks for the pointer Angus, but, perhaps due to the fact that I don't
grok well C++, I was not able to figure out the program flow and
eventually I came to the conclusion that there was any, as everything
seems to be signal driven :-(

However, I did some experiments using the lyx file pasted at the bottom.
In my preference file I have
  \screen_zoom 130
  \screen_font_roman "Times New Roman"
and the "Screen DPI" is at its default value of 96.
Using the default value of 0.9 for preview_scale_factor, the various
"n"'s and "H"'s are not aligned with each other.
Then I changed preview_scale_factor with a step of 0.05, successively
trying the values 0.95, 1.0, 1.05.
At preview_scale_factor=1.05, magically everything lines up and even
the baseline of the previewed images is correctly aligned with the
baseline of the surrounding text!

With these settings I tried other real world lyx files and everything
seems fine.

Things break again if one chooses pslatex fonts. Instead, changing
\screen_zoom to 150, the "n"'s and "H"'s are still aligned with each
other but their baseline does not correspond anymore to that of the
surrounding text.

I think that the conclusion is that there are complex interactions
between too much parameters and it is very difficult to get it right.

I am sorry that my scarce knowledge of C++ and of the LyX sources does
not let me to be of help here, and, frankly, I don't know how much this
effort would be worth.

> > As regards why we need to use it twice, I don't know the way the images
> > are imported. What I know is that if leave untouched the value of the
> > frac variable *and* preview_scale_factor is set to something different
> > than its default value, then the inlined images do not perfectly line up
> > with the surrounding text.
> 
> Right. But you'll understand that I'm unhappy about making a change I don't
> understand.

You're a wise man ;-)

--
Enrico


#LyX 1.4.0pre3 created this file. For more info see http://www.lyx.org/
\lyxformat 245
\begin_document
\begin_header
\textclass article
\language english
\inputencoding auto
\fontscheme default
\graphics default
\paperfontsize default
\spacing single
\papersize default
\use_geometry false
\use_amsmath 1
\cite_engine basic
\use_bibtopic false
\paperorientation portrait
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\defskip medskip
\quotes_language english
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\end_header

\begin_body

\begin_layout Standard

\family roman
\series medium
\shape up
\size normal
\emph off
\bar no
\noun off
\color none
xxxx
\begin_inset Formula $n$
\end_inset

xxx
\family default
\series default
\shape default
\size default
\emph default
\bar default
\noun default

\begin_inset Formula $n_{i}$
\end_inset

xxx
\begin_inset Formula $n^{2}$
\end_inset

xxx
\begin_inset Formula $n_{i}^{2}$
\end_inset

xxx
\begin_inset Formula $H$
\end_inset

xxx
\begin_inset Formula $H_{1}$
\end_inset

xxx
\begin_inset Formula $H^{2}$
\end_inset

xxx
\begin_inset Formula $H_{i}^{2}$
\end_inset

xxx
\end_layout

\end_body
\end_document


Reply via email to