Open hungnd1475 opened 3 years ago
For Windows, you can use that: http://microsoft.github.io/Win2D/html/M_Microsoft_Graphics_Canvas_Text_CanvasTextFormat_GetSystemFontFamilies.htm (from the Win2D.uwp
NuGet package.
But it's not part of the UWP/WinUI contract, so not available right now on Uno. But...
document.fonts
javscript APIUIFont.FamilyNames
SKFontManager.FontFamilies
Gets a list of font families available.
@carldebilly I am aware of using platform-specific code, but it would be nicer if we have a single API handling this use case. Right now we need to stick with this workaround I guess. Anyway thanks for pointing me to those links, it would save me some time searching for them.
I agree it would be a good idea to create a unified API for that. But since it's not present in UWP/WinUI, it would need to be in the Uno toolkit.
For me, System.Drawing.Font is not working on a droid project.... I also tried to add System.Drawing.Common package to project, but it didn't help. Is this problem relates to this issue?
Guys, unless I do not understand something, it should not be very difficult to create a platform independent way of getting the fonts. Why has not it been done?
@c-npolyak we mostly work by priorities on our customers, and this has not been requested yet.
That being said, at the time this question was asked, UWP was not providing this and while WinAppSDK does not, Uno.Toolkit may be good place to provide an API for such a feature that could be available for more platforms, WinAppSDK included.
I think Uno Extensions would be a better place for this - can we move this issue there @jeromelaban ?
This looks like a toolkit feature rather than extensions, I'll move it there.
What would you like to be added:
A cross-platform API that can be used to retrieve all system font families.
Why is this needed:
Right now there is no easy way for developers to get all system font families across all platforms. This enhancement might be very useful for LOB applications with rich text editing capabilities.
For which Platform:
Anything else we need to know?