src/BloomExe/FontProcessing/FontsApi.cs
/// <summary>
/// Return a list of FontMetadata objects for all fonts on the system.  This will be SLOW the
/// first time it is called, but caches the result so that it will be fast in any later calls.
/// </summary>
/// <remarks>
/// This method is actually called only once in Program.Main just before Run().  If something
/// calls this a second time (or calls AvailableFontMetadata) before it finishes, then a partial
/// list of fonts is returned.
/// </remarks>
Return a list of FontMetadata objects for all fonts on the system.  This will be SLOW the
first time it is called, but caches the result so that it will be fast in any later calls.
Return a list of FontMetadata objects for all fonts on the system . This will be SLOW the first time it is called but caches the result so that it will be fast in any later calls .
public static IEnumerable<FontMetadata> GetAllFontMetadata()
		{
			if (_finder != null)
				return GetFontMetadataSortedByName();
			var starting = DateTime.Now;
			foreach (var name in SortedListOfFontNames())
			{
				_finder = FontFileFinder.GetInstance(isReuseAllowed: true);
				try
				{
					var group = _finder.GetGroupForFont(name);
					if (group == null || string.IsNullOrEmpty(group.Normal))
						continue;
					var meta = new FontMetadata(name, group);
					lock (_fontNameToMetadata)
					{
						_fontNameToMetadata[name] = meta;
					}
				}
				catch (Exception ex)
				{
					System.Diagnostics.Debug.WriteLine($"Trying to get font data for \"{name}\" threw: {ex}");
				}
			}
			var list = GetFontMetadataSortedByName();
			var ending = DateTime.Now;
			System.Diagnostics.Debug.WriteLine($"DEBUG: Collecting font metadata took {ending - starting}");
			return list;
		}
public static IEnumerable < FontMetadata > GetAllFontMetadata ( ) { if ( _finder != null ) return GetFontMetadataSortedByName ( ) ; var starting = DateTime . Now ; foreach ( var name in SortedListOfFontNames ( ) ) { _finder = FontFileFinder . GetInstance ( isReuseAllowed : true ) ; try { var group = _finder . GetGroupForFont ( name ) ; if ( group == null || string . IsNullOrEmpty ( group . Normal ) ) continue ; var meta = new FontMetadata ( name , group ) ; lock ( _fontNameToMetadata ) { _fontNameToMetadata [ name ] = meta ; } } catch ( Exception ex ) { System . Diagnostics . Debug . WriteLine ( $" Trying to get font data for  \" { name } \"  threw:  { ex } " ) ; } } var list = GetFontMetadataSortedByName ( ) ; var ending = DateTime . Now ; System . Diagnostics . Debug . WriteLine ( $" DEBUG: Collecting font metadata took  { ending - starting } " ) ; return list ; }
Return a list of FontMetadata objects for all fonts on the system.
Return a list of FontMetadata objects for all fonts on the system .
// This return shouldn't be used but might be triggered by a test.
remarks
This method is actually called only once in Program.Main just before Run().  If something
calls this a second time (or calls AvailableFontMetadata) before it finishes, then a partial
list of fonts is returned.
This method is actually called only once in Program . Main just before Run () . If something calls this a second time ( or calls AvailableFontMetadata ) before it finishes then a partial list of fonts is returned .