[MPlayer-dev-eng] [BUG] libass: Japanese font with '@'-Prefix rendered wrong
Evgeniy Stepanov
eugeni.stepanov at gmail.com
Sun Sep 14 16:09:12 CEST 2008
Hi,
On Monday 08 September 2008 23:31:28 Tobias Diedrich wrote:
> I noticed that libass renders japanese 'top to bottom' text wrong:
>
> This is what mplayer does:
> http://uguu.de/~ranma/macrossf_18_lunar_mkv_libass_bug.png
>
> This is Aegisub (which for some unknown reason renders 声 as the
> completely wrong character even though it's ok in the script...):
> http://uguu.de/~ranma/macrossf_18_lunar_mkv_substationalpha.png
>
> Apparently, if a japanese fontname starts with @, the @ is stripped
> and all characters of the font are prerotated by 90 degree.
> This only happens for CJK characters though:
> http://uguu.de/~ranma/macrossf_18_lunar_mkv_substationalpha2.png
>
> Here are two screenshots of the font dialog to illustrate that:
> Font with @-Prefix (Note the sample area (サンプル)):
> http://uguu.de/~ranma/macrossf_18_lunar_mkv_substationalpha3.png
> Same font without @-Prefix:
> http://uguu.de/~ranma/macrossf_18_lunar_mkv_substationalpha4.png
>
> This is the fansubs I used for the screenshots and where I extracted the
> script+fonts from:
> http://a.scarywater.net/lunar/%5BLunar%5D%20Macross%20Frontier%20-%2018%20%
>5B1280x720%5D%5Bx264%5D%5BBF46689A%5D.mkv.torrent
>
> I had a cursory glance at the code and I think it might be a bit
> more involving to add rotation based on fontname (and so far I haven't
> found the time to dig into the code a bit more), so I'm posting it
> to the list now. :)
It seems, according to
http://blogs.msdn.com/michkap/archive/2005/08/04/447759.aspx
not all CJK glyphs have to be rotated. It is probably controlled by "vrt2"
feature in GSUB table. This feature defines substitution of glyphs for vertical
writing. As I guess, one needs to apply this substitution and then rotate all
glyphs by 90 degrees.
This article
http://www.microsoft.com/OpenType/OTSpec/features_uz.htm#vrt2
suggests that latin characters (among others) should be substituted by
themselves rotated 90 degrees _clockwise_. Thus, the described procedure will
result in horizontally oriented glyphs.
Can anyone confirm that this is the right way to deal with vertical text?
Unfortunately, FreeType does not parse GSUB table, so it has to be done in
libass (or an OpenType library like HarfBuzz should be used). Or we could go
the easy way and define a set of characters that should not be rotated (in
addition to non-CJK characters, it includes half-width kana, various CJK
punctuation marks and probably more). This is not reliable, but might work in
practice.
More information about the MPlayer-dev-eng
mailing list