New Ticket     Tickets     Wiki     Browse Source     Timeline     Roadmap     Ticket Reports     Search

Ticket #26897 (closed enhancement: fixed)

Opened 3 years ago

Last modified 13 months ago

gd2 default fontpath for OS X

Reported by: and.damore@… Owned by: ryandesign@…
Priority: Normal Milestone:
Component: ports Version: 1.9.1
Keywords: libgd font path Cc: mojca.miklavec.lists@…
Port: gd2

Description

Default font path in libgd is /usr/share/fonts/truetype that is not present on standard OS X, this makes necessary to either set up GDFONTPATH or link the default directory to an actual font directory. Moreover the former doesn't work if there's no shell involved, for example when wxMaxima directly calls gnuplot to get a png plot.

The solution is to add

configure.cflags-append     -DDEFAULT_FONTPATH=\\\"/System/Library/Fonts:/Library/Fonts\\\"

to Portfile thus passing the appropriate macro to compiler.

This way programs relying on libgd will find system's fonts even if GDFONTPATH is not specified and there's no /usr/share/fonts/truetype .

This is not a bug per se but I think that a port that works out of the box rather than requiring further configuration is better.

Attachments

patch-gd2.diff (369 bytes) - added by and.damore@… 2 years ago.
gd2 Portfile patch
gd2.diff (788 bytes) - added by mojca.miklavec.lists@… 13 months ago.
Another patch from upstream (https://bitbucket.org/pierrejoye/gd-libgd/changeset/3ea283efcdaf)

Change History

Changed 2 years ago by and.damore@…

gd2 Portfile patch

comment:1 Changed 2 years ago by ryandesign@…

Sorry for neglecting this ticket. Is there a test case I can use -- a command I can run before and after applying this patch to see that it works?

comment:2 Changed 2 years ago by and.damore@…

Running:

gnuplot -e 'show fontpath'

in console without patch should show non existing paths in OS X, while with patch applied it should show system's paths.

comment:3 Changed 2 years ago by ryandesign@…

I get:

$ gnuplot -e 'show fontpath'

	fontpath is 
	system fontpath is "/System/Library/Fonts" "/Library/Fonts" "/Users/rschmidt/Library/Fonts" 

What do you get?

Also, this problem was previously reported in #14999.

comment:4 Changed 2 years ago by and.damore@…

That's due to r76048, reverting before that revision I get

 gnuplot -e 'show fontpath'

	fontpath is 
	system fontpath is "/usr/X11R6/lib/X11/fonts/Type1" 

IIRC I was trying to configure properly gd2 in order to have all programs relying on it working properly, I eventually ended patching gnuplot because it explicitly populates its fontpath_tbl struct .

With regards to this ticket the main difference we get with and without the patch is that gd2 library ends having a path adequate to OS X or not.

Active version is patched, destrooted isn't:

gd2 $ strings work/destroot/opt/local/lib/libgd.2.dylib | grep /System
gd2 $ strings /opt/local/lib/libgd.2.dylib | grep System
/System/Library/Fonts:/Library/Fonts

comment:5 Changed 22 months ago by mbrethen@…

I agree, it should work out of the box. Arial is gnuplot's default font for making PNG files. That font is present in /Library/Fonts but gnuplot is not finding it, that's a MacPorts packaging bug. Neither did setting the GDFONTPATH variable work for wxMaxima. A way around this issue was to put 'set term png font "/Library/Fonts/Arial Unicode.ttf" 12' in the '.gnuplot' file located in my user diractory. But I spent a few hours online to sort this out.

comment:6 Changed 17 months ago by and.damore@…

  • Status changed from new to closed
  • Resolution set to fixed

Maintainer timeout, committed r87966.

Changed 13 months ago by mojca.miklavec.lists@…

comment:7 Changed 13 months ago by mojca.miklavec.lists@…

  • Status changed from closed to reopened
  • Resolution fixed deleted

May I request reviewing anothe patch against current port, gd2.diff? It is an upstream patch that helps with the following problem in 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 '

which I think was exactly the problem reported here (if I'm wrong, please excuse me).

Gnuplot also needs a tiny patch in addition to this to actually resolve the problem, but fixing gd is a prerequisite for a patch in gnuplot.

PS: I'm not sure if it is polite to add stuff to old & closed tickets (if it was not appropriate this time, let me know, I'll open a new report next time), but it was most likely about exactly the same issue which is still present for me. PPS: current port has wrong line numbers anyway:

--->  Applying /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/graphics/gd2/files/patch-gdft.c.diff
patching file gdft.c
Hunk #1 succeeded at 1402 (offset 39 lines).

comment:8 Changed 13 months ago by mojca.miklavec.lists@…

  • Cc mojca.miklavec.lists@… added

Cc Me!

comment:9 Changed 13 months ago by ryandesign@…

  • Status changed from reopened to closed
  • Resolution set to fixed

Thanks. Reopening an old ticket is fine, if you believe the ticket was closed improperly or prematurely. In this case, I don't really understand the old issue, or the new issue, or if they're the same, so I'll defer to your judgement. I committed your patch in r92005.

comment:10 Changed 13 months ago by mojca.miklavec.lists@…

Thank you very much for the patch. I opened a new gnuplot-specific ticket #34072 in order to collect relevant information at a single place. I need to do some more tests & debugging before proceeding, but fixing gd2 was essential for that. I really hope that gd2 will release 2.0.36 eventually ... Thanks again.

comment:11 Changed 13 months ago by ryandesign@…

I wouldn't hold my breath... they haven't even been able to get their web site online since several years.

Note: See TracTickets for help on using tickets.