X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2FInsetMathKern.cpp;h=71723b99561f2369340dfee1f35b38c208d944e3;hb=02e82157ec583c3900e359de86be79fac6512387;hp=ccb01c411ba816b22b751bed83cc4eba331bb1fd;hpb=f1cba8ff64b369792fd49f5ddf90e8126ab476ac;p=lyx.git diff --git a/src/mathed/InsetMathKern.cpp b/src/mathed/InsetMathKern.cpp index ccb01c411b..71723b9956 100644 --- a/src/mathed/InsetMathKern.cpp +++ b/src/mathed/InsetMathKern.cpp @@ -11,10 +11,12 @@ #include #include "InsetMathKern.h" -#include "MathStream.h" + #include "MathStream.h" #include "MathSupport.h" + #include "Dimension.h" +#include "MetricsInfo.h" #include "support/docstring.h" @@ -47,7 +49,7 @@ void InsetMathKern::metrics(MetricsInfo & mi, Dimension & dim) const { dim.asc = 0; dim.des = 0; - dim.wid = wid_.inPixels(0, mathed_char_width(mi.base.font, 'M')); + dim.wid = wid_.inPixels(mi.base); } @@ -57,13 +59,19 @@ void InsetMathKern::draw(PainterInfo &, int, int) const void InsetMathKern::write(WriteStream & os) const { - os << "\\kern" << from_utf8(wid_.asLatexString()) << ' '; + if (wid_.empty()) + os << "\\kern" << ' '; + else + os << "\\kern" << from_utf8(wid_.asLatexString()) << ' '; } void InsetMathKern::normalize(NormalStream & os) const { - os << "[kern " << from_utf8(wid_.asLatexString()) << ']'; + if (wid_.empty()) + os << "[kern]"; + else + os << "[kern " << from_utf8(wid_.asLatexString()) << ']'; }