bodge-nuklear icon indicating copy to clipboard operation
bodge-nuklear copied to clipboard

nk_text_calculate_text_bounds is not available

Open WarrenWilkinson opened this issue 5 years ago • 3 comments

Hi, I've been making good progress using your nuklear library, but I noticed the utility method nk_text_calculate_text_bounds is not currently exported. It also doesn't seem to be in your blob:

nm -g x86_64/libnuklear.so.bodged | grep calculate

(no results).

It's not mentioned in the src/spec/* files either and I'm not sure how those are populated.

Would it be possible to add this utility? It's very nice for computing how much space a string of text will take on screen.

WarrenWilkinson avatar Aug 31 '20 21:08 WarrenWilkinson

It is probably in a newer version of Nuklear than the wrapped one. If you are using nanovg-based renderer, there's a function there to calculate text bounds. If you are using native Nuklear renderer, well, you are out of luck for a while.

I'm heavily focusing on :claw revamp (which this project also uses) atm, and gonna regenerate bindings at some point but not in the nearest future. I can bump nuklear version then. We can leave this issue open so I won't forget to do so.

borodust avatar Aug 31 '20 22:08 borodust

No worries, In my case I can just multiply the number of characters by 7.0f0 and it works well enough. The function does seem to be in the version of nuklear.h that your reference as a git submodule though.

Your proposal sounds fine to me.

WarrenWilkinson avatar Aug 31 '20 22:08 WarrenWilkinson

Hmm, in that case, i guess you are not using latest version then. You can get latest version from bodge testing dist:

(ql-dist:install-dist "http://bodge.borodust.org/dist/org.borodust.bodge.testing.txt")
(ql:update-all-dists)

Unfortunately, looks like this function ain't wrapped anyway, but at least it's mentioned in the blob.

borodust avatar Aug 31 '20 22:08 borodust