글꼴 캐시 업데이트
Aspose.PSD for .NET을 사용하면 개발자들이 글꼴 캐시를 새로 고칠 수 있습니다. 아래는 해당 기능을 나타내는 코드 예제입니다.
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
// For complete examples and data files, please go to https://github.com/aspose-psd/Aspose.PSD-for-.NET | |
using (PsdImage image = (PsdImage)Image.Load(dataDir + "sample.psd")) | |
{ | |
image.Save("NoFont.psd"); | |
} | |
Console.WriteLine("You have 2 minutes to install the font"); | |
Thread.Sleep(TimeSpan.FromMinutes(2)); | |
OpenTypeFontsCache.UpdateCache(); | |
using (PsdImage image = (PsdImage)Image.Load(dataDir + @"sample.psd")) | |
{ | |
image.Save(dataDir + "HasFont.psd"); | |
} |
누락된 글꼴을 위한 대체 설정
Aspose.PSD for .NET을 사용하면 개발자들이 누락된 글꼴을 대체할 수 있습니다. 아래 샘플 코드를 사용하면 PSD 문서를 래스터 이미지(PNG, JPG 및 BMP 형식)로 저장할 때 기본 글꼴 이름을 설정할 수 있습니다. 이 기본 글꼴은 현재 운영 체제에서 찾을 수 없는 글꼴, 즉 누락된 글꼴에 대한 대체로 사용될 예정입니다. 아래는 해당 기능을 나타내는 코드 예제입니다.
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
// For complete examples and data files, please go to https://github.com/aspose-psd/Aspose.PSD-for-.NET | |
string sourceFileName = "sample_konstanting.psd"; | |
string[] outputs = new string[] | |
{ | |
"replacedfont0.tiff", | |
"replacedfont1.png", | |
"replacedfont2.jpg" | |
}; | |
using (PsdImage image = (PsdImage)Image.Load(sourceFileName, new PsdLoadOptions())) | |
{ | |
// This way you can use different fonts for different outputs | |
image.Save(outputs[0], new TiffOptions(TiffExpectedFormat.TiffJpegRgb) { DefaultReplacementFont = "Arial" }); | |
image.Save(outputs[1], new PngOptions { DefaultReplacementFont = "Verdana" }); | |
image.Save(outputs[2], new JpegOptions { DefaultReplacementFont = "Times New Roman" }); | |
} |