Skip to content

Instantly share code, notes, and snippets.

@sthewissen
Last active February 15, 2016 10:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sthewissen/0105914b4c63fd532fd2 to your computer and use it in GitHub Desktop.
Save sthewissen/0105914b4c63fd532fd2 to your computer and use it in GitHub Desktop.
Loop through the fonts on iOS to find the internal name as described @ http://bit.ly/20yzZ7i
using System;
using System.Collections.Generic;
using System.Linq;
using Foundation;
using UIKit;
namespace CustomXamFormsFont.iOS
{
[Register("AppDelegate")]
public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
{
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
global::Xamarin.Forms.Forms.Init();
LoadApplication(new App());
// Lets log them to our output window.
LogFonts();
return base.FinishedLaunching(app, options);
}
/// <summary>
/// Logs the installed fonts to the debug window.
/// </summary>
private void LogFonts()
{
foreach (NSString family in UIFont.FamilyNames)
{
foreach (NSString font in UIFont.FontNamesForFamilyName(family))
{
Console.WriteLine(@"{0}", font);
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment