Skip to content

Commit

Permalink
Add Custom Font
Browse files Browse the repository at this point in the history
  • Loading branch information
sotasan committed May 10, 2022
1 parent c120d73 commit 3a71446
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<a href="https://github.com/PryosCode/Decompiler/blob/master/LICENSE"><img alt="License" src="https://img.shields.io/github/license/PryosCode/Decompiler?label=License"></a>
</p>

# <a href="https://github.com/PryosCode/Decompiler/blob/master/src/main/resources/logo.png"><img src="https://github.com/PryosCode/Decompiler/raw/master/src/main/resources/logo.png" alt="Logo" width="30" height="auto"></a> Decompiler
# <a href="https://github.com/PryosCode/Decompiler/blob/master/src/main/resources/icons/logo.png"><img src="https://github.com/PryosCode/Decompiler/raw/master/src/main/resources/icons/logo.png" alt="Logo" width="30" height="auto"></a> Decompiler

Java Decompiler Gui

Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

group = "net.pryoscode"
version = "0.1.3"
version = "0.1.4"

kotlin {
jvmToolchain {
Expand Down
16 changes: 15 additions & 1 deletion src/main/kotlin/net/pryoscode/decompiler/window/Window.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
package net.pryoscode.decompiler.window

import com.sun.javafx.tk.Toolkit
import javafx.scene.Scene
import javafx.scene.image.Image
import javafx.scene.input.TransferMode
import javafx.scene.layout.BorderPane
import javafx.scene.text.Font
import javafx.stage.Stage
import net.pryoscode.decompiler.window.code.Container
import net.pryoscode.decompiler.window.sidebar.Sidebar
import java.io.File
import java.util.Base64

class Window(args: Array<String>) : Stage() {

Expand All @@ -29,9 +32,20 @@ class Window(args: Array<String>) : Stage() {
sidebar.open(it.dragboard.files[0])
}

Font.loadFont(javaClass.classLoader.getResourceAsStream("fonts/FiraSans-Regular.ttf"), Toolkit.getToolkit().fontLoader.systemFontSize.toDouble())
Font.loadFont(javaClass.classLoader.getResourceAsStream("fonts/FiraMono-Regular.ttf"), Toolkit.getToolkit().fontLoader.systemFontSize.toDouble())
root.stylesheets.add("data:text/css;base64," + Base64.getEncoder().encodeToString((
"* {" +
"-fx-font-family: 'Fira Sans';" +
"}" +
".code-area * {" +
"-fx-font-family: 'Fira Mono';" +
"}"
).toByteArray()))

title = "Decompiler v" + javaClass.`package`.specificationVersion
scene = Scene(root, 896.0, 560.0)
icons.add(Image(javaClass.classLoader.getResourceAsStream("logo.png")))
icons.add(Image(javaClass.classLoader.getResourceAsStream("icons/logo.png")))
show()

if (args.isNotEmpty())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ enum class Type(icon: String) {
CLASS("class.png"),
FILE("file.png");

val icon = Image(javaClass.classLoader.getResourceAsStream(icon))
val icon = Image(javaClass.classLoader.getResourceAsStream("icons/$icon"))

}
Binary file added src/main/resources/fonts/FiraMono-Regular.ttf
Binary file not shown.
Binary file added src/main/resources/fonts/FiraSans-Regular.ttf
Binary file not shown.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Binary file modified src/main/resources/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 3a71446

Please sign in to comment.