https://bugs.winehq.org/show_bug.cgi?id=50896
Bug ID: 50896 Summary: cloned member of PrivateFontCollection is supposed to survive deletion of the collection Product: Wine Version: 6.5 Hardware: x86-64 URL: http://ytomy.sakura.ne.jp/cgi-bin/dl/dl.php?dl=trgssx OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: gdiplus Assignee: wine-bugs@winehq.org Reporter: galtgendo@o2.pl Distribution: ---
First summary is a guesstimate based upon What I'm seeing through WINEDEBUG="font,gdiplus".
An RPGMakerVX game using TRGSSX.dll has a problem with proper font display. AFAICT, the library function in use is DrawTextFastA. Anyway, what I can see in the log is roughly:
- call to GdipNewPrivateFontCollection - call to GdipPrivateAddFontFile loading 'UmePlus Gothic', followed by a call to GdipPrivateAddMemoryFont for that font - a somewhat long dive into gdi32 follows, ending with calls to GdipGetFontCollectionFamilyCount and GdipGetFontCollectionFamilyList on this collection - next is GdipCloneFontFamily call for 'UmePlus Gothic' and a GdipGetFamilyName call on the *cloned* family - next is a call to GdipDeletePrivateFontCollection...
and now, we're fucked - this has just deleted the font family, yet the app is still using the cloned version that from this point is just garbage in wine.
To be exact, what happens later is a GdipCreateFont call on the cloned family.
Game doesn't crash, but the picked font is obviously wrong.
Chances are this is a regression caused by commit b9307cfa61e9884b01d34c2310ec1ffbb1868728, but it's over a year ago, so I didn't test that.
What I did test was that changing GdipCloneFontFamily from '*clone = family' to an obviously wrong 'GdipCreateFontFamilyFromName(family->FamilyName, NULL, clone)' seems to fix the problem.