GdipGetFamilyName gets a font family name, capped at LF_FACESIZE. This truncates fonts with long names, so new FontFamily("Noto Sans Inscriptional Parthian").Name returns Noto Sans Inscriptional Parthia
However, the truncated font names cannot be used when using GdipCreateFontFamilyFromName, i.e. new FontFamily(parthian.Name).Name returns the default font (Verdana).
This issue is specific to libgdiplus - on Windows, the truncate formatting is different and truncated names can be used when getting font family.
using System;
using System.Drawing;
namespace fontfont
{
class Program
{
static void Main(string[] args)
{
FontFamily parthian = new FontFamily("Noto Sans Inscriptional Parthian");
FontFamily parthianCopy = new FontFamily(parthian.Name);
Console.WriteLine("new FontFamily(\"Noto Sans Inscriptional Parthian\").Name:\t{0}", parthian.Name);
Console.WriteLine("new FontFamily(parthian.Name).Name:\t\t\t\t{0}", parthianCopy.Name);
}
}
}
GdipGetFamilyName
gets a font family name, capped atLF_FACESIZE
. This truncates fonts with long names, sonew FontFamily("Noto Sans Inscriptional Parthian").Name
returnsNoto Sans Inscriptional Parthia
However, the truncated font names cannot be used when using
GdipCreateFontFamilyFromName
, i.e.new FontFamily(parthian.Name).Name
returns the default font (Verdana).This issue is specific to libgdiplus - on Windows, the truncate formatting is different and truncated names can be used when getting font family.
Netcore bug: https://github.com/dotnet/runtime/issues/40937
Sample font with name >
LF_FACESIZE
(included out of the box on macOS 10.15+, packaged infonts-noto-core
on Debian/Ubuntu) : https://noto-website-2.storage.googleapis.com/pkgs/NotoSansInscriptionalParthian-unhinted.zipEasy repro code to demonstrate the issue: