]> git.lyx.org Git - features.git/commit
Improve support for on screen length calculation
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 26 Mar 2015 15:55:19 +0000 (16:55 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 26 Mar 2015 16:10:15 +0000 (17:10 +0100)
commit66fa801e74e1775b31008df548332436ce79e2e1
tree5adccf67917c2202e4223fd6dec5ecc61a392f9c
parent67e6c45f80cd743dc88cd35749c2cd160f5dded6
Improve support for on screen length calculation

The computation of length on screen depend in particular of the computation of the size of an em. Many places of the code used to rely on the width of the M character, which is not really correct:
http://en.wikipedia.org/wiki/Em_%28typography%29

In digital typography, the best value to use is the point size of the font.

* Implement FontMetrics::em(), which returns the value in pixels of the EM unit.
 Convert code to use it.

* Introduce Length::inPixel(MetricsBase const &), which takes the textwidth and em information from the MetricsBase object. Convert code to use it.

* Fix several places where Length::inPixel is used without a proper em value.

* add mathed_font_em() helper function. It should eventually be removed like some other functions in MathSupport.

* Add dummy implementation of FontMetrics to tex2lyx for linking purposes.
20 files changed:
src/BufferView.cpp
src/Length.cpp
src/Length.h
src/TextMetrics.cpp
src/frontends/FontMetrics.h
src/frontends/qt4/GuiFontMetrics.cpp
src/frontends/qt4/GuiFontMetrics.h
src/insets/InsetBox.cpp
src/insets/InsetLine.cpp
src/insets/InsetSpace.cpp
src/insets/InsetSpecialChar.cpp
src/insets/InsetTabular.cpp
src/mathed/InsetMathChar.cpp
src/mathed/InsetMathGrid.cpp
src/mathed/InsetMathKern.cpp
src/mathed/InsetMathSpace.cpp
src/mathed/InsetMathSymbol.cpp
src/mathed/MathSupport.cpp
src/mathed/MathSupport.h
src/tex2lyx/dummy_impl.cpp