ضبط الخصائص على الصور

تحديث ذاكرة التخزين المؤقت للخطوط

باستخدام Aspose.PSD لـ Java ، يمكن للمطورين إضافة إمكانية تحديث ذاكرة التخزين المؤقت للخطوط. فيما يلي توضيح للشيفرة لهذه الوظيفة المحددة.

String dataDir = Utils.getDataDir(ForceFontCache.class) + "DrawingAndFormattingImages/";
try (PsdImage image = (PsdImage) Image.load(dataDir + "sample.psd")) {
image.save(dataDir + "NoFont.psd");
}
System.out.println("You have 2 minutes to install the font");
Thread.sleep(2 * 60 * 1000);
OpenTypeFontsCache.updateCache();
try (PsdImage image1 = (PsdImage) Image.load(dataDir + "sample.psd")) {
image1.save(dataDir + "HasFont.psd");
}

ضبط البديل للخطوط المفقودة

باستخدام Aspose.PSD لـ Java ، يمكن للمطورين استبدال الخطوط المفقودة. باستخدام شيفرة العينة أدناه سيتمكن المطورون من تعيين اسم الخط الافتراضي عند حفظ مستندات PSD كصورة نقطية (PNG، JPG، BMP). يجب استخدام هذا الخط الافتراضي كبديل لجميع الخطوط المفقودة، وهي الخطوط التي لم يتم العثور عليها في نظام التشغيل الحالي. فيما يلي توضيح لهذه الوظيفة المحددة.

String dataDir = Utils.getDataDir(FontReplacement.class) + "DrawingAndFormattingImages/";
// Load an image in an instance of image and setting default replacement font.
PsdLoadOptions psdLoadOptions = new PsdLoadOptions();
psdLoadOptions.setDefaultReplacementFont("Arial");
try (PsdImage psdImage = (PsdImage) Image.load(dataDir + "Cloud_AzPlat_Banner3A_SB_EN_US_160x600_chinese_font.psd", psdLoadOptions)) {
PngOptions pngOptions = new PngOptions();
psdImage.save(dataDir + "replaced_font.png", pngOptions);
}