gd 中的 php 和 true 类型集合
我尝试在 GD 库中使用带有 4 种字体的真实类型集合“gulim.ttc”。
像这样:
$font = "fonts/gulim.ttc";
imagettftext($im, 20, 0, 0, 25, $white, $font, $string);
问题是,PHP/GD 仅使用 ttc 文件中的第一个字体,但我需要第三个名为“Dotum”的字体。
或者,有没有办法将 ttc 文件提取或转换为 ttf 文件?
I try to use a true type collection "gulim.ttc" with 4 fonts in the GD libary.
Like this:
$font = "fonts/gulim.ttc";
imagettftext($im, 20, 0, 0, 25, $white, $font, $string);
The Problem is, PHP/GD only uses the first font from the ttc-file but I need the third one called "Dotum".
Or, is there a way to extract or convert the ttc-file to a ttf-file?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
以下是一些将 TTC 文件分解为 TTF 的程序的链接:链接< /a>
here are some links to a program that breaks TTC files into TTF: link
不确定你是否发现了什么,但我遇到了同样的问题,并发现了以下救生链接......它有斜体、居中、右对齐、左对齐和下划线。 唯一缺少的是粗体,无论如何,这很简单。
php-imagestringright-center-italic
来自网站:
“它们甚至可以使用通过 ImageLoadFont 加载的字体,这非常棒!您甚至可以嵌套效果,例如创建带有阴影的右对齐斜体字符串!”
每个函数都有一个可选的最终参数 $ImageString,其中包含一个表示用于写入字符串的函数的字符串。 例如,如果我们想用斜体写一个右对齐的字符串,我们可以使用以下代码:
Not sure if you ever found anything, but I had the same problem and found the following life saving link... it has italic, centered, right justified, left justified, and underline. The only thing that is missing is bold, which is pretty simple anyhow.
php-imagestringright-center-italic
From the site:
"They even work with fonts you load via ImageLoadFont, which is pretty awesome! You can even nest effects, to create for instance, right-aligned italic strings with a drop shadow!"
There’s an optional final parameter on each function, $ImageString, which contains a string representing the function to use to write the string. So for instance, if we want to write a right-aligned string in italics, we can use the following code:
这里有一些不同的方法: https://superuser.com/questions/114603/how-to-install-os-x-ttc-font-on-windows-error-ttc-does-not-appear-to-be< /a>. 还有一个指向 C 语言源代码的指针。这是另一个: http://solaris.sunfish.suginami.tokyo.jp/tips/playground/truetype/ttc2ttf/ttc2ttf.cpp
唯一的编码示例似乎是日语的......考虑到 TTC 文件很漂亮,这是有道理的对于亚洲语言来说非常重要。 不管怎样,我也发现了这个: http://hdmr.org/d/read.php/1172771146 (可能需要谷歌翻译)。
There's some different methods here: https://superuser.com/questions/114603/how-to-install-os-x-ttc-font-on-windows-error-ttc-does-not-appear-to-be. And a pointer to source code in C. Here's another: http://solaris.sunfish.suginami.tokyo.jp/tips/playground/truetype/ttc2ttf/ttc2ttf.cpp
The only coding examples out there seem to be in Japanese...makes sense considering TTC files are pretty much for Asian languages. Anyway, I found this also: http://hdmr.org/d/read.php/1172771146 (probably need google translator for it).