Fork me on GitHub
#clojure
<
2018-12-31
>
markw02:12:11

anybody used lanterna? I cannot for the life of me figure out how to simply get a newline to display

emccue05:12:00

I'm looking at laterna now and I'm not quite sure

emccue05:12:35

Maybe something about the way it displays characters in cells means that a new line wont implicitly move to a cell below?

kwladyka14:12:37

I need to convert file to PDF, but: - things have to be precise to each mm - input file has to be in format easy to edit by user, PhotoShop, some kind of drawing in web browser, maybe even XML - if font is too big to fit text into space it needs to decrease font I don’t any good solution to do it. Generating PDF is a nightmare. * Unless I want to pay a lot for some extra payment SaaS or libraries

kulminaator17:12:52

imho it's always a nightmare, even with paid add ons

😱 4
kwladyka19:12:22

What is the best way in your opinion to convert input (file, XML, etc.) to PDF with precision to 1 mm?

kwladyka14:12:40

But idea is to make a product from it, so I don’t want to stick with any sick high price licence

Chris16:12:04

Depending on how you want to deliver this to users, the cheap-and-cheerful option is to make a printer-friendly HTML page and let users print to PDF (or paper) themselves

kwladyka19:12:38

I don’t know any way to do it with precision to each 1 mm

kwladyka19:12:03

Only with Java and even then it is super hard. But with Java code users can’ really give an input as a file

kwladyka15:12:34

especially for label printers

andy.fingerhut17:12:59

In what way can something be precise to each mm, but also auto-adjust text size? I don't understand how those two desires can be satisfied at the same time.

deep-symmetry18:12:20

I feel like I must be missing something… why is it that when I call keys on a sorted-map, I don’t get a sorted collection? I am trying to implement a simple interval tree, and this gap is a sticking point.

hiredman18:12:00

what do you mean by a sorted collection?

hiredman18:12:58

if you mean a seq of the keys in order, I am not sure, but I would be surprised if that is not what you get, so I wonder what makes you think that is not what you are getting

hiredman18:12:11

user=> 
(let [x (shuffle (range 32))]
  (= (sort x)
     (keys (into (sorted-map) (zipmap x x)))))
true
user=> 

emccue18:12:44

maybe postscript would be helpful?

emccue19:12:06

in general what you want to do might be a headache and a half, but it might be possible to hack together something specific

emccue19:12:36

Like, a brute force way might be (if you are printing only one line on a label) to pick a font size based on a heuristic (12, lets say) and then render a pdf. Run an image of that pdf through handwriting recognition software and see if it reads it correctly

emccue19:12:10

then just find the largest font size on which you can read everything

emccue19:12:49

and if there is none then you can send a message back to your users that there is no way for you to do it

emccue19:12:21

as an upside you can throw "uses machine learning" on whatever your product is

emccue19:12:29

as a downside there is everything else

deep-symmetry20:12:35

@hiredman I mean something that implements clojure.lang.Sorted so you can use subseq on it.

deep-symmetry20:12:57

They do come back in the expected order, but not implementing the right interfaces to take full advantage of that.

deep-symmetry20:12:40

Ah, but it turns out the map itself does implement sorted, so I can use subseq directly on that, which addresses my efficient interval matching quite effectively.

deep-symmetry20:12:21

That’s what I was missing. ^_^