Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
Nifty  
#1 Posted : Tuesday, November 28, 2017 4:01:50 PM(UTC)
Nifty

Rank: Advanced Member

Groups: Member
Joined: 10/12/2015(UTC)
Posts: 44

Me again, although I'm still trying to solve my Font issue, I'm also weighing my options for speed considerations in case there is more than one way to handle these types of problems.

My question is regarding the FileSystemSource.

Code:
customResolver.AddSource(new FileSystemSource(fontCache));

How does this work? What is the IFontSource expecting to find on the file system? TTF files with the appropriate Family or PostScript name?

Eugene Kosmin  
#2 Posted : Tuesday, November 28, 2017 5:15:15 PM(UTC)
Eugene Kosmin

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 9/19/2006(UTC)
Posts: 505

Was thanked: 41 time(s) in 41 post(s)
The logic is pretty straightforward. You pass a path as an argument for this object. Then it gets all files from the path and builds a dictionary with postscript names and actual file paths.

When FontResolver wants to get a font by its postscript name, FileSystemSource checks the dictionary and, if it finds the name, makes a copy of the font file to the cache directory and returns its path. As I wrote before, only postscript name is used for font identification. Not family name, it can be the same for a bunch of fonts.

It's pretty close to your implementation of IFontSource from the related topic.

It makes sense to use FileSystemSource with cache path because getting a font from online sources usually takes a long time. If you don't need to use online sources, you can just fill CustomFontRegistry will your locally stored fonts. The effect will be the same.

Best regards,

Eugene Kosmin

The Aurigma Development Team

Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.