Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How To: Determine which character ranges are supported by a font

Tags:

c#

fonts

When working with different fonts, some might support, say, arabic characters where another might not.

Is there a way in C# to figure out what character ranges are supported by a specific font?

like image 840
Steve Sheldon Avatar asked Oct 15 '22 01:10

Steve Sheldon


1 Answers

You would need to P/Invoke GetFontUnicodeRanges(). Not easy to do because the font needs to be selected in the device context, that requires more p/invoke.

But most of all, it isn't the right thing to do. You should rely on Windows' automatic font linking, it finds another font if necessary to supply the glyph. The feature is described in this article.

like image 81
Hans Passant Avatar answered Oct 18 '22 15:10

Hans Passant