Skip to content

Commit 1cb7ff1

Browse files
committed
Add Windows Metafile examples
1 parent ba3a562 commit 1cb7ff1

File tree

4 files changed

+63
-1
lines changed

4 files changed

+63
-1
lines changed

Examples/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<dependency>
1515
<groupId>com.aspose</groupId>
1616
<artifactId>aspose-imaging</artifactId>
17-
<version>3.0</version>
17+
<version>3.0.2</version>
1818
<classifier>jdk16</classifier>
1919
</dependency>
2020
</dependencies>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Copyright 2001-2015 Aspose Pty Ltd. All Rights Reserved.
3+
*
4+
* This file is part of Aspose.Imaging. The source code in this file
5+
* is only intended as a supplement to the documentation, and is provided
6+
* "as is", without warranty of any kind, either expressed or implied.
7+
*/
8+
package com.aspose.imaging.examples.metafile;
9+
10+
import com.aspose.imaging.examples.Utils;
11+
import com.aspose.imaging.fileformats.metafile.FontSettings;
12+
import com.aspose.imaging.fileformats.metafile.MetafileImage;
13+
import com.aspose.imaging.fileformats.metafile.EmfMetafileImage;
14+
15+
public class GetFontInfo {
16+
17+
public static void main(String... args) throws Exception {
18+
String dataDir = Utils.getDataDir(GetFontInfo.class);
19+
20+
System.out.println("Get list of font names accessible to Aspose.Imaging API");
21+
for (String f : FontSettings.getAllFonts()) {
22+
System.out.println("\t" + f);
23+
}
24+
25+
System.out.println("Get list of font names used in the metafile");
26+
MetafileImage metafile = new EmfMetafileImage(dataDir + "Sample1.emf");
27+
for (String f : metafile.getUsedFonts()) {
28+
System.out.println("\t" + f);
29+
}
30+
31+
System.out.println("Get list of font names that are missing");
32+
for (String f : metafile.getMissedFonts()) {
33+
System.out.println("\t" + f);
34+
}
35+
}
36+
}
37+
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright 2001-2015 Aspose Pty Ltd. All Rights Reserved.
3+
*
4+
* This file is part of Aspose.Imaging. The source code in this file
5+
* is only intended as a supplement to the documentation, and is provided
6+
* "as is", without warranty of any kind, either expressed or implied.
7+
*/
8+
package com.aspose.imaging.examples.metafile;
9+
10+
import java.nio.file.Paths;
11+
import com.aspose.imaging.fileformats.metafile.FontSettings;
12+
13+
public class SpecifyFontFolder {
14+
15+
public static void main(String... args) throws Exception {
16+
String fonts = Paths.get(System.getProperty("user.home"), "Fonts").toString();
17+
System.out.println("Adding fonts from user's home directory: " + fonts);
18+
FontSettings.addFontsFolder(fonts);
19+
20+
System.out.println("List of all fonts:");
21+
for (String f : FontSettings.getAllFonts()) {
22+
System.out.println("\t" + f);
23+
}
24+
}
25+
}
Binary file not shown.

0 commit comments

Comments
 (0)