mono / libgdiplus

C-based implementation of the GDI+ API
http://www.mono-project.com/
MIT License
334 stars 171 forks source link

Bugfix/font style issue #629

Open abossard opened 4 years ago

abossard commented 4 years ago

This fixes the wrong font-weight from issue #626

Sadly I it breaks the tests, but it does render the font as Bold.

I'll check what's wrong with the tests. Is this maybe a Mono issue instead of a libgdiplus issue?

dnfclas commented 4 years ago

CLA assistant check
All CLA requirements met.

abossard commented 4 years ago

I reverted the test metrics (cell ascent and descent and letter spacing) to the previous values. I compiled a few examples and didn't notice a degradation.

filipnavara commented 4 years ago

The fix in the current form is incorrect, as pointed out in issue #626. The reason for duplicating properties of the original font is to preserve path to custom fonts (FC_FONT, FC_INDEX). The font metrics in the test are from the custom font and if you observe different ones it means the font was incorrectly substituted.

engrch commented 3 years ago

@filipnavara do you know which component is responsible for the Font substitution?

It looks like the FcPatternDuplicate does not copy the font correctly. Certain fonts in Windows are different in Linux; I wonder if the FcPatternDuplicate would handle such cases. (e.g. Arial in Linux is: Liberation Sans)

I built the latest mono from master and I can confirm that this revert of FcPatternDuplicate resolves the font issue for me.

Debian with LightDM Mono: Built from master libgdiplus: master + this patch