Font problem with png terminal 2.9.17+

View: New views
15 Messages — Rating Filter:   Alert me  

Font problem with png terminal 2.9.17+

by Fredrik Lingvall :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have this issue with printing to png files:

octave:1> figure(1)
octave:2> plot(randn(100,1))
octave:3> xlabel('x')
octave:4> print -dpng test.png
gdImageStringFT: Could not find/open font while printing string x with
font helvetica

Using gnuplot directly I get this:
gnuplot> set terminal png font helvetica
Terminal type set to 'png'
Could not find/open font when opening font helvetica, using default
Options are 'nocrop medium size 640,480 '

After some googling I found out that  one can set the variable
GDFONTPATH to point
to the TrueType fonts but I have no (and can't find) helvetica.ttf font
file on my (up-to-date)
Gentoo system.

ls /usr/share/fonts/corefonts/ gives:

andalemo.ttf  comic.ttf    encodings.dir  georgiaz.ttf  trebuc.ttf    
verdanai.ttf
arial.ttf     comicbd.ttf  fonts.dir      impact.ttf    trebucbd.ttf  
verdanaz.ttf
arialbd.ttf   cour.ttf     fonts.scale    times.ttf     trebucbi.ttf  
webdings.ttf
arialbi.ttf   courbd.ttf   georgia.ttf    timesbd.ttf   trebucit.ttf
ariali.ttf    courbi.ttf   georgiab.ttf   timesbi.ttf   verdana.ttf
ariblk.ttf    couri.ttf    georgiai.ttf   timesi.ttf    verdanab.ttf

so if I do an export GDFONTPATH=/usr/share/fonts/corefonts/ then, for
example,

gnuplot> set terminal png font arial
Terminal type set to 'png'
Options are 'nocrop font arial 12 size 640,480 '

works fine (but not set terminal png font helvetica).  I'm not sure if
this is
a Gentoo, octave, gnuplot, or gd problem.

/Fredrik




Re: Font problem with png terminal 2.9.17+

by dbateman :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Fredrik Lingvall wrote:
I have this issue with printing to png files:

octave:1> figure(1)
octave:2> plot(randn(100,1))
octave:3> xlabel('x')
octave:4> print -dpng test.png
gdImageStringFT: Could not find/open font while printing string x with
font helvetica
Ok, I couldn't check the png terminal on my rough gnuplot 4.2.2 installation. I suppose that in fact the best way to deal with this is to have a fontname "default" and don't try to set the fontname at all if the fontname is "default". However this might cause issues with the TeX \fontname option, but I think we can live with that


D.

Re: Font problem with png terminal 2.9.17+

by John W. Eaton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On  4-Dec-2007, dbateman wrote:

| Fredrik Lingvall wrote:
| >
| > I have this issue with printing to png files:
| >
| > octave:1> figure(1)
| > octave:2> plot(randn(100,1))
| > octave:3> xlabel('x')
| > octave:4> print -dpng test.png
| > gdImageStringFT: Could not find/open font while printing string x with
| > font helvetica
| >
|
| Ok, I couldn't check the png terminal on my rough gnuplot 4.2.2
| installation. I suppose that in fact the best way to deal with this is to
| have a fontname "default" and don't try to set the fontname at all if the
| fontname is "default". However this might cause issues with the TeX
| \fontname option, but I think we can live with that

I'm not sure I see the need to fix this problem.  Isn't the message
from gnuplot just a warning?

jwe

Re: Font problem with png terminal 2.9.17+

by Fredrik Lingvall :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

John W. Eaton wrote:

> On  4-Dec-2007, dbateman wrote:
>
> | Fredrik Lingvall wrote:
> | >
> | > I have this issue with printing to png files:
> | >
> | > octave:1> figure(1)
> | > octave:2> plot(randn(100,1))
> | > octave:3> xlabel('x')
> | > octave:4> print -dpng test.png
> | > gdImageStringFT: Could not find/open font while printing string x with
> | > font helvetica
> | >
> |
> | Ok, I couldn't check the png terminal on my rough gnuplot 4.2.2
> | installation. I suppose that in fact the best way to deal with this is to
> | have a fontname "default" and don't try to set the fontname at all if the
> | fontname is "default". However this might cause issues with the TeX
> | \fontname option, but I think we can live with that
>
> I'm not sure I see the need to fix this problem.  Isn't the message
> from gnuplot just a warning?
>
> jwe
>  
No, all strings that uses the helvetica font is absent in the png files.
That is,
everything except the axis tick labels.

/F

Re: Font problem with png terminal 2.9.17+

by John W. Eaton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On  4-Dec-2007, Fredrik Lingvall wrote:

| John W. Eaton wrote:
| > On  4-Dec-2007, dbateman wrote:
| >
| > | Fredrik Lingvall wrote:
| > | >
| > | > I have this issue with printing to png files:
| > | >
| > | > octave:1> figure(1)
| > | > octave:2> plot(randn(100,1))
| > | > octave:3> xlabel('x')
| > | > octave:4> print -dpng test.png
| > | > gdImageStringFT: Could not find/open font while printing string x with
| > | > font helvetica
| > | >
| > |
| > | Ok, I couldn't check the png terminal on my rough gnuplot 4.2.2
| > | installation. I suppose that in fact the best way to deal with this is to
| > | have a fontname "default" and don't try to set the fontname at all if the
| > | fontname is "default". However this might cause issues with the TeX
| > | \fontname option, but I think we can live with that
| >
| > I'm not sure I see the need to fix this problem.  Isn't the message
| > from gnuplot just a warning?
| >
| > jwe
| >  
| No, all strings that uses the helvetica font is absent in the png files.
| That is,
| everything except the axis tick labels.

Maybe this should be fixed in gnuplot then, so that it switches to
using the default font if it can't find the one that is specified.

jwe

Re: Font problem with png terminal 2.9.17+

by Fredrik Lingvall :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

John W. Eaton wrote:

> On  4-Dec-2007, Fredrik Lingvall wrote:
>
> | John W. Eaton wrote:
> | > On  4-Dec-2007, dbateman wrote:
> | >
> | > | Fredrik Lingvall wrote:
> | > | >
> | > | > I have this issue with printing to png files:
> | > | >
> | > | > octave:1> figure(1)
> | > | > octave:2> plot(randn(100,1))
> | > | > octave:3> xlabel('x')
> | > | > octave:4> print -dpng test.png
> | > | > gdImageStringFT: Could not find/open font while printing string x with
> | > | > font helvetica
> | > | >
> | > |
> | > | Ok, I couldn't check the png terminal on my rough gnuplot 4.2.2
> | > | installation. I suppose that in fact the best way to deal with this is to
> | > | have a fontname "default" and don't try to set the fontname at all if the
> | > | fontname is "default". However this might cause issues with the TeX
> | > | \fontname option, but I think we can live with that
> | >
> | > I'm not sure I see the need to fix this problem.  Isn't the message
> | > from gnuplot just a warning?
> | >
> | > jwe
> | >  
> | No, all strings that uses the helvetica font is absent in the png files.
> | That is,
> | everything except the axis tick labels.
>
> Maybe this should be fixed in gnuplot then, so that it switches to
> using the default font if it can't find the one that is specified.
>  
Well, it does when when I use gnuplot directly (see my first post) but
not when called from octave.
Then I get the "gdImageStringFT: Could not find/open " messages.

/F

Re: Font problem with png terminal 2.9.17+

by John W. Eaton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On  4-Dec-2007, Fredrik Lingvall wrote:

| Well, it does when when I use gnuplot directly (see my first post) but
| not when called from octave.
| Then I get the "gdImageStringFT: Could not find/open " messages.

OK, I think there is a misunderstanding about what is causing the
message.  I don't think it is any

  set term png font helvetica

command.  Octave doesn't send that.  It sends

  set terminal png enhanced;

The problem is the

  set xlabel "x" textcolor rgb "#000000" font "helvetica,10" rotate by 0.000000;

command that Octave sends.

So it seems to me that it is still a bug in gnuplot that it can
(apparently) figure out that helvetica is missing and fall back on a
default font when the font is specified in the "set term" command but
not when it is specified as part of a "set xlabel" command.

jwe

Re: Font problem with png terminal 2.9.17+

by Tatsuro MATSUOKA-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello

Is this really octave issue?
Did you send a mail gnuplot ML on this issue?

Tatsuro
 

> Using gnuplot directly I get this:
> gnuplot> set terminal png font helvetica
> Terminal type set to 'png'
> Could not find/open font when opening font helvetica, using default
> Options are 'nocrop medium size 640,480 '
>
> After some googling I found out that  one can set the variable
> GDFONTPATH to point
> to the TrueType fonts but I have no (and can't find) helvetica.ttf font
> file on my (up-to-date)
> Gentoo system.
>
> ls /usr/share/fonts/corefonts/ gives:
>
> andalemo.ttf  comic.ttf    encodings.dir  georgiaz.ttf  trebuc.ttf    
> verdanai.ttf
> arial.ttf     comicbd.ttf  fonts.dir      impact.ttf    trebucbd.ttf  
> verdanaz.ttf
> arialbd.ttf   cour.ttf     fonts.scale    times.ttf     trebucbi.ttf  
> webdings.ttf
> arialbi.ttf   courbd.ttf   georgia.ttf    timesbd.ttf   trebucit.ttf
> ariali.ttf    courbi.ttf   georgiab.ttf   timesbi.ttf   verdana.ttf
> ariblk.ttf    couri.ttf    georgiai.ttf   timesi.ttf    verdanab.ttf
>
> so if I do an export GDFONTPATH=/usr/share/fonts/corefonts/ then, for
> example,
>
> gnuplot> set terminal png font arial
> Terminal type set to 'png'
> Options are 'nocrop font arial 12 size 640,480 '
>
> works fine (but not set terminal png font helvetica).  I'm not sure if
> this is
> a Gentoo, octave, gnuplot, or gd problem.
>
> /Fredrik
>
>
>
>


--------------------------------------
New Design Yahoo! JAPAN  2008/01/01
http://pr.mail.yahoo.co.jp/newdesign/

Re: Font problem with png terminal 2.9.17+

by Tatsuro MATSUOKA-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello

Sorry I have misled what you would like to say.

However you should read help of gnuplot carefully.

>From gnuplot help of png terminal

If gnuplot was built with support for TrueType (*.ttf) or Adobe Type 1  (*.pfa) fonts, they may be
selected using the 'font <face> {<pointsize>}'  option. <face> is either the full pathname to the font
file, or a font  face name that is assumed to be the first part of a filename in one of the
directories listed in the GDFONTPATH environmental variable. That is,  'set term png font "Face"' will
look for a font file named either  <somedirectory>/Face.ttf or <somedirectory>/Face.pfa. Both TrueType
and  Adobe Type 1 fonts are fully scalable and may be rotated through any angle. If no font is
specified, gnuplot checks the environmental variable  GNUPLOT_DEFAULT_GDFONT to see if there is a
preferred default font.  


Helvetica font is not a TrueType font.
Helvetica is one of the postscript basic font(Adobe Type 1 ).
Perhaps you need Adode software to get it.
But this is my speculation.
If somebody knows the detailed knowdlge of Adobe fonts, please reply.

John W. Eaton,
I think it is better to use the Arial font instead of Helvetica font for png terminal.  
The Arial is the substituing font of the Helvetica in the ttf fonts.

It will be better to include the modification in 2.9.18.

Tatsuro


--- Tatsuro MATSUOKA <tmacchant@...> wrote:

> Hello
>
> Is this really octave issue?
> Did you send a mail gnuplot ML on this issue?
>
> Tatsuro
>  
> > Using gnuplot directly I get this:
> > gnuplot> set terminal png font helvetica
> > Terminal type set to 'png'
> > Could not find/open font when opening font helvetica, using default
> > Options are 'nocrop medium size 640,480 '
> >
> > After some googling I found out that  one can set the variable
> > GDFONTPATH to point
> > to the TrueType fonts but I have no (and can't find) helvetica.ttf font
> > file on my (up-to-date)
> > Gentoo system.
> >
> > ls /usr/share/fonts/corefonts/ gives:
> >
> > andalemo.ttf  comic.ttf    encodings.dir  georgiaz.ttf  trebuc.ttf    
> > verdanai.ttf
> > arial.ttf     comicbd.ttf  fonts.dir      impact.ttf    trebucbd.ttf  
> > verdanaz.ttf
> > arialbd.ttf   cour.ttf     fonts.scale    times.ttf     trebucbi.ttf  
> > webdings.ttf
> > arialbi.ttf   courbd.ttf   georgia.ttf    timesbd.ttf   trebucit.ttf
> > ariali.ttf    courbi.ttf   georgiab.ttf   timesbi.ttf   verdana.ttf
> > ariblk.ttf    couri.ttf    georgiai.ttf   timesi.ttf    verdanab.ttf
> >
> > so if I do an export GDFONTPATH=/usr/share/fonts/corefonts/ then, for
> > example,
> >
> > gnuplot> set terminal png font arial
> > Terminal type set to 'png'
> > Options are 'nocrop font arial 12 size 640,480 '
> >
> > works fine (but not set terminal png font helvetica).  I'm not sure if
> > this is
> > a Gentoo, octave, gnuplot, or gd problem.
> >
> > /Fredrik
> >
> >
> >
> >
>
>
> --------------------------------------
> New Design Yahoo! JAPAN  2008/01/01
> http://pr.mail.yahoo.co.jp/newdesign/
>



--------------------------------------
New Design Yahoo! JAPAN  2008/01/01
http://pr.mail.yahoo.co.jp/newdesign/

Re: Font problem with png terminal 2.9.17+

by John W. Eaton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On  5-Dec-2007, Tatsuro MATSUOKA wrote:

| John W. Eaton,
| I think it is better to use the Arial font instead of Helvetica font for png terminal.  
| The Arial is the substituing font of the Helvetica in the ttf fonts.

Matlab defaults to Helvetica.  I'll bet that if we make the default
Arial, someone will report the difference as a bug.

jwe

Re: Font problem with png terminal 2.9.17+

by Tatsuro MATSUOKA-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Fredrik and John W. Eaton

Please disregard the previous mail.
Sorry for my carelessness.

Hi Fredrik
Sorry I have misled what you would like to say.

However you should read help of gnuplot carefully.

>From gnuplot help of png terminal

If gnuplot was built with support for TrueType (*.ttf) or Adobe Type 1  (*.pfa) fonts, they may be
selected using the 'font <face> {<pointsize>}'  option. <face> is either the full pathname to the font
file, or a font  face name that is assumed to be the first part of a filename in one of the
directories listed in the GDFONTPATH environmental variable. That is,  'set term png font "Face"' will
look for a font file named either  <somedirectory>/Face.ttf or <somedirectory>/Face.pfa. Both TrueType
and  Adobe Type 1 fonts are fully scalable and may be rotated through any angle. If no font is
specified, gnuplot checks the environmental variable  GNUPLOT_DEFAULT_GDFONT to see if there is a
preferred default font.  


Helvetica font is not a TrueType font.
Helvetica is one of the postscript basic font(Adobe Type 1 ).
Perhaps you need Adode software to get it.
But this is my speculation.
If somebody knows the detailed knowdlge of Adobe fonts, please reply.


Hi John W. Eaton,
I think it is better to use the Arial font instead of Helvetica font for png terminal.  
The Arial font is the substituing font of the Helvetica in the ttf fonts.

It will be better to include the modification in 2.9.18.

Tatsuro


--- Tatsuro MATSUOKA <tmacchant@...> wrote:

> Hello
>
> Is this really octave issue?
> Did you send a mail gnuplot ML on this issue?
>
> Tatsuro
>  
> > Using gnuplot directly I get this:
> > gnuplot> set terminal png font helvetica
> > Terminal type set to 'png'
> > Could not find/open font when opening font helvetica, using default
> > Options are 'nocrop medium size 640,480 '
> >
> > After some googling I found out that  one can set the variable
> > GDFONTPATH to point
> > to the TrueType fonts but I have no (and can't find) helvetica.ttf font
> > file on my (up-to-date)
> > Gentoo system.
> >
> > ls /usr/share/fonts/corefonts/ gives:
> >
> > andalemo.ttf  comic.ttf    encodings.dir  georgiaz.ttf  trebuc.ttf    
> > verdanai.ttf
> > arial.ttf     comicbd.ttf  fonts.dir      impact.ttf    trebucbd.ttf  
> > verdanaz.ttf
> > arialbd.ttf   cour.ttf     fonts.scale    times.ttf     trebucbi.ttf  
> > webdings.ttf
> > arialbi.ttf   courbd.ttf   georgia.ttf    timesbd.ttf   trebucit.ttf
> > ariali.ttf    courbi.ttf   georgiab.ttf   timesbi.ttf   verdana.ttf
> > ariblk.ttf    couri.ttf    georgiai.ttf   timesi.ttf    verdanab.ttf
> >
> > so if I do an export GDFONTPATH=/usr/share/fonts/corefonts/ then, for
> > example,
> >
> > gnuplot> set terminal png font arial
> > Terminal type set to 'png'
> > Options are 'nocrop font arial 12 size 640,480 '
> >
> > works fine (but not set terminal png font helvetica).  I'm not sure if
> > this is
> > a Gentoo, octave, gnuplot, or gd problem.
> >
> > /Fredrik


--------------------------------------
New Design Yahoo! JAPAN  2008/01/01
http://pr.mail.yahoo.co.jp/newdesign/

Re: Font problem with png terminal 2.9.17+

by Tatsuro MATSUOKA-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

JWE wrote
| John W. Eaton,
| I think it is better to use the Arial font instead of Helvetica font for png terminal.  
| The Arial is the substituing font of the Helvetica in the ttf fonts.

Matlab defaults to Helvetica.  I'll bet that if we make the default
Arial, someone will report the difference as a bug.

jwe
**************
Thank for your reply.

What you would like to say is:
Use by yourself Arial font by '-Ffontname' like -FArial.
Right ?

If it is so, I agree with you.

Thanks

Tatsuro

--------------------------------------
New Design Yahoo! JAPAN  2008/01/01
http://pr.mail.yahoo.co.jp/newdesign/

Re: Font problem with png terminal 2.9.17+

by John W. Eaton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On  4-Dec-2007, dbateman wrote:

| Fredrik Lingvall wrote:
| >
| > I have this issue with printing to png files:
| >
| > octave:1> figure(1)
| > octave:2> plot(randn(100,1))
| > octave:3> xlabel('x')
| > octave:4> print -dpng test.png
| > gdImageStringFT: Could not find/open font while printing string x with
| > font helvetica
| >
|
| Ok, I couldn't check the png terminal on my rough gnuplot 4.2.2
| installation. I suppose that in fact the best way to deal with this is to
| have a fontname "default" and don't try to set the fontname at all if the
| fontname is "default". However this might cause issues with the TeX
| \fontname option, but I think we can live with that

OK, I see this problem also bites us when generating png files for the
HTML manual.  I think the following patch does what you propose above,
except it uses "*" instead of "default" to specify the default font.
If you think "default" is better, then it is easy enough to change.

Unfortunately, we still have the following problem:

  ../../run-octave -f -q -H -p /home/jwe/src/octave-trunk/doc/interpreter --eval "plotimages ('extended', 'png');"
  gdImageStringFT: Could not find/open font while printing string ¬ with font Symbol
  gdImageStringFT: Could not find/open font while printing string  x =  with font
  gdImageStringFT: Could not find/open font while printing string 2/ with font
  gdImageStringFT: Could not find/open font while printing string Ö with font Symbol
  gdImageStringFT: Could not find/open font while printing string p with font Symbol
  gdImageStringFT: Could not find/open font while printing string   with font
  gdImageStringFT: Could not find/open font while printing string ò with font Symbol
  gdImageStringFT: Could not find/open font while printing string 0 with font
  gdImageStringFT: Could not find/open font while printing string x with font
  gdImageStringFT: Could not find/open font while printing string  e with font
  gdImageStringFT: Could not find/open font while printing string -t with font
  gdImageStringFT: Could not find/open font while printing string 2 with font
  gdImageStringFT: Could not find/open font while printing string  dt with font
  gdImageStringFT: Could not find/open font while printing string  = 0.6175 with font

We could avoid this problem by not including "png" in the list of
"enhanced" terminals, but I'm not sure that is the best solution.  If
there is a symbol font that can be used with gnuplot's png terminal,
then I would simply use it.  If this is possible, will someone please
explain how to do it?

I think we should leave the default fontname property value
"Helvetica".  It is easy enough to globally change the default
property for all figures using

  set (0, "defaulttextfontname", "*");

in your ~/.octaverc file.

jwe



scripts/ChangeLog:

2007-12-04  John W. Eaton  <jwe@...>

        * plot/__go_draw_axes__.m: Omit "font \"NAME,SIZE\"" in gnuplot
        text and label commands if font is "*".

doc/ChangeLog:

2007-12-04  John W. Eaton  <jwe@...>

        * interpreter/sparseimages.m, interpreter/plotimages.m,
        interpreter/interpimages.m, interpreter/geometryimages.m:
        Set default text font to "*" for png images.


Index: scripts/plot/__go_draw_axes__.m
===================================================================
RCS file: /cvs/octave/scripts/plot/__go_draw_axes__.m,v
retrieving revision 1.84
diff -u -u -r1.84 __go_draw_axes__.m
--- scripts/plot/__go_draw_axes__.m 3 Dec 2007 20:16:36 -0000 1.84
+++ scripts/plot/__go_draw_axes__.m 5 Dec 2007 01:09:38 -0000
@@ -74,8 +74,13 @@
       else
  [tt, f, s] = __maybe_munge_text__ (enhanced, t, "string",
    have_newer_gnuplot);
- fprintf (plot_stream, "set title \"%s\" font \"%s,%d\";\n",
- undo_string_escapes (tt), f, s);
+ if (strcmp (f, "*"))
+  fontspec = "";
+ else
+  fontspec = sprintf ("font \"%s,%d\"", f, s);
+ endif
+ fprintf (plot_stream, "set title \"%s\" %s;\n",
+ undo_string_escapes (tt), fontspec);
       endif
     endif
 
@@ -89,12 +94,17 @@
       else
  [tt, f, s] = __maybe_munge_text__ (enhanced, t, "string",
    have_newer_gnuplot);
+ if (strcmp (f, "*"))
+  fontspec = "";
+ else
+  fontspec = sprintf ("font \"%s,%d\"", f, s);
+ endif
  if (strcmpi (axis_obj.xaxislocation, "top"))
-  fprintf (plot_stream, "set x2label \"%s\" %s font \"%s,%d\"",
-   undo_string_escapes (tt), colorspec, f, s);
+  fprintf (plot_stream, "set x2label \"%s\" %s %s",
+   undo_string_escapes (tt), colorspec, fontspec);
  else
-  fprintf (plot_stream, "set xlabel \"%s\" %s font \"%s,%d\"",
-   undo_string_escapes (tt), colorspec, f, s);
+  fprintf (plot_stream, "set xlabel \"%s\" %s %s",
+   undo_string_escapes (tt), colorspec, fontspec);
  endif
  if (have_newer_gnuplot)
   ## Rotation of xlabel not yet support by gnuplot as of 4.2, but
@@ -120,12 +130,17 @@
       else
  [tt, f, s] = __maybe_munge_text__ (enhanced, t, "string",
    have_newer_gnuplot);
+ if (strcmp (f, "*"))
+  fontspec = "";
+ else
+  fontspec = sprintf ("font \"%s,%d\"", f, s);
+ endif
  if (strcmpi (axis_obj.yaxislocation, "right"))
-  fprintf (plot_stream, "set y2label \"%s\" %s font \"%s,%d\"",
-   undo_string_escapes (tt), colorspec, f, s);
+  fprintf (plot_stream, "set y2label \"%s\" %s %s",
+   undo_string_escapes (tt), colorspec, fontspec);
  else
-  fprintf (plot_stream, "set ylabel \"%s\" %s font \"%s,%d\"",
-   undo_string_escapes (tt), colorspec, f, s);
+  fprintf (plot_stream, "set ylabel \"%s\" %s %s",
+   undo_string_escapes (tt), colorspec, fontspec);
  endif
  if (have_newer_gnuplot)
   fprintf (plot_stream, " rotate by %f;\n", angle);
@@ -148,8 +163,13 @@
       else
  [tt, f, s] = __maybe_munge_text__ (enhanced, t, "string",
    have_newer_gnuplot);
- fprintf (plot_stream, "set zlabel \"%s\" %s font \"%s,%d\"",
- undo_string_escapes (tt), colorspec, f, s);
+ if (strcmp (f, "*"))
+  fontspec = "";
+ else
+  fontspec = sprintf ("font \"%s,%d\"", f, s);
+ endif
+ fprintf (plot_stream, "set zlabel \"%s\" %s %s",
+ undo_string_escapes (tt), colorspec, fontspec);
  if (have_newer_gnuplot)
   ## Rotation of zlabel not yet support by gnuplot as of 4.2, but
   ## there is no message about it.
@@ -913,6 +933,11 @@
  case "text"
   [label, f, s] = __maybe_munge_text__ (enhanced, obj, "string",
  have_newer_gnuplot);
+  if (strcmp (f, "*"))
+    fontspec = "";
+  else
+    fontspec = sprintf ("font \"%s,%d\"", f, s);
+  endif
   lpos = obj.position;
   halign = obj.horizontalalignment;
   angle = obj.rotation;
@@ -930,14 +955,14 @@
 
   if (nd == 3)
     fprintf (plot_stream,
-     "set label \"%s\" at %s %.15g,%.15g,%.15g font \"%s,%d\" %s rotate by %f %s;\n",
+     "set label \"%s\" at %s %.15g,%.15g,%.15g %s %s rotate by %f %s;\n",
      undo_string_escapes (label), units, lpos(1),
-     lpos(2), lpos(3), f, s, halign, angle, colorspec);
+     lpos(2), lpos(3), fontspec, halign, angle, colorspec);
   else
     fprintf (plot_stream,
-     "set label \"%s\" at %s %.15g,%.15g font \"%s,%d\" %s rotate by %f %s;\n",
+     "set label \"%s\" at %s %.15g,%.15g %s %s rotate by %f %s;\n",
      undo_string_escapes (label), units,
-     lpos(1), lpos(2), f, s, halign, angle, colorspec);
+     lpos(1), lpos(2), fontspec, halign, angle, colorspec);
   endif
 
  otherwise
Index: doc/interpreter/geometryimages.m
===================================================================
RCS file: /cvs/octave/doc/interpreter/geometryimages.m,v
retrieving revision 1.5
diff -u -u -r1.5 geometryimages.m
--- doc/interpreter/geometryimages.m 13 Oct 2007 00:52:12 -0000 1.5
+++ doc/interpreter/geometryimages.m 5 Dec 2007 01:09:37 -0000
@@ -18,6 +18,9 @@
 
 function geometryimages (nm, typ)
   bury_output ();
+  if (strcmp (typ, "png"))
+    set (0, "defaulttextfontname", "*");
+  endif
   if (isempty (findstr (octave_config_info ("DEFS"), "HAVE_QHULL"))
       && (strcmp (nm, "voronoi") || strcmp (nm, "griddata")
   || strcmp (nm, "convhull") || strcmp (nm, "delaunay")
Index: doc/interpreter/interpimages.m
===================================================================
RCS file: /cvs/octave/doc/interpreter/interpimages.m,v
retrieving revision 1.4
diff -u -u -r1.4 interpimages.m
--- doc/interpreter/interpimages.m 13 Oct 2007 00:52:12 -0000 1.4
+++ doc/interpreter/interpimages.m 5 Dec 2007 01:09:37 -0000
@@ -18,6 +18,9 @@
 
 function interpimages (nm, typ)
   bury_output ();
+  if (strcmp (typ, "png"))
+    set (0, "defaulttextfontname", "*");
+  endif
   if (strcmp (nm, "interpft"))
     t = 0 : 0.3 : pi; dt = t(2)-t(1);
     n = length (t); k = 100;
Index: doc/interpreter/plotimages.m
===================================================================
RCS file: /cvs/octave/doc/interpreter/plotimages.m,v
retrieving revision 1.4
diff -u -u -r1.4 plotimages.m
--- doc/interpreter/plotimages.m 5 Dec 2007 01:08:17 -0000 1.4
+++ doc/interpreter/plotimages.m 5 Dec 2007 01:09:37 -0000
@@ -18,6 +18,9 @@
 
 function plotimages (nm, typ)
   bury_output ();
+  if (strcmp (typ, "png"))
+    set (0, "defaulttextfontname", "*");
+  endif
   if (strcmp(typ , "txt"))
     image_as_txt(nm);
   elseif (strcmp (nm, "plot"))
Index: doc/interpreter/sparseimages.m
===================================================================
RCS file: /cvs/octave/doc/interpreter/sparseimages.m,v
retrieving revision 1.8
diff -u -u -r1.8 sparseimages.m
--- doc/interpreter/sparseimages.m 5 Dec 2007 01:08:17 -0000 1.8
+++ doc/interpreter/sparseimages.m 5 Dec 2007 01:09:37 -0000
@@ -17,6 +17,9 @@
 ## <http://www.gnu.org/licenses/>.
 
 function sparseimages (nm, typ)
+  if (strcmp (typ, "png"))
+    set (0, "defaulttextfontname", "*");
+  endif
   if (! isempty (findstr (octave_config_info ("DEFS"), "HAVE_COLAMD"))
       && ! isempty (findstr (octave_config_info ("DEFS"), "HAVE_CHOLMOD"))
       && ! isempty (findstr (octave_config_info ("DEFS"), "HAVE_UMFPACK")))

Re: Font problem with png terminal 2.9.17+

by Tatsuro MATSUOKA-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello

The png terminal can be enhanced mode.

       G N U P L O T
        Version 4.2 patchlevel 2      
gnuplot> set terminal png enhanced
Terminal type set to 'png'
Options are 'nocrop enhanced medium '

Help
      set terminal png
             {{no}transparent} {{no}interlace}
             {{no}truecolor} {rounded|butt}
             {tiny | small | medium | large | giant}
             {font <face> {<pointsize>}}
             {size <x>,<y>} {{no}crop}
             {{no}enhanced}
             {<color0> <color1> <color2> ...}

I am against to list out png terminal from enhanced list.
The png terminal is the most useful bitmap terminal for the gnuplot.

>From gnuplot manual for wxt
********
Alternatively, the OpenSymbol font, distributed with OpenOffice.org as "opens___.ttf", offers the same
characters. Microsoft has distributed a Symbol font ("symbol.ttf"), but it has a different character
set with several missing or moved mathematic characters. If you experience problems with your default
setup (if the demo enhancedtext.dem is not displayed properly for example), you probably have to
install one of the Adobe or OpenOffice Symbol fonts, and remove the Microsoft one. Other non-conform
fonts, such as "wingdings" have been observed working.
*********

Open office have OpenSymbol.ttf.

But Note that it has a different character set from Microsoft symbol.ttf described above.

Tatsuro


--- "John W. Eaton" <jwe@...> wrote:

> We could avoid this problem by not including "png" in the list of
> "enhanced" terminals, but I'm not sure that is the best solution.  If
> there is a symbol font that can be used with gnuplot's png terminal,
> then I would simply use it.  If this is possible, will someone please
> explain how to do it?
>
> I think we should leave the default fontname property value
> "Helvetica".  It is easy enough to globally change the default
> property for all figures using
>
>   set (0, "defaulttextfontname", "*");
>
> in your ~/.octaverc file.
>
> jwe
>
>

--------------------------------------
New Design Yahoo! JAPAN  2008/01/01
http://pr.mail.yahoo.co.jp/newdesign/

OpenSymbol.jpg (51K) Download Attachment

Re: Font problem with png terminal 2.9.17+

by Tatsuro MATSUOKA-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello

Sorry my carelessness and misled again.
 

> >From gnuplot manual for wxt
> ********
> Alternatively, the OpenSymbol font, distributed with OpenOffice.org as "opens___.ttf", offers
> the same
> characters. Microsoft has distributed a Symbol font ("symbol.ttf"), but it has a different
> character
> set with several missing or moved mathematic characters. If you experience problems with your
> default
> setup (if the demo enhancedtext.dem is not displayed properly for example), you probably have to
> install one of the Adobe or OpenOffice Symbol fonts, and remove the Microsoft one. Other
> non-conform
> fonts, such as "wingdings" have been observed working.
> *********
>
> Open office have OpenSymbol.ttf. (<--- Wrong)
 Open office has "opens___.ttf"

How to use enhaned text in png term. (for windows)

Set GDFONTPATH=c:\windows\font

C:\>wgnuplot

gnuplot> set term png enh font times 14
Terminal type set to 'png'
Options are 'nocrop enhanced font times 14 size 640,480 xffffff x000000 xa0a0a0
xff0000 x00c000 x0080ff xc000ff x00eeee xc04000 xeeee00 x2020c0 xffc020 x008040
xa080ff x804000 xff80ff x00c060 x00c0c0 x006080 xc06080 x008000 x40ff80 x306080
x806000 x404040 x408000 x000080 x806010 x806060 x806080 x0000c0 x0000ff x006000
xe3b0c0 x40c080 x60a0c0 x60c000 x60c0a0 x800000 x800080 x602080 x606060 x202020
x204040 x204080 x608020 x608060 x608080 x808040 x208020 x808080 xa0a0a0 xa0d0e0
xc02020 x008080 xc06000 x80c0e0 xc060c0 xc08000 xc08060 xff4000 xff4040 x80c0ff
xff8060 xff8080 xc0a000 xc0c0c0 xc0ffc0 xff0000 xff00ff xff80a0 xc0c0a0 xff6060
x00ff00 xff8000 xffa000 x80e0e0 xa0e0e0 xa0ff20 xc00000 xc000c0 xa02020 xa020ff
x802000 x802020 x804020 x804080 x8060c0 x8060ff x808000 xc0c000 xff8040 xffa040
xffa060 xffa070 xffc0c0 xffff00 xffff80 xffffc0 '            

gnuplot> set xlabel 'Time (10^6 {/Symbol m}s)'
gnuplot> set out 'test.png'
gnuplot>  plot sin(x)
gnuplot> set out

The above worked well.

OpenSymbol seems to use the unicode, it did not worked well.

This topic is out of scope of octave.
I will ask the issue at gnuplot ML.
If there is a windows like free symbol.ttf, all things will be solved.

Right?

Regards

Tatsuro




--------------------------------------
New Design Yahoo! JAPAN  2008/01/01
http://pr.mail.yahoo.co.jp/newdesign/