|
From: Ethan M. <merritt@u.washington.edu> - 2009-04-13 15:56:55
|
Now I'm confused. Is it true that libgd now looks for fontconfig? ---------- Forwarded Message ---------- Subject: [GD-DEVEL] Re: gd2 & fontconfig/freetype fail to find fonts on Mac OS X (macports) Date: Monday 13 April 2009 From: Ryan Schmidt <rya...@ma...> To: Mojca Miklavec <moj...@gm...> On Apr 13, 2009, at 01:47, Mojca Miklavec wrote: > I'm using Mac OS X 10.5 with GD installed via Macports > (http://gd2.darwinports.com/) and as many others (I think both linux > and mac users), I have problem using some deafult fonts inside gnuplot > when using GD library to generate plots. Please do not refer to that web site for information about MacPorts. That web site is not affiliated with the MacPorts project. For information about MacPorts, go to http://www.macports.org/ For more information on the web site that is not related to our project, please read: http://trac.macports.org/wiki/DarwinPorts >> gnuplot >> set term png > Terminal type set to 'png' > Could not find/open font when opening font "arial", using internal > non-scalable font > Options are 'nocrop medium size 640,480 ' > > Please note that this only happens with recent (maybe only > development) version of gnuplot. I'm working with 4.3 from CVS. In > past, gnuplot simply ignored the fact the GD was not able to find > trutype fonts, it's only recently that it issues a warning. > > But the font in available on computer of course and "fc-list arial" > returns this (+ dozens of translations): > > Arial:style=Bold Italic > Arial:style=Italic > Arial:style=Regular > Arial:style=Bold > > Following instructions on http://www.libgd.org/DOC_INSTALL_OSX I > tried to set > export GDFONTPATH=$HOME/Library/Fonts:/Library/Fonts:/System/ > Library/Fonts > and afterwards it worked OK. > > But the main question is: why doesn't GD find the font out-of-the-box, > without having to give it a hint about GDFONTPATH? It may be a problem > with configuration in macports that ships this library, but it > probably makes more sense to ask here first. I can try to play a bit > with installation following your instructions and then ask on macports > to change some bits in configuration if needed. What I understand from reading that DOC_INSTALL_OSX page you referenced above is that setting GDFONTPATH is only necessary if fontconfig cannot be found. But the gd2 port does declare a dependency on the fontconfig port so it should be there. If there is something I need to change in the gd2 port or the fontconfig port related to this, please copy me on the replies; I am not subscribed to the gd-devel mailing list. -- GD Devel Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ------------------------------------------------------- -- Ethan A Merritt Biomolecular Structure Center University of Washington, Seattle 98195-7742 |
|
From: Pierre J. <pie...@gm...> - 2009-04-13 16:10:28
|
no, only if you tell it to do so. On Mon, Apr 13, 2009 at 5:56 PM, Ethan Merritt <merritt@u.washington.edu> wrote: > Now I'm confused. > Is it true that libgd now looks for fontconfig? > > > ---------- Forwarded Message ---------- > > Subject: [GD-DEVEL] Re: gd2 & fontconfig/freetype fail to find fonts on Mac OS X (macports) > Date: Monday 13 April 2009 > From: Ryan Schmidt <rya...@ma...> > To: Mojca Miklavec <moj...@gm...> > > On Apr 13, 2009, at 01:47, Mojca Miklavec wrote: > >> I'm using Mac OS X 10.5 with GD installed via Macports >> (http://gd2.darwinports.com/) and as many others (I think both linux >> and mac users), I have problem using some deafult fonts inside gnuplot >> when using GD library to generate plots. > > Please do not refer to that web site for information about MacPorts. > That web site is not affiliated with the MacPorts project. For > information about MacPorts, go to > > http://www.macports.org/ > > For more information on the web site that is not related to our > project, please read: > > http://trac.macports.org/wiki/DarwinPorts > > >>> gnuplot >>> set term png >> Terminal type set to 'png' >> Could not find/open font when opening font "arial", using internal >> non-scalable font >> Options are 'nocrop medium size 640,480 ' >> >> Please note that this only happens with recent (maybe only >> development) version of gnuplot. I'm working with 4.3 from CVS. In >> past, gnuplot simply ignored the fact the GD was not able to find >> trutype fonts, it's only recently that it issues a warning. >> >> But the font in available on computer of course and "fc-list arial" >> returns this (+ dozens of translations): >> >> Arial:style=Bold Italic >> Arial:style=Italic >> Arial:style=Regular >> Arial:style=Bold >> >> Following instructions on http://www.libgd.org/DOC_INSTALL_OSX I >> tried to set >> export GDFONTPATH=$HOME/Library/Fonts:/Library/Fonts:/System/ >> Library/Fonts >> and afterwards it worked OK. >> >> But the main question is: why doesn't GD find the font out-of-the-box, >> without having to give it a hint about GDFONTPATH? It may be a problem >> with configuration in macports that ships this library, but it >> probably makes more sense to ask here first. I can try to play a bit >> with installation following your instructions and then ask on macports >> to change some bits in configuration if needed. > > What I understand from reading that DOC_INSTALL_OSX page you > referenced above is that setting GDFONTPATH is only necessary if > fontconfig cannot be found. But the gd2 port does declare a > dependency on the fontconfig port so it should be there. > > If there is something I need to change in the gd2 port or the > fontconfig port related to this, please copy me on the replies; I am > not subscribed to the gd-devel mailing list. > > > > -- > GD Devel Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > ------------------------------------------------------- > > -- > Ethan A Merritt > Biomolecular Structure Center > University of Washington, Seattle 98195-7742 > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by: > High Quality Requirements in a Collaborative Environment. > Download a free trial of Rational Requirements Composer Now! > http://p.sf.net/sfu/www-ibm-com > _______________________________________________ > gnuplot-beta mailing list > gnu...@li... > https://lists.sourceforge.net/lists/listinfo/gnuplot-beta > -- Pierre http://blog.thepimp.net | http://www.libgd.org |
|
From: Ethan M. <merritt@u.washington.edu> - 2009-04-13 20:51:14
|
I wrote>
> In fact, contrary to the documentation, passing 0 to gdFTUseFontConfig()
> seems to enable fontconfig all by itself, so it is unsafe to use this for
> a test either.
>
> Is that correct?
> If so, is there a work-around?
> Can we expect a fix?
And here is the fix, courtesy of Mojca Miklavec.
Tested using gnuplot and "set term png font '...'"
Can this please be included in 2.0.36?
regards,
Ethan
--- gdft.c.sav 2009-04-13 13:38:18.000000000 -0700
+++ gdft.c 2009-04-13 13:38:52.000000000 -0700
@@ -1661,7 +1661,7 @@ static char * font_path(char **fontpath,
BGD_DECLARE(int) gdFTUseFontConfig(int flag)
{
#ifdef HAVE_LIBFONTCONFIG
- fontConfigFlag = 1;
+ fontConfigFlag = flag;
return 1;
#else
return 0;
--
Ethan A Merritt
Biomolecular Structure Center
University of Washington, Seattle 98195-7742
|
|
From: Mojca M. <moj...@gm...> - 2009-04-13 16:33:15
|
On Mon, Apr 13, 2009 at 17:56, Ethan Merritt wrote:
> Now I'm confused.
> Is it true that libgd now looks for fontconfig?
Hello,
I'm sorry if I caused any confusion. Thanks to the main developer of
GD for clearing it out, after adding the following command to gd.trm
gdFTUseFontConfig(1);
gnuplot stoped complaining about "arial not found".
See:
http://lib.gd/Font#int_gdFTUseFontConfig.28int_flag.29_.28FUNCTION.29
Would it be possible to fix gnuplot in that respect? I'm not sure
where this command should go, and I'm not sure how to make sure that
providing comlete path to some font will still work, but it would be
really nice to both prevent throwing that error about font not found
and to enable searching for font system-wide.
Mojca
|
|
From: Ethan M. <merritt@u.washington.edu> - 2009-04-13 19:55:16
|
On Monday 13 April 2009 09:10:23 Pierre Joye wrote:
> On Mon, Apr 13, 2009 at 5:56 PM, Ethan Merritt <merritt@u.washington.edu> wrote:
>> Is it true that libgd now looks for fontconfig?
> no, only if you tell it to do so.
I now see that Mojca has pointed out the function gdFTUseFontConfig(),
which I did not know about. This looks very promising, and I think we should
use it to try both the old (GDFONTPATH) and new (fontconfig) mechanisms when
looking for a user-specified font.
However, I coded up a quick test patch for gnuplot's gd driver and ran into
the following problem. Perhaps I am doing something wrong:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
/* First try the old GDFONTPATH mechanism for locating fonts */
gdFTUseFontConfig(0);
err = gdImageStringFT(NULL, &brect[0], 0,
png_state.ttffont, (double)png_state.default_ttfsize,
0.0, 0, 0, "test");
/* If that didn't work, try again using fontconfig mechanism */
if (err && gdFTUseFontConfig(1)) {
err = gdImageStringFT(NULL, &brect[0], 0,
png_state.ttffont, (double)png_state.default_ttfsize,
0.0, 0, 0, "test");
fprintf(stderr,"fontconfig %s font %s\n",
err ? "did not find" : "found",
png_state.ttffont);
}
/* If we still haven't found the font, punt to the internal non-TTF default set */
if (err) {
fprintf(stderr,"%s when opening font \"%s\", using internal non-scalable font\n",
err, png_state.ttffont);
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
This works great the first time through. If the font is not found by file-name in
GDFONTPATH, then it switches over to use fontconfig and correctly finds the font.
However, on subsequent calls it fails if you do in fact provide a file name.
As best as I can make out, gdFTUseFontConfig(1) enables the fontconfig mechanism
but gdFTUseFontConfig(0) does not disable it again.
In fact, contrary to the documentation, passing 0 to gdFTUseFontConfig() seems to
enable fontconfig all by itself, so it is unsafe to use this for a test either.
Is that correct?
If so, is there a work-around?
Can we expect a fix?
Ethan
> On Mon, Apr 13, 2009 at 5:56 PM, Ethan Merritt <merritt@u.washington.edu> wrote:
> > Now I'm confused.
> > Is it true that libgd now looks for fontconfig?
> >
> >
> > ---------- Forwarded Message ----------
> >
> > Subject: [GD-DEVEL] Re: gd2 & fontconfig/freetype fail to find fonts on Mac OS X (macports)
> > Date: Monday 13 April 2009
> > From: Ryan Schmidt <rya...@ma...>
> > To: Mojca Miklavec <moj...@gm...>
> >
> > On Apr 13, 2009, at 01:47, Mojca Miklavec wrote:
> >
> >> I'm using Mac OS X 10.5 with GD installed via Macports
> >> (http://gd2.darwinports.com/) and as many others (I think both linux
> >> and mac users), I have problem using some deafult fonts inside gnuplot
> >> when using GD library to generate plots.
> >
> > Please do not refer to that web site for information about MacPorts.
> > That web site is not affiliated with the MacPorts project. For
> > information about MacPorts, go to
> >
> > http://www.macports.org/
> >
> > For more information on the web site that is not related to our
> > project, please read:
> >
> > http://trac.macports.org/wiki/DarwinPorts
> >
> >
> >>> gnuplot
> >>> set term png
> >> Terminal type set to 'png'
> >> Could not find/open font when opening font "arial", using internal
> >> non-scalable font
> >> Options are 'nocrop medium size 640,480 '
> >>
> >> Please note that this only happens with recent (maybe only
> >> development) version of gnuplot. I'm working with 4.3 from CVS. In
> >> past, gnuplot simply ignored the fact the GD was not able to find
> >> trutype fonts, it's only recently that it issues a warning.
> >>
> >> But the font in available on computer of course and "fc-list arial"
> >> returns this (+ dozens of translations):
> >>
> >> Arial:style=Bold Italic
> >> Arial:style=Italic
> >> Arial:style=Regular
> >> Arial:style=Bold
> >>
> >> Following instructions on http://www.libgd.org/DOC_INSTALL_OSX I
> >> tried to set
> >> export GDFONTPATH=$HOME/Library/Fonts:/Library/Fonts:/System/
> >> Library/Fonts
> >> and afterwards it worked OK.
> >>
> >> But the main question is: why doesn't GD find the font out-of-the-box,
> >> without having to give it a hint about GDFONTPATH? It may be a problem
> >> with configuration in macports that ships this library, but it
> >> probably makes more sense to ask here first. I can try to play a bit
> >> with installation following your instructions and then ask on macports
> >> to change some bits in configuration if needed.
> >
> > What I understand from reading that DOC_INSTALL_OSX page you
> > referenced above is that setting GDFONTPATH is only necessary if
> > fontconfig cannot be found. But the gd2 port does declare a
> > dependency on the fontconfig port so it should be there.
> >
> > If there is something I need to change in the gd2 port or the
> > fontconfig port related to this, please copy me on the replies; I am
> > not subscribed to the gd-devel mailing list.
> >
> >
> >
> > --
> > GD Devel Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> > -------------------------------------------------------
> >
> > --
> > Ethan A Merritt
> > Biomolecular Structure Center
> > University of Washington, Seattle 98195-7742
> >
> > ------------------------------------------------------------------------------
> > This SF.net email is sponsored by:
> > High Quality Requirements in a Collaborative Environment.
> > Download a free trial of Rational Requirements Composer Now!
> > http://p.sf.net/sfu/www-ibm-com
> > _______________________________________________
> > gnuplot-beta mailing list
> > gnu...@li...
> > https://lists.sourceforge.net/lists/listinfo/gnuplot-beta
> >
>
>
>
> --
> Pierre
>
> http://blog.thepimp.net | http://www.libgd.org
>
--
Ethan A Merritt
Biomolecular Structure Center
University of Washington, Seattle 98195-7742
|
|
From: Mojca M. <moj...@gm...> - 2009-04-13 21:20:22
|
On Mon, Apr 13, 2009 at 22:46, Ethan Merritt wrote: > On Monday 13 April 2009 13:21:40 you wrote: >> What happens if you change the source code in gdft.c inside gd >> library? > > Yes, that works. > But even if the next libgd release contains this fix, it will take some > time to propagate to everyone's installed machines. Though it will take some time before gnuplot propagates to everyone's machine as well :( I don't know how you handle dependencies on new versions of libraries, but I would suggest to fix as soon as the fixed version of gd comes out. It will take a while before next gnuplot version/patchset comes out anyway and those who work with cvs version should know how to help themselves (not always true, but people using cvs version should be prepared for occasional problems at least). If I understand it properly, one is unable to use fonts with full path names if you call the buggy gdFTUseFontConfig at least once? (The bad news is that this used to be the only method to use any font in past.) May I suggest at least something not-so-related? The message Could not find/open font when opening font "arial", using internal non-scalable font is a bit annoying, pops up everywhere (at the moment) and doesn't tell anything useful to the user. I suggest rewriting the message and stating that one could try to set GDFONTPATH manually. (It took me a while to figure that out.) On the other hand, gnuplot could also provide feedback like "GD library has no fontconfig support, you can set GDFONTPATH manually. Using internal non-scalable font." (Just saying that "arial" could not be found is far from helpful and it's particularly annoying for newbie users since it pops up every time "by default" ... well, at least annoying enough that I was ready to learn some gd basics :) :) Mojca PS: I agree with the one who mentioned it that there also needs to be a way to request the default (build-in) font even if arial starts working out-of-the-box. |
|
From: Ethan M. <merritt@u.washington.edu> - 2009-04-13 23:00:51
|
On Monday 13 April 2009 14:20:19 Mojca Miklavec wrote: > > May I suggest at least something not-so-related? The message > Could not find/open font when opening font "arial", using internal > non-scalable font > is a bit annoying, pops up everywhere (at the moment) and doesn't tell > anything useful to the user. I suggest rewriting the message and > stating that one could try to set GDFONTPATH manually. (It took me a > while to figure that out.) We could print an additional message if you like. Would that be preferable, or would it be even more annoying? Maybe: Could not find/open font when opening font "arial", using internal non-scalable font. See GDFONTPATH discussion in "help set term png" > (Just saying that "arial" could not be found is far from helpful and > it's particularly annoying for newbie users since it pops up every > time "by default" ... well, at least annoying enough that I was ready > to learn some gd basics :) :) That part of the message is generated by libgd itself, not by gnuplot. We just pass it on to the user by saying something like if (error) fprintf(stderr, "%s", error) > PS: I agree with the one who mentioned it that there also needs to be > a way to request the default (build-in) font even if arial starts > working out-of-the-box. Why? (just curious) -- Ethan A Merritt |
|
From: Mojca M. <moj...@gm...> - 2009-04-15 17:22:23
|
On Tue, Apr 14, 2009 at 01:00, Ethan Merritt wrote: > On Monday 13 April 2009 14:20:19 Mojca Miklavec wrote: >> >> May I suggest at least something not-so-related? The message >> Could not find/open font when opening font "arial", using internal >> non-scalable font >> is a bit annoying, pops up everywhere (at the moment) and doesn't tell >> anything useful to the user. I suggest rewriting the message and >> stating that one could try to set GDFONTPATH manually. (It took me a >> while to figure that out.) > > We could print an additional message if you like. > Would that be preferable, or would it be even more annoying? My opinion doesn't count too much, but I would prefer seing any pointer that would help me sort the issue. The one you suggest is OK or there could also be "help term png font" or some other straightformard pointer. The original message is annoying enough by itself. If I (would) know how to get rid of it, that's definitely less annoying at the end. So better more info than less noise. >> PS: I agree with the one who mentioned it that there also needs to be >> a way to request the default (build-in) font even if arial starts >> working out-of-the-box. > > Why? (just curious) There might be different reasons: - One may prefer to have no font antialiasing. I don't know the exact reason why, but antialiased fonts don't work too well in console for example. For some special type of usage it might make sense. (Btw: Is there any way to enable antialiasing of lines in png terminal? I see that pngcairo does it by default.) - One might have a big collection of plots and wants to add a few new ones while preserving the original appearance. I agree that enabling arial or any truetype font by default is better than enabling the pixel font, but since it doesn't cost too much effort to preserve the ability to use the default one, I would vote for some option that would enable one to "go back". Mojca |
|
From: Manfred S. <man...@gm...> - 2009-04-15 22:53:38
|
> On Monday 13 April 2009 09:10:23 Pierre Joye wrote:
> > On Mon, Apr 13, 2009 at 5:56 PM, Ethan Merritt
> <merritt@u.washington.edu> wrote:
> >> Is it true that libgd now looks for fontconfig?
> > no, only if you tell it to do so.
>
> I now see that Mojca has pointed out the function gdFTUseFontConfig(),
> which I did not know about. This looks very promising, and I think we
> should
> use it to try both the old (GDFONTPATH) and new (fontconfig) mechanisms
> when
> looking for a user-specified font.
>
> However, I coded up a quick test patch for gnuplot's gd driver and ran
> into
> the following problem. Perhaps I am doing something wrong:
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> /* First try the old GDFONTPATH mechanism for locating fonts */
> gdFTUseFontConfig(0);
> err = gdImageStringFT(NULL, &brect[0], 0,
> png_state.ttffont, (double)png_state.default_ttfsize,
> 0.0, 0, 0, "test");
>
> /* If that didn't work, try again using fontconfig mechanism */
> if (err && gdFTUseFontConfig(1)) {
> err = gdImageStringFT(NULL, &brect[0], 0,
> png_state.ttffont, (double)png_state.default_ttfsize,
> 0.0, 0, 0, "test");
> fprintf(stderr,"fontconfig %s font %s\n",
> err ? "did not find" : "found",
> png_state.ttffont);
> }
>
> /* If we still haven't found the font, punt to the internal
> non-TTF default set */
> if (err) {
> fprintf(stderr,"%s when opening font \"%s\", using internal
> non-scalable font\n",
> err, png_state.ttffont);
> }
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
Sorry to spoil the party -
Does this mean, not even the ugly work-around to set
GDFONTPATH=/dev/null to get the builtin fixed fonts of libgd
will work any more?
I really would like to have a possibility to use the builtin fonts.
The simplest thing would be to treat the libgd font names special?
I.e. if the the font name is one of
"tiny","small","medium","large","giant" treat them special,
skip font lookup and directly use the respective libgd builtin fonts?
I.e. the use would then be as
...
set term png font "small"
...
Would be great!
Cheers,
Manfred
--
Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger01
|
|
From: Mojca M. <moj...@gm...> - 2009-04-19 08:52:32
|
On Thu, Apr 16, 2009 at 00:53, Manfred Schwarb wrote:
> On Mon, Apr 13, 2009 at 5:56 PM, Ethan Merritt wrote:
>>
>> This looks very promising, and I think we should
>> use it to try both the old (GDFONTPATH) and new (fontconfig) mechanisms
>> when looking for a user-specified font.
>
> Sorry to spoil the party -
>
> Does this mean, not even the ugly work-around to set
> GDFONTPATH=/dev/null to get the builtin fixed fonts of libgd
> will work any more?
>
> I really would like to have a possibility to use the builtin fonts.
>
> The simplest thing would be to treat the libgd font names special?
>
> I.e. if the the font name is one of
> "tiny","small","medium","large","giant" treat them special,
> skip font lookup and directly use the respective libgd builtin fonts?
>
> I.e. the use would then be as
> ...
> set term png font "small"
> ...
Hello,
Enabling fontconfig search by deafault doesn't mean that one should
disable the built-in fonts. At least in my opinion it still makes
sense to allow using them without having to issue an error. The
keywords "tiny" "small" etc. to trigger built in fonts make perfect
sense to me and you don't even need the work-around. When one sets
font ",15"
this could mean "use true type using fontconfig" while small could
trigger the built-in fonts.
(I didn't have to use the ugly workaround to set GDFONTPATH to
/dev/null since it didn't work anyway and I always get the built-in
fonts. Because neither fonts nor graphics have been anti-aliased and
because setting "arial" didn't work out-of-the-box, I always thought
that I was unable to compile GD library support properly.)
Mojca
|