Posted by: VxJasonxV | August 29, 2006

Mikachan updates and breaks functionality

Dear Lazyweb,

Anybody out there in blogging land use the Mikachan font?
I grew very fond of it, and used it for my Last.FM banner script ( See the generated image if you’re curious ). However, mikachan-font-9.1 recently because available in portage, and like a good little Bleeding Edge user, I updated. And as a result, all of the text just disappeared from the Last.FM banner.

Upon investigating the problem further, I noticed that there are no longer TTF files in the package.
Instead, there are “TTC” files.

$ equery f mikachan-font
[ Searching for packages matching mikachan-font… ]
* Contents of media-fonts/mikachan-font-9.1:
/usr
/usr/share
/usr/share/doc
/usr/share/doc/mikachan-font-9.1
/usr/share/fonts
/usr/share/fonts/mikachan-font
/usr/share/fonts/mikachan-font/encodings.dir
/usr/share/fonts/mikachan-font/fonts.cache-1
/usr/share/fonts/mikachan-font/fonts.dir
/usr/share/fonts/mikachan-font/fonts.scale
/usr/share/fonts/mikachan-font/mikachan_puchi.ttc
/usr/share/fonts/mikachan-font/mikachanall.ttc

I’ve thought about simply masking version 9.1 and stepping back down to 8.9, but I’m sure I would be missing characters or something like that. ( Like I said, I’m a bleeding edge kind of guy ;). )
The problem is, I use the imagettftext() function in PHP in order to render the text on my image.

fontfile

The path to the TrueType font you wish to use.

Depending on which version of the GD library PHP is using, when fontfile does not begin with a leading / then .ttf will be appended to the filename and the library will attempt to search for that filename along a library-defined font path.

And now that there are .ttc files, PHP can no longer make use of them.
Is there a sane solution? Should I make .ttf symlinks? Are .ttc files any different?
I’d love to read the Mikachan website and figure it out for myself, but I don’t know Japanese!

[edit]
After doing a bit more research, a TTC could be one of two things. A Compressed TTF, or a Collection of TTF fonts. With a filename like ‘mikachanall.ttc’, I’m wiling to opt for the latter.

My searches for a TTF extractor/decompressor from a TTC are coming up empty. Anybody out there in the community know of a solution?

[edit2]
MY BEST BUDDY EVER io_error (also here on wp.com) helped me in IRC to get the TTC decompressor working.
The source does work, but you have to pass a special g++ flag:
g++ -fno-for-scope -DINTEL -o ttc2ttf ttc2ttf.cpp
And then we have a fully compiled binary (zomg!). After that, you just give ‘er a run and point it at the TTC file you want to extract the TTF files from:
./ttc2ttf /filesystem/path/to/ttcfont.ttc
The nuisance is that the TTF files come out named like: “ttcfont0.ttf , ttcfont1.ttf , ttcfont2.ttf”, so the names of the fonts in the collection are not preserved. In short, SCREW THAT.

I decided (finally), that it’d just be easier to downgrade mikachan back to 8.9-r1. I did, and life is good. And my Last.FM Image is slick again.

I poked around at Gentoo’s Bugzilla on the matter, and finally found the cause of all these issues.
Someone” asked for a version bump to a version built for WINDOWS, NOT LINUX (-_-), and a developer complied.
So, we have a Windows Mikachan-font version in Gentoo’s Portage. Great! I went ahead and filed a bug asking for a revert in bug 148097. No word there yet.

emerge =media-fonts/mikachan-font-8.9-r1
echo "=media-fonts/mikachan-font-9.1" >> /etc/portage/package.mask

Ran it, and moved on with life.


Responses

  1. That’s because you forgot to hit the Search button. I found it on the first try.
    http://solaris.sunfish.suginami.tokyo.jp/tips/playground/truetype/ttc2ttf/
    http://hp.vector.co.jp/authors/VA010851/be/

  2. You should consider hitting the ‘compile’ button then.

  3. I’ll try to follow this form the bug (as I’m still in CJK team myself 😉 ), but mikachan works for me with fontconfig/freetype2 (as I said on my blog post you commented on).

  4. […] … when I decide to name a package in a post of mine 🙂 When I named mikachan font in my post about xine’s fontconfig support, Jason pointed me to a post of his, where he describes some problems with the recent version of mikachan-font. […]

  5. For anyone who stumbles on this post, the result is that the Gentoo CJK team (Diego being the spear header) is going to split up ‘mikachan-font’ to:

    mikachan-font-ttf
    mikachan-font-ttc
    mikachan-font-otf

    TTF, TTC, and OpenType font types respectively.

    It’s a great solution, and it allows me to follow one package and call it a day. 😀
    Thanks Diego!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: