Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FontDialog always return Tahoma #119

Open
IncubusRK opened this issue Sep 16, 2021 · 9 comments
Open

FontDialog always return Tahoma #119

IncubusRK opened this issue Sep 16, 2021 · 9 comments

Comments

@IncubusRK
Copy link

When using FontDialog for select font it always returns "Tahoma" out-dependent on choice
Check with native win32 app and font selection work fine

@IncubusRK
Copy link
Author

IncubusRK commented Sep 16, 2021

sample test code:

FontDialog dlg = new FontDialog();
if (dlg.ShowDialog() == DialogResult.OK)
        MessageBox.Show("Selected font:"+ dlg.Font.FontFamily.ToString());

@nsivov
Copy link
Contributor

nsivov commented Sep 16, 2021

I suspect this could be about WM_CHOOSEFONT_GETLOGFONT that WinForms is using, they expect LOGFONTW to be filled on return, and we treat it as LOGFONTA.

@IncubusRK
Copy link
Author

Yes it's look like return GDIPlus.GdipGetGenericFontFamilySansSerif after internal exception or some thing like that

@nsivov
Copy link
Contributor

nsivov commented Sep 16, 2021

I might be wrong though. Could you upload compiled test binary somewhere so I can test?

@nsivov
Copy link
Contributor

nsivov commented Sep 16, 2021

I take that back, I see correct name returned from the dialog, but then something weird happens in gdiplus.

@IncubusRK
Copy link
Author

IncubusRK commented Sep 16, 2021

I might be wrong though. Could you upload compiled test binary somewhere so I can test?
WFFontDlg.zip
WinForms test app

@IncubusRK
Copy link
Author

IncubusRK commented Sep 16, 2021

I take that back, I see correct name returned from the dialog, but then something weird happens in gdiplus.

I also have some errors in gdiplus when try to create Font https://bugs.winehq.org/show_bug.cgi?id=51753
I suppose these two different errors

@HinTak
Copy link

HinTak commented Aug 2, 2022

This actually sound a lot like it is unrelated to wine or mono, but a fontconfig behavior. Fontconfig can be annoying like that.

@IncubusRK
Copy link
Author

Native call ChooseFont() returns correct font name.

CHOOSEFONT cf;
static LOGFONT lf;
memset((void*)&cf, 1, sizeof(cf));
cf.lStructSize = sizeof(cf);
cf.hwndOwner = NULL;
cf.lpLogFont = &lf;
cf.Flags = CF_SCREENFONTS | CF_EFFECTS;
ChooseFont(&cf);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants