Php and true type collection in gd

I am trying to use a real collection of type "gulim.ttc" with 4 fonts in the GD library.

Like this:

$font = "fonts/gulim.ttc"; imagettftext($im, 20, 0, 0, 25, $white, $font, $string); 

The problem is that PHP / GD only uses the first font from the ttc file, but I need a third one called "Dotum".

Or, is there a way to extract or convert a ttc file to a ttf file?

+6
php fonts gd true-type-fonts
source share
3 answers

Here are some links to a program that splits TTC files into TTF: link

+4
source share

There are several ways: 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 the source code in C. Here is another: http://solaris.sunfish.suginami.tokyo.jp/tips/playground/truetype/ttc2ttf/ttc2ttf.cpp

The only coding examples seem to exist in Japanese ... it makes sense to consider TTC files to a large extent for Asian languages. In any case, I found this as well: http://hdmr.org/d/read.php/1172771146 (this probably requires a Google translator).

+3
source share

Not sure if you ever found anything, but I had the same problem, and I found the following link to save a life ... it has italics, is centered, correctly substantiated, the lion is justified and emphasizes. The only thing missing is the bold font, which is pretty simple anyway.

php-imagestringright-center-italic

From the site: "They even work with fonts that you download using ImageLoadFont, which is pretty surprising! You can even nest effects to create, for example, italicized lines with outgoing trends!"

Theres an optional end parameter for each function, $ ImageString, which contains a string representing the function used to write the string. So, for example, if we want to write a right-aligned line in italics, we can use the following code:

 ImageStringRight($image, 5, 25, 'Right + Italic', $col, 5, 'ImageStringItalic'); 
+2
source share

All Articles