-
-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom fonts in a jar #152
Comments
Hmm... I tracked it down to this if statement breaking the chain:
It gets an url in an absolute format: Is there something we could maybe change in this code or am I totally off? I'm not familiar with Java. I manually inspected the .jar file and the fonts folder is at the specified path |
Yeah it should be possible to add support for reading from an input stream, however that part of the code only deals with reading the filenames. Also need to track down places where the content gets read when the font is used. I'll try take a look when I get a chance, but if you're feeling brave in the meantime I can help with a PR as well. |
Sure, if you've got patience for it then I'm happy to give it a try. I'll dig deeper tomorrow. Thanks edit: I've been busy today, I might get to it closer to the weekend. |
sounds like a plan |
I think I may have misdiagnosed the problem from the beginning. (g2d/g2d-register-fonts [[(-> "fonts/" io/resource .getPath) false]])
;; later when generating the pdf
[:graphics {:under true :translate [0 200]}
(fn [g2d]
(doto g2d
(.setFont (java.awt.Font. "Strato" java.awt.Font/PLAIN 20))
(.drawString "Testing Graphics" 20 160)))] And it worked with As for other elements, ie: When you run the test project I also print |
Ah so that's mostly good news then if it's a problem specific to the graphics element. The
|
Yeah, I've came up with similar code:
But using it by name, later on, doesn't seem to be working. But I think we are getting closer. It's late in my timezone so I'll continue investigating tomorrow. |
Ok, I feel like this is above me. I've tried a lot of things, I see fonts registered but have no idea how to use them without calling the |
I can't really think of much else that you could do here unfortunately. |
I'm trying to load custom fonts while running my project as packaged jar:
That doesn't seem to be working (probably cause fonts are bytestreams now?).
Does
clj-pdf
currently supports this (without creating temp dirs to give it an actual file or something like that?)The text was updated successfully, but these errors were encountered: