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

Linebreaking #76

Open
wants to merge 43 commits into
base: master
Choose a base branch
from
Open

Linebreaking #76

wants to merge 43 commits into from

Conversation

khaledhosny
Copy link
Collaborator

No description provided.

@khaledhosny
Copy link
Collaborator Author

@brawer Can you test this, it should be more stable now. One important change in the client code is to use raqm_glyph_t.x and raqm_glyph_t.y which provide absolute glyph positions instead of calculating them from glyph advances and offsets.

@khaledhosny khaledhosny force-pushed the linebreaking branch 21 times, most recently from 9054ec3 to 67e38f5 Compare April 16, 2017 03:51
Only glyph advance affects line width.
The ascender and descender members of FT_Face are in font units, but we
want then in pixel size. Also, the first should be moved down by the ascender.
Should not enter into infinite loops now.
Our own implementation is based on:
http://unicode.org/Public/PROGRAMS/LineBreakSampleCpp/

Which right there it says this is outdated and does not support the
algorithm after Unicode 5.2. Further more the code was even more broken
as there is mismatch between the number of break classes supported by
UCDN abd that outdated code, which was resulting in out of bounds array
access, fun!
@khaledhosny khaledhosny force-pushed the linebreaking branch 2 times, most recently from 6ec5086 to d2efc62 Compare February 10, 2018 14:43
Testing absolute positions seems to be sensitive to FreeType version.
@molikto
Copy link

molikto commented Mar 27, 2018

What's needed to make this into master? Also I think it should be easy to add different font size settings for each glyph? I might do this...

After more thought, layout is very application dependent, so even if this is merged, one might not able to use it directly without modification.

@houqp
Copy link

houqp commented Apr 27, 2019

After more thought, layout is very application dependent, so even if this is merged, one might not able to use it directly without modification.

@molikto could you give an example on why extra application logic is needed to determine the line breaks?

@Benau
Copy link

Benau commented May 29, 2019

Hello,
I plan to use this for supertuxkart for proper unicode line breaking + emoji support, any chance will this be merged soon (or is there something I can help?)

@Benau
Copy link

Benau commented Jun 2, 2019

seems that it is better to do in stk level anyway...

btw is there some way to tell inside a glyph there is character in cluster breakable? For example "ff" or "fl"

@khaledhosny
Copy link
Collaborator Author

No

Hello,
I plan to use this for supertuxkart for proper unicode line breaking + emoji support, any chance will this be merged soon (or is there something I can help?)

No one is currently working on this code and it isn’t very well tested either.

@khaledhosny
Copy link
Collaborator Author

btw is there some way to tell inside a glyph there is character in cluster breakable? For example "ff" or "fl"

Not sure I get the question, can you elaborate on what you are trying to do.

@Benau
Copy link

Benau commented Jun 2, 2019

sorry bad english, i was trying for "cursor movement" in editbox, for example if i press left button around the "fi" glyph, is there some way to tell it should stop between f and i in the glyph? Because we are using old editbox in stk which has no text shaping (it assumes 1 word per glyph)

@Benau
Copy link

Benau commented Jun 2, 2019

also because i need to take emoji glyph into account(which i think it should be taken as 1 word, for example 2 letter country flag)

@adrientetar
Copy link

You can use harfbuzz cluster value for that purpose https://harfbuzz.github.io/clusters.html#clusters-and-shaping

@khaledhosny
Copy link
Collaborator Author

For drawing the cursor, you can use raqm_index_to_position(). For getting the character index at a given position, you can use raqm_position_to_index().

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

Successfully merging this pull request may close these issues.

8 participants