-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
61 additions
and
3 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
src/UglyToad.PdfPig.Fonts/SystemFonts/AndroidSystemFontLister.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
namespace UglyToad.PdfPig.Fonts.SystemFonts | ||
{ | ||
#if NET | ||
using System.Collections.Generic; | ||
using System.IO; | ||
|
||
internal sealed class AndroidSystemFontLister : ISystemFontLister | ||
{ | ||
public IEnumerable<SystemFontRecord> GetAllFonts() | ||
{ | ||
var directories = new List<string> | ||
{ | ||
"/system/fonts", | ||
}; | ||
|
||
foreach (var directory in directories) | ||
{ | ||
try | ||
{ | ||
if (!Directory.Exists(directory)) | ||
{ | ||
continue; | ||
} | ||
} | ||
catch | ||
{ | ||
continue; | ||
} | ||
|
||
string[] files; | ||
|
||
try | ||
{ | ||
files = Directory.GetFiles(directory, "*.*", SearchOption.AllDirectories); | ||
} | ||
catch | ||
{ | ||
continue; | ||
} | ||
|
||
foreach (var file in files) | ||
{ | ||
if (SystemFontRecord.TryCreate(file, out var record)) | ||
{ | ||
yield return record; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
#endif | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters