[LyX/master] Implement variable size bigops

Enrico Forestieri forenr at lyx.org
Tue Jul 21 21:12:33 UTC 2020


On Sat, Jul 18, 2020 at 12:01:16AM +0200, Jean-Marc Lasgouttes wrote:
> Le 17/07/2020 à 23:40, Enrico Forestieri a écrit :
> > On Fri, Jul 17, 2020 at 10:32:09PM +0200, Jean-Marc Lasgouttes wrote:
> > > 
> > > This is something that has been bugging me for some time. Look at the file
> > > in attachment to see what the effect is.
> > 
> > Yes, it looks better. However, it also makes more evident that the
> > lower limit of an integral is badly placed. In general, the limits
> > of an integral were better placed until lyx 2.2 and somewhat broken
> > starting from 2.3.
> 
> I will try to check older versions. I broke something, but what? Could it be
> also a matter of Qt or freetype version?

I made the following experiment. After applying the attached patch to
the lyx 2.2 sources, I compiled them using Qt 5.15.0. Then replaced
the esint10.ttf font with the current one in master. Thus, I was using
the same ttf font and Qt version. Then I loaded the attached document
in lyx 2.2 and current master (compiled after applying the debugging patch
to MathSupport.cpp). I got the following results.

lyx 2.2:
code: 2, lbearing: 1, rbearing: 22, width: 13, kerning: 9

current master:
code: 2, lbearing: 0, rbearing: 10, width: 10, kerning: 0

I wonder why the metrics are so different given that both Qt and
the ttf font are the same. Needless to say that the limits are
perfectly placed in lyx 2.2 and misplaced in current master.

-- 
Enrico
-------------- next part --------------
--- a/lyx-2.2.4/lib/symbols	2018-03-17 19:02:27.000000000 +0100
+++ b/lyx-2.2.4/lib/symbols	2020-07-21 22:19:26.627347700 +0200
@@ -994,8 +994,8 @@ tbond              cmsy        180 186 m
 # If the wasysym integrals are really wanted then one has to load the package
 # manually and disable automatic loading of amsmath and esint.
 iffont esint
-int                esint        001    0  mathop  ∫         esint|amsmath
-intop              esint        001    0  mathop  ∫         esint
+int                esint        002    0  mathop  ∫         esint|amsmath
+intop              esint        002    0  mathop  ∫         esint
 iint               esint        003    0  mathop  ∬         esint|amsmath
 iintop             esint        003    0  mathop  ∬         esint
 iiint              esint        005    0  mathop  ∭        esint|amsmath
--- a/lyx-2.2.4/src/frontends/qt4/GuiDocument.cpp	2018-03-17 19:02:27.000000000 +0100
+++ b/lyx-2.2.4/src/frontends/qt4/GuiDocument.cpp	2020-07-21 22:06:22.510986600 +0200
@@ -67,6 +67,7 @@
 #include "frontends/alert.h"
 
 #include <QAbstractItemModel>
+#include <QButtonGroup>
 #include <QHeaderView>
 #include <QColor>
 #include <QColorDialog>
--- a/lyx-2.2.4/src/mathed/MathSupport.cpp	2018-03-17 19:02:27.000000000 +0100
+++ b/lyx-2.2.4/src/mathed/MathSupport.cpp	2020-07-21 22:21:16.454006900 +0200
@@ -516,6 +516,10 @@ int mathed_char_width(FontInfo const & f
 int mathed_char_kerning(FontInfo const & font, char_type c)
 {
 	frontend::FontMetrics const & fm = theFontMetrics(font);
+	lyxerr << "code: " << c << ", lbearing: " << fm.lbearing(c)
+	       << ", rbearing: " << fm.rbearing(c) << ", width: " << fm.width(c)
+	       << ", kerning: " << fm.rbearing(c) - fm.width(c)
+	       << std::endl;
 	return fm.rbearing(c) - fm.width(c);
 }
 
-------------- next part --------------
#LyX 2.2 created this file. For more info see http://www.lyx.org/
\lyxformat 508
\begin_document
\begin_header
\save_transient_properties true
\origin unavailable
\textclass article
\use_default_options false
\maintain_unincluded_children false
\language american
\language_package default
\inputencoding auto
\fontencoding global
\font_roman "default" "default"
\font_sans "default" "default"
\font_typewriter "default" "default"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100 100
\font_tt_scale 100 100
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref false
\papersize default
\use_geometry false
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 0
\use_package mathdots 0
\use_package mathtools 1
\use_package mhchem 0
\use_package stackrel 1
\use_package stmaryrd 2
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 0
\index Index
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\quotes_language english
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header

\begin_body

\begin_layout Standard
\begin_inset Formula 
\[
\int_{0}^{1}
\]

\end_inset


\end_layout

\end_body
\end_document


More information about the lyx-devel mailing list