views:

655

answers:

3

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?

+3  A: 

here are some links to a program that breaks TTC files into TTF: link

SorinV
+2  A: 

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:

ImageStringRight($image, 5, 25, 'Right + Italic', $col, 5, 'ImageStringItalic');
Mike Curry
+3  A: 

There's some different methods here: http://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).

WinnerWinnerChickenDinner
+1. Great links.
Otaku