mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-09 09:29:41 +00:00
Fixed #1750 Application won't start when cannot access font file
This commit is contained in:
@@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file.
|
||||
### Fixed
|
||||
- AS1/2 handle declaration of registers in certain cases
|
||||
- AS1/2 setProperty, getProperty handling
|
||||
- [#1750] Application won't start when cannot access font file
|
||||
|
||||
## [14.5.1] - 2021-11-20
|
||||
### Fixed
|
||||
@@ -2110,7 +2111,8 @@ All notable changes to this project will be documented in this file.
|
||||
### Added
|
||||
- Initial public release
|
||||
|
||||
[Unreleased]: https://github.com/jindrapetrik/jpexs-decompiler/compare/version14.4.0...dev
|
||||
[14.5.1]: https://github.com/jindrapetrik/jpexs-decompiler/compare/version14.5.0...version14.5.1
|
||||
[14.5.0]: https://github.com/jindrapetrik/jpexs-decompiler/compare/version14.4.0...version14.5.0
|
||||
[14.4.0]: https://github.com/jindrapetrik/jpexs-decompiler/compare/version14.3.1...version14.4.0
|
||||
[14.3.1]: https://github.com/jindrapetrik/jpexs-decompiler/compare/version14.3.0...version14.3.1
|
||||
[14.3.0]: https://github.com/jindrapetrik/jpexs-decompiler/compare/version14.2.1...version14.3.0
|
||||
@@ -2224,6 +2226,7 @@ All notable changes to this project will be documented in this file.
|
||||
[alpha 9]: https://github.com/jindrapetrik/jpexs-decompiler/compare/alpha8...alpha9
|
||||
[alpha 8]: https://github.com/jindrapetrik/jpexs-decompiler/compare/alpha7...alpha8
|
||||
[alpha 7]: https://github.com/jindrapetrik/jpexs-decompiler/releases/tag/alpha7
|
||||
[#1750]: https://www.free-decompiler.com/flash/issues/1750
|
||||
[#1485]: https://www.free-decompiler.com/flash/issues/1485
|
||||
[#1681]: https://www.free-decompiler.com/flash/issues/1681
|
||||
[#1744]: https://www.free-decompiler.com/flash/issues/1744
|
||||
|
||||
@@ -51,7 +51,6 @@ public class FontHelper {
|
||||
Class<?> clFmFactory = Class.forName("sun.font.FontManagerFactory");
|
||||
return clFmFactory.getDeclaredMethod("getInstance").invoke(null);
|
||||
}*/
|
||||
|
||||
/**
|
||||
* Gets all available fonts in the system
|
||||
*
|
||||
@@ -89,7 +88,7 @@ public class FontHelper {
|
||||
} catch (Throwable ex) {
|
||||
// ignore
|
||||
}
|
||||
*/
|
||||
*/
|
||||
if (fonts == null) {
|
||||
fonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
|
||||
}
|
||||
@@ -312,23 +311,28 @@ public class FontHelper {
|
||||
return ret;
|
||||
}
|
||||
|
||||
private static List<File> getTtfFilesRecursively(File dir) {
|
||||
List<File> ret = new ArrayList<>();
|
||||
try {
|
||||
File files[] = dir.listFiles();
|
||||
for (File f : files) {
|
||||
if (f.isDirectory()) {
|
||||
ret.addAll(getTtfFilesRecursively(f));
|
||||
} else if (f.getAbsolutePath().endsWith(".ttf") || f.getAbsolutePath().endsWith(".TTF")) {
|
||||
ret.add(f);
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
//ignore any access errors
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
private static List<File> getSystemFontFiles() {
|
||||
List<File> dirs = getSystemFontDirectories();
|
||||
List<File> ret = new ArrayList<>();
|
||||
for (File d : dirs) {
|
||||
try {
|
||||
Object[] paths = Files.find(d.toPath(), Integer.MAX_VALUE, new BiPredicate<Path, BasicFileAttributes>() {
|
||||
@Override
|
||||
public boolean test(Path t, BasicFileAttributes u) {
|
||||
return u.isRegularFile() && (t.toString().endsWith(".ttf") || t.toString().endsWith(".TTF"));
|
||||
}
|
||||
}).toArray();
|
||||
for (Object o : paths) {
|
||||
ret.add(((Path) o).toFile());
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
//ignore
|
||||
}
|
||||
ret.addAll(getTtfFilesRecursively(d));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user