From owner-freebsd-questions Sun Sep 29 13:24:35 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 74D9837B401 for ; Sun, 29 Sep 2002 13:24:33 -0700 (PDT) Received: from mx.aminor.no (trisha.aminor.no [213.187.177.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id E53A343E4A for ; Sun, 29 Sep 2002 13:24:32 -0700 (PDT) (envelope-from eivind@aminor.no) Received: from [192.168.0.2] (holly.eivind [192.168.0.2]) by mx.aminor.no (Postfix) with ESMTP id A7F5629C94; Sun, 29 Sep 2002 22:02:26 +0200 (CEST) Date: Sun, 29 Sep 2002 22:02:42 +0200 From: Eivind Olsen To: freebsd-questions@FreeBSD.ORG Cc: la3sg@sensewave.com Subject: Re: PHP, GD2 and True Type Fonts Message-ID: <31773017.1033336962@[192.168.0.2]> In-Reply-To: <3D934202.6025.1DCC81E@localhost> References: <3D934202.6025.1DCC81E@localhost> X-Mailer: Mulberry/3.0.0b4 (Win32) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --On 26. september 2002 17:21 +0100 Kjell wrote: > I am calling the GD2 package from PHP to generate graphics to be > displayed on web pages. Everything I have tried are working fine, with > one exception: When I make a call like > $size = ImageTTFBbox (10, 0, "fonts/arial.ttf" , "hello"); > I get an arror message like > Warning: Could not find/open font in /home/www/htdocs/t3.php on line 21 > Is it required to compile GD2 with certain options to be able to use True > Type Fonts? > Could it be something wrong with my font files? I seem to recall that the fonts should reside in "/usr/share/fonts/truetype/" and should be referred to as just the name of the font-file without the ".ttf" on the end. Here is an example. I have several *.ttf files in /usr/share/fonts/truetype (which is just a symlink to /usr/X11R6/lib/X11/fonts/webfonts which was populated by installing the x11-fonts/webfonts port): eivind@trisha:~ > ls -la /usr/share/fonts/truetype/ | grep courbi -r--r--r-- 1 root wheel 234788 Sep 29 20:16 courbi.ttf eivind@trisha:~ > Here is an example script (taken from the "Programming PHP" O'Reilly-book): eivind@trisha:~ > cat ~/public_html/fonttest.php eivind@trisha:~ > As you can see it references the font as "courbi" even though the fontfile is "courbi.ttf". Someone mentioned absolute paths, but absolute paths are only required if you're using GD1 (and you said you were using GD2) or if your fonts are not found in /usr/share/fonts/truetype/ I hope this helped. -- Eivind Olsen eivind@aminor.no To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message