mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-05-22 12:41:27 +00:00
load bundled font for "Cryptomator" title
This commit is contained in:
@@ -4,6 +4,7 @@ import javafx.beans.binding.BooleanBinding;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.stage.Stage;
|
||||
import org.cryptomator.ui.common.FxController;
|
||||
import org.cryptomator.ui.fxapp.FxApplication;
|
||||
@@ -13,10 +14,13 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
@MainWindowScoped
|
||||
public class MainWindowController implements FxController {
|
||||
|
||||
private static final String TITLE_FONT = "/css/dosis-bold.ttf";
|
||||
private static final Logger LOG = LoggerFactory.getLogger(MainWindowController.class);
|
||||
|
||||
private final Stage window;
|
||||
@@ -41,6 +45,7 @@ public class MainWindowController implements FxController {
|
||||
@FXML
|
||||
public void initialize() {
|
||||
LOG.debug("init MainWindowController");
|
||||
loadFont(TITLE_FONT);
|
||||
titleBar.setOnMousePressed(event -> {
|
||||
xOffset = event.getSceneX();
|
||||
yOffset = event.getSceneY();
|
||||
@@ -57,6 +62,19 @@ public class MainWindowController implements FxController {
|
||||
updateChecker.automaticallyCheckForUpdatesIfEnabled();
|
||||
}
|
||||
|
||||
private void loadFont(String resourcePath) {
|
||||
try (InputStream in = getClass().getResourceAsStream(resourcePath)) {
|
||||
Font font = Font.loadFont(in, 12.0);
|
||||
if (font == null) {
|
||||
LOG.warn("Error loading font from path: " + resourcePath);
|
||||
} else {
|
||||
LOG.debug("Loaded font {}", font.getFamily());
|
||||
}
|
||||
} catch (IOException e) {
|
||||
LOG.warn("Error loading font from path: " + resourcePath, e);
|
||||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void close() {
|
||||
if (minimizeToSysTray) {
|
||||
|
||||
BIN
main/ui/src/main/resources/css/dosis-bold.ttf
Normal file
BIN
main/ui/src/main/resources/css/dosis-bold.ttf
Normal file
Binary file not shown.
Reference in New Issue
Block a user