fix regression to display tabular numbers in a monospace font

This commit is contained in:
Craig Raw 2024-10-28 10:04:33 +02:00
parent ad0b6adfd8
commit d0bf55de70
4 changed files with 22 additions and 12 deletions

View file

@ -42,10 +42,7 @@ public class SparrowDesktop extends Application {
public void start(Stage stage) throws Exception { public void start(Stage stage) throws Exception {
this.mainStage = stage; this.mainStage = stage;
GlyphFontRegistry.register(new FontAwesome5()); initializeFonts();
GlyphFontRegistry.register(new FontAwesome5Brands());
Font.loadFont(AppServices.class.getResourceAsStream("/font/RobotoMono-Regular.ttf"), 13);
Font.loadFont(AppServices.class.getResourceAsStream("/font/RobotoMono-Italic.ttf"), 11);
URL.setURLStreamHandlerFactory(protocol -> WalletIcon.PROTOCOL.equals(protocol) ? new WalletIcon.WalletIconStreamHandler() : null); URL.setURLStreamHandlerFactory(protocol -> WalletIcon.PROTOCOL.equals(protocol) ? new WalletIcon.WalletIconStreamHandler() : null);
AppServices.initialize(this); AppServices.initialize(this);
@ -117,6 +114,16 @@ public class SparrowDesktop extends Application {
}); });
} }
private void initializeFonts() {
GlyphFontRegistry.register(new FontAwesome5());
GlyphFontRegistry.register(new FontAwesome5Brands());
Font.loadFont(AppServices.class.getResourceAsStream("/font/RobotoMono-Regular.ttf"), 13);
Font.loadFont(AppServices.class.getResourceAsStream("/font/RobotoMono-Italic.ttf"), 11);
if(Platform.getCurrent() == Platform.OSX) {
Font.loadFont(AppServices.class.getResourceAsStream("/font/LiberationSans-Regular.ttf"), 13);
}
}
@Override @Override
public void stop() throws Exception { public void stop() throws Exception {
AppServices.get().stop(); AppServices.get().stop();

View file

@ -811,12 +811,11 @@ public class EntryCell extends TreeTableCell<Entry, Entry> implements Confirmati
cell.getStyleClass().remove("negative-amount"); cell.getStyleClass().remove("negative-amount");
cell.getStyleClass().remove("spent"); cell.getStyleClass().remove("spent");
cell.getStyleClass().remove("unspendable"); cell.getStyleClass().remove("unspendable");
cell.getStyleClass().remove("number-field");
if(entry != null) { if(entry != null) {
if(entry instanceof TransactionEntry) { if(entry instanceof TransactionEntry transactionEntry) {
cell.getStyleClass().add("transaction-row"); cell.getStyleClass().add("transaction-row");
TransactionEntry transactionEntry = (TransactionEntry)entry;
if(cell instanceof ConfirmationsListener confirmationsListener) { if(cell instanceof ConfirmationsListener confirmationsListener) {
if(transactionEntry.isConfirming()) { if(transactionEntry.isConfirming()) {
cell.getStyleClass().add("confirming"); cell.getStyleClass().add("confirming");
@ -825,17 +824,21 @@ public class EntryCell extends TreeTableCell<Entry, Entry> implements Confirmati
confirmationsListener.getConfirmationsProperty().unbind(); confirmationsListener.getConfirmationsProperty().unbind();
} }
} }
if(org.controlsfx.tools.Platform.getCurrent() == org.controlsfx.tools.Platform.OSX && transactionEntry.getBlockTransaction().getHeight() > 0) {
cell.getStyleClass().add("number-field");
}
} else if(entry instanceof NodeEntry) { } else if(entry instanceof NodeEntry) {
cell.getStyleClass().add("node-row"); cell.getStyleClass().add("node-row");
} else if(entry instanceof UtxoEntry) { } else if(entry instanceof UtxoEntry utxoEntry) {
cell.getStyleClass().add("utxo-row"); cell.getStyleClass().add("utxo-row");
UtxoEntry utxoEntry = (UtxoEntry)entry;
if(!utxoEntry.isSpendable()) { if(!utxoEntry.isSpendable()) {
cell.getStyleClass().add("unspendable"); cell.getStyleClass().add("unspendable");
} }
} else if(entry instanceof HashIndexEntry) { if(org.controlsfx.tools.Platform.getCurrent() == org.controlsfx.tools.Platform.OSX && utxoEntry.getHashIndex().getHeight() > 0) {
cell.getStyleClass().add("number-field");
}
} else if(entry instanceof HashIndexEntry hashIndexEntry) {
cell.getStyleClass().add("hashindex-row"); cell.getStyleClass().add("hashindex-row");
HashIndexEntry hashIndexEntry = (HashIndexEntry)entry;
if(hashIndexEntry.isSpent()) { if(hashIndexEntry.isSpent()) {
cell.getStyleClass().add("spent"); cell.getStyleClass().add("spent");
} }

View file

@ -251,7 +251,7 @@
} }
.number-field { .number-field {
-fx-font-family: 'Helvetica Neue Regular', 'System Regular'; -fx-font-family: 'Liberation Sans';
} }
VerticalHeader > Label.selected { VerticalHeader > Label.selected {

Binary file not shown.