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

Wrapped Text is forced to be left aligned #47

Open
Emersont1 opened this issue May 9, 2020 · 4 comments
Open

Wrapped Text is forced to be left aligned #47

Emersont1 opened this issue May 9, 2020 · 4 comments

Comments

@Emersont1
Copy link
Contributor

Code:

auto title_l = KW_CreateLabel(gui, frame,"Text Wrapping in Scrollbox\n(Horizontal Bar Disabled)", &r);
//KW_LabelEnableWrap(title_l);
KW_SetLabelAlignment(title_l, KW_LABEL_ALIGN_RIGHT, 0, KW_LABEL_ALIGN_MIDDLE, 0);

No wrapping, but centered

image

when I uncomment the LabelEnableWrap( line:

image

The same occurs when it is set to right aligned

I'm logging this, if i have time after the checkboxes and radio buttons I'm working on, I'll work on a drop in replacement for the SDL_TTF rendering function, but this may take time

@mobius3
Copy link
Owner

mobius3 commented May 9, 2020

What are you planning on replacing SDL_TTF with? Replacing SDL_ttf is in my plans as well, right now I'm working on a font cooking library, it's just not public yet, that I plan to use for KiWi 1.0 and other projects.

@Emersont1
Copy link
Contributor Author

Emersont1 commented May 9, 2020

I'm thinking using something like freetype, and iirc the ICU library has functionality for wrapping text

Edit: STB has a TrueType loading library too, that might be relatively easy to work with

@mobius3
Copy link
Owner

mobius3 commented May 9, 2020

Yeah, this new library of mine is a wrapper around stb_truetype (which wasn't a lot easy to work with, to be honest). It already correctly produces the glyph atlas but I'm still dealing with some kerning issues. I hope to publish it by this week but replacing KiWi's text rendering with it (or any other library) might be a little daunting. I'm not hoping to do it for the master branch but rather to the development branch (which is going to be 1.0), since there will be more liberty to redefine the API as needed.

As for the issue at hand, I'm not sure of what to do - maybe fixing SDL's wrapping is a better idea, for the time being. Until then or until kiwi text rendering is replace, I think documenting at as a library caveat is proper, unless you absolutely need center/aligned wrapped text.

@Emersont1
Copy link
Contributor Author

at present, i don't, but there probably will be issues when it comes to LTR languages (like Arabic, hebrew) so it ought to be fixed eventually. I think it just needs documenting for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants