Skip to content
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

Support for custom glyph ranges #74

Open
seb321 opened this issue Feb 3, 2021 · 1 comment
Open

Support for custom glyph ranges #74

seb321 opened this issue Feb 3, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@seb321
Copy link

seb321 commented Feb 3, 2021

Per request I'm opening a new issue on this.

Font loading procedures take ranges of glyphs to load. The problem is that the API does not provide a way to instantiate them, so only default options (getGlyphRangesFor*()) are available. This is not sufficient, as this does not include all glyphs one might want to display.

@ice1000 In the comment you said, that

It is, but I haven't yet adapted the API for custom ranges. It's hard in general -- imagine you passes a two-dim array from Java to C++. There are some design choices to be made.

I am new to Dear ImGui, so I have no experience with its API, but glyph ranges does not seem to be used in many places. In c++ the procedures take a flat zero-terminated array of integers.
I am not the right person to decide, how you should shape your API, but I do not think that passing two-dimensional array is a way — arrays in Java have dynamic length, so using them does not add any safety in this case. You could still pass an array with incorrect size.

If you want types to be safe, I think a class representing a range would be better. However, more general solution would be to just provide a way to instantiate an array of integers compatible with the c++ code, so it can be passed to it directly. I suspect that it would be simpler to implement and could be used also in other places if needed.

I do not know how Java calls c++ code, but it is supported, so I suspect that passing values to it is not so hard that it is a real problem.

@ice1000
Copy link
Owner

ice1000 commented Feb 3, 2021

Oh, so the C++ API is one-dimensional. It will be unsafe anyway, so I'll assume the users know the contract. I can add the API if it's one dimensional. Thanks for telling me that.

@ice1000 ice1000 added the enhancement New feature or request label Feb 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants