The branch, master, has been updated. - Log -----------------------------------------------------------------
commit 63772964923f765e4ab975946215725086a9c838 Author: Vincent van Ravesteijn <v...@lyx.org> Date: Thu May 3 15:51:55 2012 +0200 Fix bug #5167: Correctly paint special characters in InsetMathFont When using, e.g., a 'mathcal' inset in math, the inline completion and other special characters like '\#', '{..}' are are painted in the 'mathcal' font as well. This is overcome by setting the mathnormal font before painted these characters. diff --git a/src/mathed/InsetMathBrace.cpp b/src/mathed/InsetMathBrace.cpp index 14279c1..1051659 100644 --- a/src/mathed/InsetMathBrace.cpp +++ b/src/mathed/InsetMathBrace.cpp @@ -48,7 +48,9 @@ void InsetMathBrace::metrics(MetricsInfo & mi, Dimension & dim) const { Dimension dim0; cell(0).metrics(mi, dim0); - Dimension t = theFontMetrics(mi.base.font).dimension('{'); + FontInfo font = mi.base.font; + augmentFont(font, from_ascii("mathnormal")); + Dimension t = theFontMetrics(font).dimension('{'); dim.asc = max(dim0.asc, t.asc); dim.des = max(dim0.des, t.des); dim.wid = dim0.width() + 2 * t.wid; @@ -59,6 +61,7 @@ void InsetMathBrace::metrics(MetricsInfo & mi, Dimension & dim) const void InsetMathBrace::draw(PainterInfo & pi, int x, int y) const { FontInfo font = pi.base.font; + augmentFont(font, from_ascii("mathnormal")); font.setShape(UP_SHAPE); font.setColor(Color_latex); Dimension t = theFontMetrics(font).dimension('{'); diff --git a/src/mathed/MathData.cpp b/src/mathed/MathData.cpp index 8fcf746..12fb6c1 100644 --- a/src/mathed/MathData.cpp +++ b/src/mathed/MathData.cpp @@ -280,7 +280,9 @@ void MathData::metrics(MetricsInfo & mi, Dimension & dim) const if (completion.length() == 0) continue; - dim.wid += mathed_string_width(mi.base.font, completion); + FontInfo font = mi.base.font; + augmentFont(font, from_ascii("mathnormal")); + dim.wid += mathed_string_width(font, completion); } // Cache the dimension. mi.base.bv->coordCache().arrays().add(this, dim); @@ -328,6 +330,7 @@ void MathData::draw(PainterInfo & pi, int x, int y) const if (completion.length() == 0) continue; FontInfo f = pi.base.font; + augmentFont(f, from_ascii("mathnormal")); // draw the unique and the non-unique completion part // Note: this is not time-critical as it is diff --git a/src/mathed/MathSupport.cpp b/src/mathed/MathSupport.cpp index 77b982b..82de873 100644 --- a/src/mathed/MathSupport.cpp +++ b/src/mathed/MathSupport.cpp @@ -490,13 +490,16 @@ void mathed_draw_deco(PainterInfo & pi, int x, int y, int w, int h, void metricsStrRedBlack(MetricsInfo & mi, Dimension & dim, docstring const & str) { - mathed_string_dim(mi.base.font, str, dim); + FontInfo font = mi.base.font; + augmentFont(font, from_ascii("mathnormal")); + mathed_string_dim(font, str, dim); } void drawStrRed(PainterInfo & pi, int x, int y, docstring const & str) { FontInfo f = pi.base.font; + augmentFont(f, from_ascii("mathnormal")); f.setColor(Color_latex); pi.pain.text(x, y, str, f); } @@ -505,6 +508,7 @@ void drawStrRed(PainterInfo & pi, int x, int y, docstring const & str) void drawStrBlack(PainterInfo & pi, int x, int y, docstring const & str) { FontInfo f = pi.base.font; + augmentFont(f, from_ascii("mathnormal")); f.setColor(Color_foreground); pi.pain.text(x, y, str, f); } commit b0b8e5f54c3d3f408fcd08d07416749cc5bd76b2 Author: Vincent van Ravesteijn <v...@lyx.org> Date: Thu May 3 16:28:28 2012 +0200 Move metrics computation close to drawing for drawStrRed/Black diff --git a/src/mathed/InsetMathBox.cpp b/src/mathed/InsetMathBox.cpp index 7a59d97..60983bc 100644 --- a/src/mathed/InsetMathBox.cpp +++ b/src/mathed/InsetMathBox.cpp @@ -218,7 +218,7 @@ void InsetMathMakebox::metrics(MetricsInfo & mi, Dimension & dim) const Dimension wdim; static docstring bracket = from_ascii("["); - mathed_string_dim(mi.base.font, bracket, wdim); + metricsStrRedBlack(mi, wdim, bracket); int w = wdim.wid; Dimension dim0; diff --git a/src/mathed/InsetMathExFunc.cpp b/src/mathed/InsetMathExFunc.cpp index 25c8dcb..35e2f62 100644 --- a/src/mathed/InsetMathExFunc.cpp +++ b/src/mathed/InsetMathExFunc.cpp @@ -44,7 +44,7 @@ Inset * InsetMathExFunc::clone() const void InsetMathExFunc::metrics(MetricsInfo & mi, Dimension & dim) const { - mathed_string_dim(mi.base.font, name_, dim); + metricsStrRedBlack(mi, dim, name_); } diff --git a/src/mathed/InsetMathUnknown.cpp b/src/mathed/InsetMathUnknown.cpp index 03c4146..29dae2b 100644 --- a/src/mathed/InsetMathUnknown.cpp +++ b/src/mathed/InsetMathUnknown.cpp @@ -47,7 +47,7 @@ void InsetMathUnknown::normalize(NormalStream & os) const void InsetMathUnknown::metrics(MetricsInfo & mi, Dimension & dim) const { - mathed_string_dim(mi.base.font, name_, dim); + metricsStrRedBlack(mi, dim, name_); docstring::const_reverse_iterator rit = name_.rbegin(); kerning_ = mathed_char_kerning(mi.base.font, *rit); } diff --git a/src/mathed/MathMacroArgument.cpp b/src/mathed/MathMacroArgument.cpp index 68f4f98..2e6b0e2 100644 --- a/src/mathed/MathMacroArgument.cpp +++ b/src/mathed/MathMacroArgument.cpp @@ -62,7 +62,7 @@ void MathMacroArgument::write(WriteStream & os) const void MathMacroArgument::metrics(MetricsInfo & mi, Dimension & dim) const { - mathed_string_dim(mi.base.font, str_, dim); + metricsStrRedBlack(mi, dim, str_); } diff --git a/src/mathed/MathSupport.cpp b/src/mathed/MathSupport.cpp index 1d7358a..77b982b 100644 --- a/src/mathed/MathSupport.cpp +++ b/src/mathed/MathSupport.cpp @@ -488,6 +488,12 @@ void mathed_draw_deco(PainterInfo & pi, int x, int y, int w, int h, } +void metricsStrRedBlack(MetricsInfo & mi, Dimension & dim, docstring const & str) +{ + mathed_string_dim(mi.base.font, str, dim); +} + + void drawStrRed(PainterInfo & pi, int x, int y, docstring const & str) { FontInfo f = pi.base.font; diff --git a/src/mathed/MathSupport.h b/src/mathed/MathSupport.h index 04bcffb..2e0ccff 100644 --- a/src/mathed/MathSupport.h +++ b/src/mathed/MathSupport.h @@ -40,6 +40,8 @@ void mathed_string_dim(FontInfo const & font, int mathed_string_width(FontInfo const &, docstring const & s); +void metricsStrRedBlack(MetricsInfo & mi, Dimension & dim, docstring const & s); + void drawStrRed(PainterInfo & pi, int x, int y, docstring const & s); void drawStrBlack(PainterInfo & pi, int x, int y, docstring const & s); commit a02bfeebc534925734821e8921bac07c67af6d39 Author: Vincent van Ravesteijn <v...@lyx.org> Date: Thu May 3 15:11:10 2012 +0200 configure.py: Replace 'ltx' by 'log' case insensitively On windows the temporary filename consists of uppercase characters. This causes that the extension does not get replaced, and the logfile is left behind. Checking the extension case insensitively will correctly remove the logfile. diff --git a/lib/configure.py b/lib/configure.py index e9c83ee..00cdbdb 100644 --- a/lib/configure.py +++ b/lib/configure.py @@ -124,7 +124,7 @@ def checkTeXPaths(): inpname = tmpfname.replace('\\', '/') else: inpname = cmdOutput('cygpath -m ' + tmpfname) - logname = os.path.basename(inpname.replace('.ltx', '.log')) + logname = os.path.basename(re.sub("(?i).ltx", ".log", inpname)) inpname = inpname.replace('~', '\\string~') os.write(fd, r'\relax') os.close(fd) ----------------------------------------------------------------------- Summary of changes: lib/configure.py | 2 +- src/mathed/InsetMathBox.cpp | 2 +- src/mathed/InsetMathBrace.cpp | 5 ++++- src/mathed/InsetMathExFunc.cpp | 2 +- src/mathed/InsetMathUnknown.cpp | 2 +- src/mathed/MathData.cpp | 5 ++++- src/mathed/MathMacroArgument.cpp | 2 +- src/mathed/MathSupport.cpp | 10 ++++++++++ src/mathed/MathSupport.h | 2 ++ 9 files changed, 25 insertions(+), 7 deletions(-) hooks/post-receive -- The LyX Source Repository