Bug 39418 - libgdiplus does not respect fontconfig fallback
Summary: libgdiplus does not respect fontconfig fallback
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: libgdiplus ()
Version: unspecified
Hardware: All Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-03-07 17:01 UTC by Mingye Wang
Modified: 2016-05-06 04:03 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 39418 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
NEW

Description Mingye Wang 2016-03-07 17:01:57 UTC
In src/font.c:812, GdipCreateFont, fontconfig is used to match the 'best' family from config.

> 812	r = FcPatternGetString (family->pattern, FC_FAMILY, 0, &str);

However, this doesn't seem to be friendly to fallbacks, especially with system-generic names like "Sans". This makes using `new Font ("Sans, size);` in mono give tofus for CJK chars, while directly supplying the CJK font name gives some normal result (well, now the first font).

The output of `fc-match -s "Sans"` is available at https://cfp.vim-cn.com/ccw6. In this case, DejaVuSans was matched first, and then wqy-zenhei, the CJK font.

Cairo seems to provide something like cairo_ft_font_face_create_for_pattern(). Perhaps you can delay the fc interpretation and just store the pattern in `result`...
Comment 1 Mingye Wang 2016-03-07 17:02:34 UTC
This also breaks SystemFonts.DefaultFont in Mono.
Comment 2 Mingye Wang 2016-03-09 17:12:50 UTC
I think I got the point of that cairo thing wrong, and it seems that you need to do that yourselves. Hmm… Should I try the experimental Pango target…
Comment 3 Mingye Wang 2016-05-06 04:03:04 UTC
Woah, it seems that building with pango does solve the problem: https://github.com/AOSC-Dev/aosc-os-abbs/issues/224.

So now preferring basic usability over official support...