How load font?

folder setting

base/Fonts/NotoSans-JP.ttf
base/Fonts/NotoSans-KR.ttf

using Aspose.PSD.FileFormats.Psd.Layers;
using Aspose.PSD.FileFormats.Psd;
using Aspose.PSD;
using Aspose.PSD.FileFormats.Psd.Layers.FillLayers;
using Aspose.PSD.FileFormats.Psd.Layers.LayerResources;
using Aspose.PSD.ImageOptions;
using Aspose.PSD.FileFormats.Psd.Layers.Text;

string path = @“d:”;
string psdFile = Path.Combine(path, “test2.psd”);
string psdFileSave = Path.Combine(path, “test2-result.psd”);
new License().SetLicense(“Aspose.PSD.NET.lic”);

FontSettings.SetFontsFolder(System.IO.Path.Combine(AppContext.BaseDirectory, “Fonts”));

FontSettings.UpdateFonts();

using (var pfile = (PsdImage)Aspose.PSD.Image.Load(psdFile))
{

var text = pfile.AddTextLayer("테스트", new Rectangle(50, 50, 100, 100));
foreach(var x in text.TextData.Items)
{
    x.Style.FontName = FontSettings.GetAdobeFontName("NotoSans-KR.ttf");

}
pfile.Save(psdFileSave);

}

Aspose.PSD.CoreExceptions.ImageFormats.PsdImageArgumentException: ‘Font name can’t be NULL, empty, or whitespace.’

FontSettings.GetAdobeFontName(“NotoSans-KR.ttf”);
FontSettings.GetAdobeFontName(“NotoSans-KR”);
FontSettings.GetAdobeFontName(“NotoSans”);
FontSettings.GetAdobeFontName(“Noto Sans”);
FontSettings.GetAdobeFontName(“Noto Sans KR”);

same fail error

@blackshining

Please check the following example: FontSettings.GetAdobeFontName | Aspose.PSD for .NET API Reference

In what’s the OS you trying to execute this code?

OS is windows, windows server 2016 but, i see
Aspose.PSD.CoreExceptions.ImageFormats.PsdImageArgumentException: ‘Font name can’t be NULL, empty, or whitespace.’
error

@blackshining
If the Font Directory is correctly specified please use Debug to find what the result of this method:

Should work:

var fontName = FontSettings.GetAdobeFontName("Noto Sans");

or

var fontName = FontSettings.GetAdobeFontName("Noto Sans ExtraLight");

for example.

Also, I tested with JP version of Font. The following code should work:

var fontName = FontSettings.GetAdobeFontName("Noto Sans JP Thin");

Please note, if the result of this method is null you can not set the Null to the

  x.Style.FontName