Fork me on GitHub

I’m in the midst of a hackathon type thing, and we’re building a “text-based” adventure game. As in, you text from your cell phone. The trouble is, message length is a bit of a problem, so I want to create images of the text to send vs MMS as opposed to SMS. I’ve messed with Graphics2D, but text layout is a bit of a bummer. I’m looking for something simple that will let me just dump a big string in, and not have to worry about x/y coordinates. I’m imagining something like raw HTML->Image.


not exactly sure what you're looking for, but might help. graphics2d should also be pretty straight forward if you're just trying to create images from text


for example:

(require '[membrane.skia :as skia])
(require '[membrane.ui :as ui])

  "X   X 
  (ui/font "Menlo.ttc" 12))


this assumes mac osx, but I can provide an example for whichever platform you're targetting


Very helpful, thank you


What would be the main difference for Linux? I don’t see anything in your example that makes me think it’s specific to OSX?


Menlo.ttc is a mac os x monospaced font*


that’s kind of what I expected you’d say 🙂


this lib looks pretty cool


otherwise, it should work on linux


windows support is in progress


I’m a fan of lanterna and text-based UIs

🙂 6

i’m looking for feedback, so let me know if you have any suggestions or improvements


Does this exist (freely (I found a paid library/api to do it)), or do you have any other ideas?


So a func defined within let can not refer to itself, one must use letfn?


It can! (fn name? [params*] exprs*) takes an optional name before the params.

👍 6
Chris O’Donnell14:08:27

letfn is necessary when you bind two functions which call each other. (With let, the first function couldn't call the second.)

Michael du Breuil23:08:15

I'm getting errors of "Inconsistent stackmap frames at branch target" which I'm guessing at this point is a compiler bug? I've created a minimal standalone example here (including the error I'm seeing and full edn report): changing line 49 of core.clj to just return a number instead of calling haversine-distance will fix the error


Not sure if it's the cause (not at a computer) but your return type tag is in the wrong spot, it should be before the symbol not before the arg vector:

Michael du Breuil23:08:47

Oh wow, absolutely correct, and resolves it. What's horrifying is I got that hint wrong 4 years ago, and everything else has been fine with it....

Michael du Breuil23:08:35

@U5RCSJ6BB Thanks! Feeling foolish at the moment 🙂


np! Probably is related to a clojure or java upgrade and some transitive behaviors in conjunction with a long standing bad tag

Michael du Breuil23:08:21

Wait, actually I'm not sure I'm wrong there. All my type hints are done that way, and that's actually how the docs say to do it...

Michael du Breuil23:08:27

I do accept that it's a type hinting bug though


Wow, so they do. I certainly always have put them before the var symbol. I will need to look more closely


based on that discussion, moving the ^double hint to the symbol means its no longer a proper primitive hint, which means the hint no longer does anything useful, but in this case it also prevents the code path that has the compiler bug

Alex Miller (Clojure team)03:08:19

agreed that the type hint was at the right spot originally

Alex Miller (Clojure team)03:08:43

can you post this to - that will get it into my queue to make it a bug

Michael du Breuil04:08:45

@U064X3EF3 I'll be out of town till Tuesday, but I'll post it there once I'm back, thanks!

Michael du Breuil16:08:00

@U064X3EF3 posted, thanks again for your time.