Incorrect font rendering in the touhou games

Questions about Wine on Linux
Locked
Killomatic
Newbie
Newbie
Posts: 4
Joined: Wed May 29, 2013 10:15 am

Incorrect font rendering in the touhou games

Post by Killomatic »

Even though wine runs all the touhou bullet hell games near flawlessly nowadays, the fonts in most of them have never displayed correctly for me and I've had linux for a year and a half now. The issue is with the main font for each affected game, used for all the dialogue, the music room (which is what I've used for my screencaps) and occasionally some UI elements. The problems seem to get worse the further down the series you go, so I'll break it down.

Touhou 6 works fine, but 7 and 8 have the font size reduced, like so:
touhou 8 music room
touhou 8 music room
Games 9 and 9.5 are okay, while in 10, 11, 12, 12.5 and 12.8 the font lacks proper hinting and is badly aliased, as seen here:
touhou 10 music room
touhou 10 music room
Touhou 13 is largely the same with the added issue of the font being heavier/having wrong spacing, resulting in the text sometimes getting cut where it hits the edge of the invisible box:
touhou 13 music room
touhou 13 music room
The terminal output for games 10-13 looks like this:

Code: Select all

fixme:win:EnumDisplayDevicesW ((null),0,0x33f7f8,0x00000000), stub!
fixme:winediag:AUDDRV_GetAudioEndpoint Winepulse is not officially supported by the wine project
fixme:winediag:AUDDRV_GetAudioEndpoint For sound related feedback and support, please visit http://ubuntuforums.org/showthread.php?t=1960599
fixme:d3d:resource_check_usage Unhandled usage flags 0x8.
fixme:d3d:wined3d_buffer_preload Too many declaration changes or converting dynamic buffer, stopping converting
fixme:d3d:resource_check_usage Unhandled usage flags 0x8.
fixme:d3d:wined3d_buffer_preload Too many declaration changes or converting dynamic buffer, stopping converting
fixme:d3d:resource_check_usage Unhandled usage flags 0x8.
fixme:d3d:wined3d_buffer_preload Too many declaration changes or converting dynamic buffer, stopping converting
fixme:d3d:resource_check_usage Unhandled usage flags 0x8.
fixme:d3d:wined3d_buffer_preload Too many declaration changes or converting dynamic buffer, stopping converting
fixme:d3d:resource_check_usage Unhandled usage flags 0x8.
fixme:d3d:wined3d_buffer_preload Too many declaration changes or converting dynamic buffer, stopping converting
fixme:d3d:resource_check_usage Unhandled usage flags 0x8.
fixme:d3d:wined3d_buffer_preload Too many declaration changes or converting dynamic buffer, stopping converting
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x4.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x4.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x4.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x4.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x4.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x4.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x4.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x4.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x4.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x4.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x4.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x4.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x4.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x4.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x4.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x4.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x4.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x4.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x4.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x4.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x4.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x4.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x4.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x4.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x4.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x4.
fixme:d3d:resource_check_usage Unhandled usage flags 0x8.
fixme:d3d:wined3d_buffer_preload Too many declaration changes or converting dynamic buffer, stopping converting
fixme:d3d:resource_check_usage Unhandled usage flags 0x8.
fixme:d3d:wined3d_buffer_preload Too many declaration changes or converting dynamic buffer, stopping converting
fixme:win:WINNLSEnableIME hwnd (nil) enable 1: stub!
Most of it occurs in all touhou games, even the ones that render the fonts fine, except for the "Unhandled filter 0x4" error, which only gets spammed when the game encounters the problematic font. The exact same issue is also present in the original untranslated versions as well.

And that brings me to touhou 14, the demo for which has only been out for a few days. This is the first one to actually have all its assets drawn for 3 resolutions - 640x480, 960x720 and 1280x960. The last one produces no issues and gives no "Unhandled filter" errors, but is not useful to actually play in, because the widow is bigger than my laptop's screen. The lower resolutions have the common aliasing problem, except that it now affects pretty much everything: from the loading screen message to the title menu, the dialogue, the UI and even the character portraits.

The terminal output is also a little different

Code: Select all

fixme:ver:GetCurrentPackageId (0x33ec90 (nil)): stub
fixme:dwmapi:DwmEnableComposition (0) stub
fixme:win:EnumDisplayDevicesW ((null),0,0x33e7c8,0x00000000), stub!
fixme:winediag:AUDDRV_GetAudioEndpoint Winepulse is not officially supported by the wine project
fixme:winediag:AUDDRV_GetAudioEndpoint For sound related feedback and support, please visit http://ubuntuforums.org/showthread.php?t=1960599
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x30004.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x30004.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x30004.
fixme:d3d:resource_check_usage Unhandled usage flags 0x8.
fixme:d3d:wined3d_buffer_preload Too many declaration changes or converting dynamic buffer, stopping converting
fixme:d3d:resource_check_usage Unhandled usage flags 0x8.
fixme:d3d:wined3d_buffer_preload Too many declaration changes or converting dynamic buffer, stopping converting
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x30004.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x30004.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x30004.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x30004.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x30004.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x30004.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x30004.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x30004.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x30004.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x30004.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x30004.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x30004.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x30004.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x30004.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x30004.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x30004.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x30004.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x30004.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x30004.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x30004.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x30004.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x30004.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x30004.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x30004.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x30004.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x30004.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x30004.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x30004.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x30004.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x30004.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x30004.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x30004.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x30004.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x30004.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x30004.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x30004.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x30004.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x30004.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x30004.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x30004.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x30004.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x30004.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x30004.
fixme:d3dx:D3DXLoadSurfaceFromMemory Unhandled filter 0x30004.
fixme:d3d:resource_check_usage Unhandled usage flags 0x8.
fixme:d3d:wined3d_buffer_preload Too many declaration changes or converting dynamic buffer, stopping converting
fixme:d3d:resource_check_usage Unhandled usage flags 0x8.
fixme:d3d:wined3d_buffer_preload Too many declaration changes or converting dynamic buffer, stopping converting
fixme:win:WINNLSEnableIME hwnd (nil) enable 1: stub!
with a brand new "Unhandled filter 0x30004" error and it appears much sooner, since as I mentioned even the loading screen is affected.
Killomatic
Newbie
Newbie
Posts: 4
Joined: Wed May 29, 2013 10:15 am

Re: Incorrect font rendering in the touhou games

Post by Killomatic »

Screenshots for 14, because attachments limit:
touhou 14 title screen
touhou 14 title screen
touhou 14 title screen
touhou 14 title screen
By the way, I'm using 64-bit Ubuntu with wine 1.5.30 from the ppa, though it's been like this since 11.10 and even with the stable build. The windows screenshots are from VMware workstation, but the games look exactly like I remember them from windows 7.
Killomatic
Newbie
Newbie
Posts: 4
Joined: Wed May 29, 2013 10:15 am

Re: Incorrect font rendering in the touhou games

Post by Killomatic »

Okay, I can confirm this is not specific to Ubuntu or the unity desktop, as I have reproduced it in both Manjaro Linux (Arch-based) and in Mint 15, which is an Ubuntu 13.04 clone, but with the cinnamon desktop. The one exception is the font size in touhou 7 and 8, which is correct in Mint with the same wine version (1.4.1-0ubuntu5), so it must be a different bug entirely.

Also noticed that wine 1.4.1 gives a lot less warnings in the terminal, but also includes some new ones, so here they are:

for touhou 10

Code: Select all

fixme:win:EnumDisplayDevicesW ((null),0,0x33f8a0,0x00000000), stub!
fixme:font:WineEngAddFontResourceEx Ignoring flags 10
fixme:win:WINNLSEnableIME hwnd (nil) enable 1: stub!
for touhou 14

Code: Select all

fixme:dwmapi:DwmEnableComposition (0) stub
fixme:win:EnumDisplayDevicesW ((null),0,0x33e86c,0x00000000), stub!
fixme:win:WINNLSEnableIME hwnd (nil) enable 1: stub!
Killomatic
Newbie
Newbie
Posts: 4
Joined: Wed May 29, 2013 10:15 am

Re: Incorrect font rendering in the touhou games

Post by Killomatic »

Probably nobody else cares about this, but I'll update just in case someone is ever unlucky enough to reproduce my issues.

First, the aliasing problems with the fonts in games 10-13 and with pretty much the entire game in the th14 demo disappear when using a native d3dx9_36.dll. That still leaves a few minor things not related to directx however.

I hadn't notice, but in my first screencap (the touhou 8 music room) wine is actually using a different font. After installing msgothic, touhou 7 and 8 have a more consistent look with windows, but not exactly the same. The font's weight and possibly horizontal dimensions don't match, leading to shorter lines in wine as seen here:
Touhou 7 music room
Touhou 7 music room
That in itself is not really noticeable, but other games have the opposite problem - the letters are wider, leading to longer lines that sometimes get clipped by the textbox. This is still present in touhou 13 (as shown in the opening post) and as I've recently discovered affects touhou 9.5 as well. There it makes all the spell card names clip, because the textbox is only as big as it needs to be for the original font:
Shoot the Bullet Spell Card
Shoot the Bullet Spell Card
Finally, I also opened bug reports for all of this: here, here and here.
lahmbi5678
Level 7
Level 7
Posts: 823
Joined: Thu Aug 27, 2009 6:23 am

Re: Incorrect font rendering in the touhou games

Post by lahmbi5678 »

Hi,

it's not that nobody cares, but wine has become a professional project in more than one respect, this is a plain user forum, the wine devs aren't closely following this forum, it probably would distract them too much from their work. The "wine way" is to file bugs to get into contact with developers.

Regarding your issue with fonts, there are some font-related winetricks options, like corefonts and allfonts, though the last one is probably overkill.
Locked