https://bugs.winehq.org/show_bug.cgi?id=53857
Bug ID: 53857
Summary: [ fontconfig ] Questions about some font selection
logic
Product: Wine
Version: unspecified
Hardware: x86
OS: Linux
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: win32u
Assignee: wine-bugs(a)winehq.org
Reporter: 399989567(a)qq.com
Distribution: ---
Created attachment 73387
--> https://bugs.winehq.org/attachment.cgi?id=73387
Simsun Test
My application uses "宋体" (Simsun) as the font of choice,which use WindowsAPI
> SelectObject(hdc,hfont)
When I set the property(lfPitchAndFamily) of "宋体" to 0x22(FF_SWISS) and
0x36(FF_MODERN), wine converts "宋体" into Noto Sans CJK SC and Noto Sans Mono
CJK SC respectively.
I looked at the source code because "宋体" is not installed on my computer, so
when wine doesn't find any fonts, wine end up calling "find_any_face" API and
entering the first loop, using "enum_fallbacks" API to find the fonts.
When i > 3, which means the fonts in the default_fixed_list are not
suitable,Wine uses "fontconfig_enum_family_fallbacks" API to find fonts through
fontconfig.
Here wine determines which type of font the "宋体" belongs to (serif, sans-serif,
monospaced) based on the "lfPitchAndFamily" attribute of the "宋体". So ended up
returning a different font:
> FF_SWISS -> fc-match "sans" -> Noto Sans CJK SC
> FF_MODERN -> fc-match "mono" -> Noto Sans Mono CJK SC
But it's not what I expected, I want "宋体" to return Noto Sans CJK SC
forever,and on my computer when I use ' $ fc-match "宋体" ', it returns "Noto
Sans CJK SC".
I konw "宋体" became "Noto Sans Mono CJK SC" is becaues wine design. But, I would
like to ask why not directly use fontconfig to find fonts according to the font
name in the "fontconfig_enum_family_fallbacks" function, but to search
according to the font type.
ues fc-match "fontname" instead of fc-match "sans or mono or serif"
Is it because using fontconfig is a very resource-intensive thing, so wine
divides the fonts into three types, and stores the results of the three fonts
in the cache, so that the cache can be directly read the next time it is
called?
I don't know if my description is correct, feel free to contact me if you have
any questions
————————————
export LC_ALL=zh_CN.UTF-8
and run my exe file
the first line is "宋体" 0x36 -> became Mono
the second line is "宋体" 0x22 -> became Sans
Don't mind the third and fourth lines
--
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.