我在哪里可以找到GD兼容字体?

时间:2010-04-28 16:49:55

标签: php fonts gd

我正在使用GD来显示一些文字。默认字体是Courier(或类似的东西)...我想使用另一种字体,我发现这个函数:imageloadfont需要一个.gdf文件。我在Google上搜索我是否找到了一些不错的字体,但我没有找到任何东西。我看到有一个脚本将PNG文件转换为GDF,但我不能浪费太多时间,所以我想知道在哪里可以得到一些不错的字体,或者可能还有另一种更简单的方法来做我想要的。

5 个答案:

答案 0 :(得分:6)

我没有在文档中看到imagettftext函数。感谢@Pekka提供建议。最后,我刚刚将consolas.ttf文件复制到脚本的同一目录中并执行了:

imagettftext ( $image, 12, 0, 200, 100, 0, 'consolas.ttf' , "thanks!");

效果很好。

答案 1 :(得分:1)

您是否尝试过使用转换器将truetype字体文件转换为gdf?

http://www.lunar.lu/ttf-to-gdf/convert.php

答案 2 :(得分:1)

这个问题已经有了一个公认的答案,但我正在分享一个有用的链接来获取gdf字体。

http://www.danceswithferrets.org/lab/gdfs/

答案 3 :(得分:0)

自由地格式化由" Cookie"发布的代码。 (所以我自己可以看到;):

<div style="background:#ffffff;border:5pt solid #000000; color:#000000;padding:25px;border-radius:15px;">
    <div>
        <a href="http://kr1.php.net/imagettftext">http://kr1.php.net/imagettftext</a>
    </div>
</div>
<div>an example...</div>
<?php
    $str = "TESTING...";
    @$i = imagecreate(strlen($str)*20+40,70) or die("FAILED...");
    imagettftext($i,20,30,20,20,imagecolorallocatealpha($i,0,0,0,75),"굴림.ttf",$str)
?>

答案 4 :(得分:-2)

    <div style="background:#ffffff;
                border:5pt solid #000000;.
                color:#000000;
                padding:25px;
                border-radius:15px;">
        <div>
            <a href="http://kr1.php.net/imagettftext">
                http://kr1.php.net/imagettftext
            </a>
        </div>

        <div>
            an example...
        </div>

    <?php 
        $str = "TESTING...";
        @$i = imagecreate(strlen($str)*20+40,70) or die("FAILED...");
        magettftext($i,20,30,20,20,imagecolorallocatealpha($i,0,0,0,75),"굴림.ttf",$str);
    ?>
抱歉......我无法测试...但也许是对的。아참고로난중2