Fixed #2239 Default font name detection

Fixed #2239 Exporting TTF font on Linux
This commit is contained in:
Jindra Petřík
2024-07-21 19:43:35 +02:00
parent 2158be80fe
commit d46d32be30
6 changed files with 26 additions and 10 deletions

View File

@@ -28,9 +28,15 @@ package fontastic;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.doubletype.ossa.Engine;
import org.doubletype.ossa.OutOfRangeException;
import org.doubletype.ossa.adapter.EContour;
@@ -169,11 +175,18 @@ public class Fontastic {
m_engine.getTypeface().addRequiredGlyphs();
m_engine.buildTrueType();
// End TTF creation
if (outFile.exists()) {
outFile.delete();
// End TTF creation
Path copied = outFile.toPath();
Path originalPath = ttfFile.toPath();
try {
Files.copy(originalPath, copied, StandardCopyOption.REPLACE_EXISTING);
} catch (IOException ex) {
//ignore
}
ttfFile.renameTo(outFile);
ttfFile.delete();
cleanup();
}