ftomassetti / kanvas

A truly hackable editor: simple, lightweight, understandable

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

kanvas.kt fails to instantiate

cliserkad opened this issue · comments

I'm currently writing my own language and found your tutorial and code for making an editor. I followed the reference implementation of python when writing my code, as I don't code in kotlin.

Here is the repo that contains the editor
https://github.com/cliserkad/kdl-editor

I use maven to import this repo and another of my own which contains my language. When trying to run the Editor.kt file in IntelliJ, I encounter a runtime error. Here is the stack trace:

Exception in thread "main" java.io.IOException: Problem reading font data.
	at java.desktop/java.awt.Font.createFont0(Font.java:1177)
	at java.desktop/java.awt.Font.createFont(Font.java:1046)
	at me.tomassetti.kanvas.Kanvas.<init>(kanvas.kt:320)
	at com.xarql.kdl_editor.EditorKt.main(Editor.kt:13)

I looked at the source code for kanvas.kt to see if the problem was related to a default constructor, but it isn't. The value being set isn't in any constructor because it is a constant. I think I could catch the exception and create the font in my code, then pass the font to kanvas's constructor, but then this would still be broken. I checked the .jar that maven downloaded, and it does indeed contain the .ttf file for the font.

I think the underlying issue is that the wrong file is being selected somehow, but I'm unsure. The .ttf file is not corrupt.