# Usage of "{}" as default fontname for gnuplot

9 messages
Open this post in threaded view
|

## Usage of "{}" as default fontname for gnuplot

 Hello, currently, for the gnuplot graphics backend, the default font "*" is translated into "{}" before passing to gnuplot. This causes troubles with the windows terminal, and I wondered if "{}" is a valid gnuplot fontname specification. I glanced through gnuplot's manual, but there is no mentioning of "{}" for a font name - for enhanced text, yes, but not fontname. So, shouldn't it be rather "" (empty) for the default fontname? benjamin
Open this post in threaded view
|

## Re: Usage of "{}" as default fontname for gnuplot

 > Hello, > > currently, for the gnuplot graphics backend, the default font "*" is > translated into "{}" before passing to gnuplot. > This causes troubles with the windows terminal, and I wondered if "{}" > is a valid gnuplot fontname specification. > I glanced through gnuplot's manual, but there is no mentioning of "{}" > for a font name - for enhanced text, yes, but not fontname. > So, shouldn't it be rather "" (empty) for the default fontname? Sorry clicked send too soon, forgot the details - there's the offending translation: diff --git a/scripts/plot/__go_draw_axes__.m b/scripts/plot/__go_draw_axes__.m --- a/scripts/plot/__go_draw_axes__.m +++ b/scripts/plot/__go_draw_axes__.m @@ -2084,7 +2084,7 @@  function [f, s, fnt, it, bld] = get_fontname_and_size (t)    if (isempty (t.fontname) || strcmp (t.fontname, "*")) -    fnt = "{}"; +    fnt = "";    else      fnt = t.fontname;    endif The manifestation is, that enhanced ylabel text is printed wrong, e.g. ylabel("foo in mm^2") results in the superscipt "2" being not rotated but horizontal. The problem can be reproduced within gnuplot by   set term windows enhanced   set ylabel "foo in mm^2" font "{},10"   plot sin(x) which fails, but   set ylabel "foo in mm^2" font ",10" works as expected
Open this post in threaded view
|

## Re: Usage of "{}" as default fontname for gnuplot

 Benjamin Lindner wrote: >> Hello, >> >> currently, for the gnuplot graphics backend, the default font "*" is >> translated into "{}" before passing to gnuplot. >> This causes troubles with the windows terminal, and I wondered if "{}" >> is a valid gnuplot fontname specification. >> I glanced through gnuplot's manual, but there is no mentioning of "{}" >> for a font name - for enhanced text, yes, but not fontname. >> So, shouldn't it be rather "" (empty) for the default fontname? >>     > > Sorry clicked send too soon, forgot the details - there's the > offending translation: > > diff --git a/scripts/plot/__go_draw_axes__.m b/scripts/plot/__go_draw_axes__.m > --- a/scripts/plot/__go_draw_axes__.m > +++ b/scripts/plot/__go_draw_axes__.m > @@ -2084,7 +2084,7 @@ > >  function [f, s, fnt, it, bld] = get_fontname_and_size (t) >    if (isempty (t.fontname) || strcmp (t.fontname, "*")) > -    fnt = "{}"; > +    fnt = ""; >    else >      fnt = t.fontname; >    endif > > The manifestation is, that enhanced ylabel text is printed wrong, e.g. > ylabel("foo in mm^2") > results in the superscipt "2" being not rotated but horizontal. > > The problem can be reproduced within gnuplot by >   set term windows enhanced >   set ylabel "foo in mm^2" font "{},10" >   plot sin(x) > which fails, but >   set ylabel "foo in mm^2" font ",10" > works as expected > >   Please see the bug report of why this change was made https://savannah.gnu.org/bugs/index.php?32118No I didn't test under windows, so didn't see this issue. However making the change you suggest will make the issue with the TeX interpreter under gnuplot come back D.
Open this post in threaded view
|

## Re: Usage of "{}" as default fontname for gnuplot

 > Please see the bug report of why this change was made > > https://savannah.gnu.org/bugs/index.php?32118> > No I didn't test under windows, so didn't see this issue. However making > the change you suggest will make the issue with the TeX interpreter > under gnuplot come back I can't quite follow the reasoning in the bug report, nor can I reproduce the problem - perhaps I am missing something? Here is what I tried: With both 4.4.2 and a recent 4.5.0 CVS gnuplot:     set term windows enhanced     set label 1 "{/Symbol \\362}@_0^x e^{-x} dx" at  1.0,0.5 left     plot x works as expected.     set label 1 "{/Symbol \\362}@_0^x e^{-x} dx" at  1.0,0.5 left font ",20" also works as expected - the whole string is now printed with fontsize 20 The same goes for the wxt terminal, and for the postscript terminal. So I don't see why you have to issue font "{},20" - it's AFAICS not valid gnuplot syntax. And it exposes the here reported bug that rotated ylabel text is no longer rotated - and others: Try the following: set term post enhanced font "Helvetica,14" set output "test.ps" set ylabel "foo in mm^2" font ",10" set label 1 "{/Symbol \\362}@_0^x e^{-x} dx" at  1.0,0.5 left font ",20" plot x set output set output "test2.ps" set ylabel "foo in mm^2" font "{},10" set label 1 "{/Symbol \\362}@_0^x e^{-x} dx" at  1.0,0.5 left font "{},20" plot x set output I see that test.ps looks fine, but test2.ps has the wrong font for both the ylabel and the text label. I also tested your example in the bug report.    set(gca,"fontname","*");    text(0.5,0.5,'\int_0^x e^(-x) dx','fontsize',20) and    set (gca, "fontname", "Arial")    text(0.5,0.5,'\int_0^x e^(-x) dx','fontsize',20) both yield the same (correct) result - where the correct result is that only the "(" parenthesis is displayed as superscript. And both yield the same result with either the "{},20" or the ",20" font setting. So I am - back at the start - a bit confused as to the original bug report. What did you see without the "{}" font setting? benjamin
Open this post in threaded view
|

## Re: Usage of "{}" as default fontname for gnuplot

 Administrator On Feb 17, 2011, at 3:18 AM, Benjamin Lindner wrote: >> Please see the bug report of why this change was made >> >> https://savannah.gnu.org/bugs/index.php?32118>> >> No I didn't test under windows, so didn't see this issue. However making >> the change you suggest will make the issue with the TeX interpreter >> under gnuplot come back > > I can't quite follow the reasoning in the bug report, nor can I > reproduce the problem - perhaps I am missing something? > > Here is what I tried: > > With both 4.4.2 and a recent 4.5.0 CVS gnuplot: >    set term windows enhanced >    set label 1 "{/Symbol \\362}@_0^x e^{-x} dx" at  1.0,0.5 left >    plot x > works as expected. >    set label 1 "{/Symbol \\362}@_0^x e^{-x} dx" at  1.0,0.5 left font ",20" > also works as expected - the whole string is now printed with fontsize 20 > The same goes for the wxt terminal, and for the postscript terminal. > > So I don't see why you have to issue font "{},20" - it's AFAICS not > valid gnuplot syntax. And it exposes the here reported bug that > rotated ylabel text is no longer rotated - and others: > Try the following: > > set term post enhanced font "Helvetica,14" > set output "test.ps" > set ylabel "foo in mm^2" font ",10" > set label 1 "{/Symbol \\362}@_0^x e^{-x} dx" at  1.0,0.5 left font ",20" > plot x > set output > > set output "test2.ps" > set ylabel "foo in mm^2" font "{},10" > set label 1 "{/Symbol \\362}@_0^x e^{-x} dx" at  1.0,0.5 left font "{},20" > plot x > set output > > I see that test.ps looks fine, but test2.ps has the wrong font for > both the ylabel and the text label. > > I also tested your example in the bug report. >   set(gca,"fontname","*"); >   text(0.5,0.5,'\int_0^x e^(-x) dx','fontsize',20) > and >   set (gca, "fontname", "Arial") >   text(0.5,0.5,'\int_0^x e^(-x) dx','fontsize',20) > both yield the same (correct) result - where the correct result is > that only the "(" parenthesis is displayed as superscript. > And both yield the same result with either the "{},20" or the ",20" > font setting. > > So I am - back at the start - a bit confused as to the original bug report. > What did you see without the "{}" font setting? > > benjamin The original report by Michael Godfrey indicates that when using the FLTK backend and the fontname "*", that TeX style exponentiation did not work. There was no problem for the gnuplot backend. Did you try the examples for the FLTK backend? Ben
Open this post in threaded view
|

## Re: Usage of "{}" as default fontname for gnuplot

 > The original report by Michael Godfrey indicates that when using the FLTK backend and the fontname "*", that TeX style exponentiation did not work. There was no problem for the gnuplot backend. They talked about 'either backend' so I assumed gnuplot was affected as well. If it's a fltk-only problem, then the "{}" fix should probably be specific for fltk? > Did you try the examples for the FLTK backend? With the fltk backend, I don't get any enhanced text processing at all. Even with    text(0.5,0.5,'\int_0^x e^(-x) dx','fontsize',20, 'interpreter', 'tex') The string is shown as literal string (at correct font size & rotation) I am doing this on the release-3-4-0 tag, though, so perhaps I need to abandon it and move to current tip.
Open this post in threaded view
|

## Re: Usage of "{}" as default fontname for gnuplot

 Administrator On Feb 17, 2011, at 7:56 AM, Benjamin Lindner wrote: >> The original report by Michael Godfrey indicates that when using the FLTK backend and the fontname "*", that TeX style exponentiation did not work. There was no problem for the gnuplot backend. > > They talked about 'either backend' so I assumed gnuplot was affected as well. > If it's a fltk-only problem, then the "{}" fix should probably be > specific for fltk? > >> Did you try the examples for the FLTK backend? > > With the fltk backend, I don't get any enhanced text processing at > all. Even with >   text(0.5,0.5,'\int_0^x e^(-x) dx','fontsize',20, 'interpreter', 'tex') > The string is shown as literal string (at correct font size & rotation) > > I am doing this on the release-3-4-0 tag, though, so perhaps I need to > abandon it and move to current tip. Ok. You're seeing the problem that was reported in the bug tracker. If you add the fontname, then it should work.         text(0.5,0.5,'\int_0^x e^(-x) dx','fontsize',20, 'fontname', 'Helvetica', 'interpreter', 'tex') ... assuming you have "Helvetica". We may need to bundle a fsf font with Octave to properly resolved this problem. There are font's available, but I don't know how this would be done. Ben