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

Notification

Icon
Error

Options
Go to last post Go to first unread
JoshSmith  
#1 Posted : Wednesday, May 24, 2023 12:36:29 PM(UTC)
JoshSmith

Rank: Newbie

Groups: Member
Joined: 10/27/2022(UTC)
Posts: 8

Thanks: 4 times
I'm getting an error: "Aurigma.GraphicsMill.FontMissingException: 'Arial-Black'" The font name is actually "Arial Black". Not sure why the code adds the hyphen. I don't want to use a generic fallback font. I'd prefer to tell it to use "Arial Black" instead of "Arial-Black". I also don't want to have to hard code every font name because naming discrepancies. It also cannot find "BerlinSansFB-Reg" which is actually named "Berlin Sans FB" and cannot find "Arial-BoldMT" which is really named "Arial Bold". Here is my really basic code so far:

var psdProcessor = new PsdProcessor();

psdProcessor.StringCallback = (processor, textFrame) =>
{
var textString = textFrame.GetFormattedText();

if (textFrame.Name == "FullName")
textString = "Joshua Smith";

return textString;
};
psdProcessor.Render(@"D:\RIP\Test.psd", @"D:\RIP\Test.pdf");
Eugene Kosmin  
#2 Posted : Thursday, May 25, 2023 12:50:04 AM(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)
Hi,

'Arial-Black' is a postscript font name - one string identifying the font in some font storage. In PSD format all font names are being stored as postscript names. In general, there may be different versions of font with the same PS name, with/without hyphen, with/without '-regular' postfix and so on.

Currently GM doesn't contain any special logic to match strings like 'Arial-Bold', 'Arial-BoldMT' and so on. But we'll consider to improve this aspect in future versions.

The current recommended workflow is to use font sources and testing PSD templates before using them somewhere in production.
Code:
var psdProcessor = new PsdProcessor("Fonts");
psdProcessor.FontResolver.AddSource(new FileSystemSource("C:\my_font_storage\"));
Best regards,
Eugene Kosmin
The Aurigma Development Team
thanks 1 user thanked Eugene Kosmin for this useful post.
JoshSmith on 5/25/2023(UTC)
JoshSmith  
#3 Posted : Thursday, May 25, 2023 6:39:26 AM(UTC)
JoshSmith

Rank: Newbie

Groups: Member
Joined: 10/27/2022(UTC)
Posts: 8

Thanks: 4 times
Thanks for the information. Is there somewhere I can read more about postscript font names, or dealing with fonts in general?

Is it possible to use an AWS S3 bucket as the FileSystemSource? Or does the path need to be local? I suppose I could just download them from the bucket locally each time before processing my graphics.
Eugene Kosmin  
#4 Posted : Thursday, May 25, 2023 10:26:53 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)
If you need some more general information about fonts, you can check freetype documentation or TrueType reference. As for postscript name - just think about it as one-string identifier for a font face, the same as a pair of font family and style.

FileSystemSource works only with local files. You can also try GoogleFontSource. Actually, IFontSource interface is very simple, so you can implement your own logic of getting fonts from any other locations.
Best regards,
Eugene Kosmin
The Aurigma Development Team
thanks 1 user thanked Eugene Kosmin for this useful post.
JoshSmith on 5/26/2023(UTC)
Users browsing this topic
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.