I'm using the System.Drawing.Common NuGet package and the latest version of libgdiplus (v6.0.x).
The following two fonts are installed and are present in the /usr/share/fonts directory:
DejaVuSansCondensed.ttf
DejaVuSans.ttf
I'm instantiating font objects as follows:
var font = new Font("DejaVu Sans Condensed", 20.0F);
Now, I'm trying to compare Font.Name with Font.OriginalName and the results I get are different based on the underlying operating system.
The correct and expected output (Windows):
Font.Name: DejaVu Sans Condensed
Font.OriginalFontName: DejaVu Sans Condensed
FontFamily.Name: DejaVu Sans Condensed
The incorrect output (Linux);
Font.Name: DejaVu Sans
Font.OriginalFontName: DejaVu Sans Condensed
FontFamily.Name: DejaVu Sans
Note: this is not the issue with the font resolution and subsequent fallback. I can draw with the given font on a Bitmap surface and the output is clearly different from the regular version of "DejaVu Sans". As I understand it from this method's implementation, libgdiplus returns the "Typographic Family" name (also known as "Preferred Name"). This behavior is not consistent with Windows GDI+ implementation, which obtains the "Font Family" name (due to the legacy "Style Linking" feature). See the name — Naming Table help topic for more information in this regard.
This issue appears to be crucial for our software needs as we serialize font information to XML. Any assistance on this issue would be greatly appreciated.
I'm using the System.Drawing.Common NuGet package and the latest version of libgdiplus (v6.0.x). The following two fonts are installed and are present in the /usr/share/fonts directory: DejaVuSansCondensed.ttf DejaVuSans.ttf
I'm instantiating font objects as follows:
Now, I'm trying to compare
Font.Name
withFont.OriginalName
and the results I get are different based on the underlying operating system.The correct and expected output (Windows):
Font.Name
: DejaVu Sans CondensedFont.OriginalFontName
: DejaVu Sans CondensedFontFamily.Name
: DejaVu Sans CondensedThe incorrect output (Linux);
Font.Name
: DejaVu SansFont.OriginalFontName
: DejaVu Sans CondensedFontFamily.Name
: DejaVu SansNote: this is not the issue with the font resolution and subsequent fallback. I can draw with the given font on a Bitmap surface and the output is clearly different from the regular version of "DejaVu Sans". As I understand it from this method's implementation, libgdiplus returns the "Typographic Family" name (also known as "Preferred Name"). This behavior is not consistent with Windows GDI+ implementation, which obtains the "Font Family" name (due to the legacy "Style Linking" feature). See the name — Naming Table help topic for more information in this regard.
This issue appears to be crucial for our software needs as we serialize font information to XML. Any assistance on this issue would be greatly appreciated.