Skip to content

Commit a2fa846

Browse files
author
Evgeniy Sidenko
committed
Updated up to 22.11
1 parent 87ce589 commit a2fa846

File tree

6 files changed

+77
-7
lines changed

6 files changed

+77
-7
lines changed

Examples/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ This directory contains Java code examples for [Aspose.Imaging for Java](https:/
44

55
## How to use the examples?
66

7-
Use your favourite Java IDE to open/import the project. Read our [documentation](https://docs.aspose.com/display/imagingjava/How+to+Use+the+Examples) for more details.
7+
Use your favorite Java IDE to open/import the project. Read our [documentation](https://docs.aspose.com/display/imagingjava/How+to+Use+the+Examples) for more details.

Examples/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>com.aspose</groupId>
55
<artifactId>imaging-java-examples</artifactId>
6-
<version>22.10</version>
6+
<version>22.11</version>
77
<packaging>jar</packaging>
88
<properties>
99
<maven.compiler.source>1.8</maven.compiler.source>
@@ -15,14 +15,14 @@
1515
<dependency>
1616
<groupId>com.aspose</groupId>
1717
<artifactId>aspose-imaging</artifactId>
18-
<version>22.10</version>
18+
<version>22.11</version>
1919
<classifier>jdk16</classifier>
2020
<type>jar</type>
2121
</dependency>
2222
<dependency>
2323
<groupId>com.aspose</groupId>
2424
<artifactId>aspose-imaging</artifactId>
25-
<version>22.10</version>
25+
<version>22.11</version>
2626
<classifier>javadoc</classifier>
2727
<type>jar</type>
2828
</dependency>
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
package com.aspose.imaging.examples.ModifyingImages.fonts;
2+
3+
import com.aspose.imaging.FontSettings;
4+
import com.aspose.imaging.examples.Logger;
5+
import com.aspose.imaging.examples.Utils;
6+
import com.aspose.imaging.fileformats.emf.EmfImage;
7+
import com.aspose.imaging.fileformats.emf.emf.consts.EmfExtTextOutOptions;
8+
import com.aspose.imaging.fileformats.emf.emf.objects.EmfLogFont;
9+
import com.aspose.imaging.fileformats.emf.emf.objects.EmfText;
10+
import com.aspose.imaging.fileformats.emf.emf.records.EmfExtCreateFontIndirectW;
11+
import com.aspose.imaging.fileformats.emf.emf.records.EmfExtTextOutW;
12+
import com.aspose.imaging.fileformats.emf.emf.records.EmfSelectObject;
13+
14+
import java.io.File;
15+
16+
public class SpecifyFont
17+
{
18+
public static void main(String[] args)
19+
{
20+
Logger.startExample();
21+
22+
// The path to the documents' directory.
23+
String baseFolder = Utils.getSharedDataDir() + "Fonts/";
24+
final String fontName = "Cambria Math";
25+
final int symbolCount = 40; //count symbols in the example
26+
final int startIndex = 2001; //start GlyphIndex for example
27+
FontSettings.setFontsFolder(baseFolder);
28+
29+
//Fill GlyphIndex buffer
30+
int[] glyphCodes = new int[symbolCount];
31+
for (int i = 0; i < symbolCount; i++)
32+
{
33+
glyphCodes[i] = startIndex + i;
34+
}
35+
36+
//create emf
37+
try (EmfImage emf = new EmfImage(700, 100))
38+
{
39+
//font record
40+
EmfExtCreateFontIndirectW font = new EmfExtCreateFontIndirectW();
41+
final EmfLogFont emfLogFont = new EmfLogFont();
42+
font.setElw(emfLogFont);
43+
emfLogFont.setFacename(fontName);
44+
emfLogFont.setHeight(30);
45+
46+
//text record
47+
EmfExtTextOutW text = new EmfExtTextOutW();
48+
final EmfText emfText = new EmfText();
49+
text.setWEmrText(emfText);
50+
emfText.setOptions(EmfExtTextOutOptions.ETO_GLYPH_INDEX); //symbols index as GlyphIndex
51+
emfText.setChars(symbolCount); //string length
52+
emfText.setGlyphIndexBuffer(glyphCodes); //index buffer
53+
54+
emf.getRecords().add(font); //add font
55+
final EmfSelectObject emfSelectObject = new EmfSelectObject();
56+
emfSelectObject.setObjectHandle(0);
57+
emf.getRecords().add(emfSelectObject); //select font
58+
emf.getRecords().add(text); //add text
59+
emf.save(baseFolder + "result.png"); //rendering
60+
}
61+
62+
// Delete the result file
63+
new File(baseFolder + "result.png").delete();
64+
65+
Logger.endExample();
66+
}
67+
}

Examples/src/main/java/com/aspose/imaging/examples/RunExamples.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import com.aspose.imaging.examples.ModifyingImages.dicom.SupportStoringXmpTags;
3030
import com.aspose.imaging.examples.ModifyingImages.dxf.ExportToDxf;
3131
import com.aspose.imaging.examples.ModifyingImages.eps.ExportEps;
32+
import com.aspose.imaging.examples.ModifyingImages.fonts.SpecifyFont;
3233
import com.aspose.imaging.examples.ModifyingImages.gif.CreateGifUsingAddPage;
3334
import com.aspose.imaging.examples.ModifyingImages.gif.SupportGifFrameDurationAndNumberOfCycles;
3435
import com.aspose.imaging.examples.ModifyingImages.gif.SupportOfFullFrameGif;
@@ -114,6 +115,7 @@ public static void main(String[] args) throws IOException, InterruptedException,
114115
//// =====================================================
115116

116117
Logger.println("Running modifying and converting images tests:");
118+
SpecifyFont.main(args);
117119
Support16BitChannel64BitPng.main(args);
118120
ConvertIcoToTiff.main(args);
119121
JpegSavedQualityEstimation.main(args);
1.34 MB
Binary file not shown.

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Directory | Description
3434

3535
## Load & Save Image Formats
3636

37-
**Raster Formats:** JPEG2000, JPEG, BMP, TIFF, GIF, PNG, DICOM\
37+
**Raster Formats:** JPEG2000, JPEG, BMP, TIFF, GIF, PNG, DICOM, TGA, ICO\
3838
**Metafiles:** EMF, WMF\
3939
**Compressed metafiles:** EMZ, WMZ\
4040
**Other:** WebP, Svg, Svgz (compressed Svg)\
@@ -43,11 +43,12 @@ Directory | Description
4343
## Save Images As
4444
**Fixed-layout:** PDF\
4545
**Photoshop:** PSD\
46-
**Web:** Html5 Canvas
46+
**Web:** Html5 Canvas\
47+
**Dxf:** Dxf
4748

4849
## Load Images
4950

50-
**Various:** DjVu, DNG, ODG, EPS(raster preview only), CMX, CDR, DIB, OTG, FODG
51+
**Various:** DjVu, DNG, ODG, EPS, CMX, CDR, DIB, OTG, FODG
5152

5253

5354
## Platform Independence

0 commit comments

Comments
 (0)