-
-
Notifications
You must be signed in to change notification settings - Fork 645
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
Request: Make opaque structures in STB read-accessible #358
Comments
LWJGL does not expose internal state that is not part of the public API, unless it's useful somehow. Sounds like you can do something interesting with In the meantime, you could easily access its members with int width = memGetInt(ctx.address() + 2 * POINTER_SIZE); |
Thank you for the tip with the MemoryUtil. I've spent some time going over the whole thing again before digging into it and I realized that there is a similar stumbling stone with As the intializing of the below is the code of the original method and markers to where you can add additional glyphs and stuff with the least effort, for anyone interested/doing the same and struggling as well (//> comments):
|
In the next snapshot, structs Thanks! |
Hey @Spasi , thank you for your help in this! After playing around with the code I managed to do what I want by abusing the nature of Unicode Codepoints instead, allowing me to not having to rewrite any-much logic at all which was very nice. Right now though I am working on making the packer render SDF-bitmaps instead of regular ones into the eventual texture. For that I need to replace Currently I reproduce the above mentioned method to make sure it works properly and thus need read access to the Cheers |
Should probably just have written that there are some members on that struct that are not public visible yet ( |
I know these are no public API functions, but when modifying the behaviour on the java side access to the |
Done.
That's a ton of internal, mostly simple, functions. I would consider exposing a subset of those, if you could post a list of functions that you think would be useful and are not trivial to port to Java. |
I'll spend more time with the code and assemble a list of functions necessary to easily expand the API |
LWJGL tries to represent structs used in the STB bindings, e.g.
stbtt_pack_context
with classes. It does a good job at this, but while some of them can be properly accessed with read/write operations, those that are marked in the stb sources as opaque have no accessors.The example making me request this feature is the struct already linked above. The comments in the original sources read:
While it makes sense to prevent write-access to prevent messing, there is no good reason to prevent read-access. In fact right now it is counter-productive for me.
I am trying to play around with the packing to, i.a., pack the .notdef character commonly found in most true-type-fonts into the texture that is created with
stbtt_PackFontRange(s)
, to do that I am currently playing around with recreating said method and methods it calls as this is not really a representation of unicode characters.Maybe I am doing too much work and I could achieve it another way, but I don't think so, and it's difficult to work with the whole thing in the first place as the LWJGL bindings are only wrappers of the underlying c libraries.
The text was updated successfully, but these errors were encountered: