- Timestamp:
- 2026-02-18T15:24:56+01:00 (18 hours ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 edited
-
gui/io/importexport/WMSLayerExporter.java (modified) (2 diffs)
-
gui/io/importexport/WMSLayerImporter.java (modified) (2 diffs)
-
tools/PlatformHookWindows.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/io/importexport/WMSLayerExporter.java
r13204 r19534 5 5 import java.io.IOException; 6 6 import java.io.ObjectOutputStream; 7 import java.io.OutputStream; 7 8 import java.nio.file.Files; 8 9 … … 38 39 39 40 if (layer instanceof AbstractTileSourceLayer) { 40 try (ObjectOutputStream oos = new ObjectOutputStream( Files.newOutputStream(file.toPath()))) {41 try (OutputStream fos = Files.newOutputStream(file.toPath()); ObjectOutputStream oos = new ObjectOutputStream(fos)) { 41 42 oos.writeInt(CURRENT_FILE_VERSION); // file version 42 43 oos.writeObject(MainApplication.getMap().mapView.getCenter()); -
trunk/src/org/openstreetmap/josm/gui/io/importexport/WMSLayerImporter.java
r13204 r19534 6 6 import java.io.File; 7 7 import java.io.IOException; 8 import java.io.InputStream; 8 9 import java.io.InvalidClassException; 9 10 import java.io.ObjectInputStream; … … 49 50 final ImageryLayer layer; 50 51 51 try (ObjectInputStream ois = new ObjectInputStream( Files.newInputStream(file.toPath()))) {52 try (InputStream fis = Files.newInputStream(file.toPath()); ObjectInputStream ois = new ObjectInputStream(fis)) { 52 53 int sfv = ois.readInt(); 53 54 if (sfv < 5) { -
trunk/src/org/openstreetmap/josm/tools/PlatformHookWindows.java
r19103 r19534 473 473 File cachePath = Config.getDirs().getCacheDirectory(true); 474 474 Path fontconfigFile = cachePath.toPath().resolve("fontconfig.properties"); 475 OutputStream os = Files.newOutputStream(fontconfigFile); // NOPMD 476 os.write(content); 477 try (Writer w = new BufferedWriter(new OutputStreamWriter(os, StandardCharsets.UTF_8))) { 478 Collection<FontEntry> extrasPref = StructUtils.getListOfStructs(Config.getPref(), 479 "font.extended-unicode.extra-items", getAdditionalFonts(), FontEntry.class); 480 Collection<FontEntry> extras = new ArrayList<>(); 481 w.append("\n\n# Added by JOSM to extend unicode coverage of Java font support:\n\n"); 482 List<String> allCharSubsets = new ArrayList<>(); 483 for (FontEntry entry: extrasPref) { 484 Collection<String> fontsAvail = getInstalledFonts(); 485 if (fontsAvail != null && fontsAvail.contains(entry.file.toUpperCase(Locale.ENGLISH))) { 486 if (!allCharSubsets.contains(entry.charset)) { 487 allCharSubsets.add(entry.charset); 488 extras.add(entry); 475 try (OutputStream os = Files.newOutputStream(fontconfigFile)) { 476 os.write(content); 477 try (Writer w = new BufferedWriter(new OutputStreamWriter(os, StandardCharsets.UTF_8))) { 478 Collection<FontEntry> extrasPref = StructUtils.getListOfStructs(Config.getPref(), 479 "font.extended-unicode.extra-items", getAdditionalFonts(), FontEntry.class); 480 Collection<FontEntry> extras = new ArrayList<>(); 481 w.append("\n\n# Added by JOSM to extend unicode coverage of Java font support:\n\n"); 482 List<String> allCharSubsets = new ArrayList<>(); 483 for (FontEntry entry: extrasPref) { 484 Collection<String> fontsAvail = getInstalledFonts(); 485 if (fontsAvail != null && fontsAvail.contains(entry.file.toUpperCase(Locale.ENGLISH))) { 486 if (!allCharSubsets.contains(entry.charset)) { 487 allCharSubsets.add(entry.charset); 488 extras.add(entry); 489 } else { 490 Logging.trace("extended font config - already registered font for charset ''{0}'' - skipping ''{1}''", 491 entry.charset, entry.name); 492 } 489 493 } else { 490 Logging.trace("extended font config - already registered font for charset ''{0}'' - skipping ''{1}''", 491 entry.charset, entry.name); 494 Logging.trace("extended font config - Font ''{0}'' not found on system - skipping", entry.name); 492 495 } 493 } else {494 Logging.trace("extended font config - Font ''{0}'' not found on system - skipping", entry.name);495 496 } 497 for (FontEntry entry: extras) { 498 allCharSubsets.add(entry.charset); 499 if ("".equals(entry.name)) { 500 continue; 501 } 502 String key = "allfonts." + entry.charset; 503 String value = entry.name; 504 String prevValue = props.getProperty(key); 505 if (prevValue != null && !prevValue.equals(value)) { 506 Logging.warn("extended font config - overriding ''{0}={1}'' with ''{2}''", key, prevValue, value); 507 } 508 w.append(key).append('=').append(value).append('\n'); 509 } 510 w.append('\n'); 511 for (FontEntry entry: extras) { 512 if ("".equals(entry.name) || "".equals(entry.file)) { 513 continue; 514 } 515 String key = "filename." + entry.name.replace(' ', '_'); 516 String value = entry.file; 517 String prevValue = props.getProperty(key); 518 if (prevValue != null && !prevValue.equals(value)) { 519 Logging.warn("extended font config - overriding ''{0}={1}'' with ''{2}''", key, prevValue, value); 520 } 521 w.append(key).append('=').append(value).append('\n'); 522 } 523 w.append('\n'); 524 w.append("sequence.fallback="); 525 String fallback = props.getProperty("sequence.fallback"); 526 if (fallback != null) { 527 w.append(fallback).append(","); 528 } 529 w.append(String.join(",", allCharSubsets)).append("\n"); 496 530 } 497 for (FontEntry entry: extras) {498 allCharSubsets.add(entry.charset);499 if ("".equals(entry.name)) {500 continue;501 }502 String key = "allfonts." + entry.charset;503 String value = entry.name;504 String prevValue = props.getProperty(key);505 if (prevValue != null && !prevValue.equals(value)) {506 Logging.warn("extended font config - overriding ''{0}={1}'' with ''{2}''", key, prevValue, value);507 }508 w.append(key).append('=').append(value).append('\n');509 }510 w.append('\n');511 for (FontEntry entry: extras) {512 if ("".equals(entry.name) || "".equals(entry.file)) {513 continue;514 }515 String key = "filename." + entry.name.replace(' ', '_');516 String value = entry.file;517 String prevValue = props.getProperty(key);518 if (prevValue != null && !prevValue.equals(value)) {519 Logging.warn("extended font config - overriding ''{0}={1}'' with ''{2}''", key, prevValue, value);520 }521 w.append(key).append('=').append(value).append('\n');522 }523 w.append('\n');524 w.append("sequence.fallback=");525 String fallback = props.getProperty("sequence.fallback");526 if (fallback != null) {527 w.append(fallback).append(",");528 }529 w.append(String.join(",", allCharSubsets)).append("\n");530 531 } 531 532 Utils.updateSystemProperty("sun.awt.fontconfig", fontconfigFile.toString());
Note:
See TracChangeset
for help on using the changeset viewer.
