mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-27 09:10:45 +00:00
better font name handling
kerning moved to FontHelper
This commit is contained in:
@@ -452,7 +452,7 @@ public class Configuration {
|
||||
recentFiles.set(Helper.joinStrings(recentFilesArray, "::"));
|
||||
}
|
||||
|
||||
public static Map<String, String> getFontIdToFamilyMap() {
|
||||
public static Map<String, String> getFontToNameMap() {
|
||||
String fonts = fontPairing.get();
|
||||
if (fonts == null) {
|
||||
return new HashMap<>();
|
||||
@@ -467,39 +467,20 @@ public class Configuration {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static Map<String, String> getFontIdToFaceMap() {
|
||||
String fonts = fontPairing.get();
|
||||
if (fonts == null) {
|
||||
return new HashMap<>();
|
||||
}
|
||||
|
||||
Map<String, String> result = new HashMap<>();
|
||||
for (String pair : fonts.split("::")) {
|
||||
if (!pair.isEmpty()) {
|
||||
String[] splittedPair = pair.split("=");
|
||||
result.put(splittedPair[0], splittedPair.length < 3 ? "" : splittedPair[2]);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void addFontPair(String fileName, int fontId, String fontName, String installedFontFamily, String installedFontFace) {
|
||||
|
||||
public static void addFontPair(String fileName, int fontId, String fontName, String installedName) {
|
||||
String key = fileName + "_" + fontId + "_" + fontName;
|
||||
Map<String, String> fontPairs = getFontIdToFamilyMap();
|
||||
fontPairs.put(key, installedFontFamily);
|
||||
fontPairs.put(fontName, installedFontFamily);
|
||||
Map<String, String> fontPairs = getFontToNameMap();
|
||||
fontPairs.put(key, installedName);
|
||||
fontPairs.put(fontName, installedName);
|
||||
|
||||
Map<String, String> facePairs = getFontIdToFaceMap();
|
||||
facePairs.put(key, installedFontFace);
|
||||
facePairs.put(fontName, installedFontFace);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int i = 0;
|
||||
for (Entry<String, String> pair : fontPairs.entrySet()) {
|
||||
if (i != 0) {
|
||||
sb.append("::");
|
||||
}
|
||||
sb.append(pair.getKey()).append("=").append(pair.getValue()).append("=").append(facePairs.containsKey(pair.getKey()) ? facePairs.get(pair.getKey()) : "");
|
||||
sb.append(pair.getKey()).append("=").append(pair.getValue());
|
||||
i++;
|
||||
}
|
||||
fontPairing.set(sb.toString());
|
||||
|
||||
Reference in New Issue
Block a user