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

[Question] Layout Fails for Plain ASCII Text #99

Open
cybel opened this issue Jan 16, 2019 · 7 comments
Open

[Question] Layout Fails for Plain ASCII Text #99

cybel opened this issue Jan 16, 2019 · 7 comments
Labels

Comments

@cybel
Copy link

cybel commented Jan 16, 2019

So far, I've followed the mini-tutorial in the documentation and hit all the key functions it calls in the same order. The problem seems to be when raqm_layout is called, it gets to this line: if (!rq->text_info[i].ftface) (raqm.c:851) and bails.

As far as I can tell, the font I'm loading up and passing in is completely valid. I'm not sure if I'm doing something wrong or what. Any insight that I can chase would be greatly appreciated.

@khaledhosny
Copy link
Collaborator

Can you post the relevant code here?

@cybel
Copy link
Author

cybel commented Jan 16, 2019

Thanks for the incredibly speedy in replying.

Here's a gist with the relevant code https://gist.github.com/cybel/b8b394d0b6b7ccb36e7a07efa89a2e2f

Here's a rundown of how it all works:
C() is the constructor. During that call, raqm_set_par_direction is called first, the language is set to English. The final call is to face(const FT_Font*) which sets the font. During this call, updateFace() and updateTexture() are called. updateFace() calls FT_Set_Pixel_Sizes and raqm_set_freetype_face. Finally, updateTexture() sets the text raqm_set_text_utf8 and does the layout raqm_layout.

Hopefully my unusual style won't cause you much grief, but don't hesitate to ask for any other information you need.

@khaledhosny
Copy link
Collaborator

You need to call raqm_set_text_utf8() before raqm_set_freetype_face(). That is an undocumented limitation, and I think we should fix it.

@cybel
Copy link
Author

cybel commented Jan 16, 2019

That solved it! You're a scholar and a gentleman. Thanks!

@khaledhosny
Copy link
Collaborator

You are welcomed! I’m keeping this issue open as a reminder to fix this limitation.

@niello
Copy link
Contributor

niello commented Jan 26, 2022

You can simply return false if raqm_set_freetype_face* is called with rq->text_len being 0. Otherwise this would require a temporary variable that keeps the value until there is a text to use it. And this behaviour will not be consistent with raqm_set_freetype_face_range because calling this before the text would require to allocate text_info before text, messing up the logic.

@khaledhosny
Copy link
Collaborator

Makes sense. The documentation still needs to make this ordering requirement explicit.

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

No branches or pull requests

3 participants