-
Notifications
You must be signed in to change notification settings - Fork 344
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
[Core] Provide information about source string to Clay_MeasureText #180
Comments
Hello 👋 |
I'm imagining something like Clay_Dimensions Clay_MeasureText(Clay_String toMeasure, Clay_String originalString, Clay_TextElementConfig *config) {
int32_t startIndex = toMeasure.chars - originalString.chars;
int32_t endIndex = startIndex + toMeasure.length;
} |
Thank you, I think pointer arithmetic should work. |
@Riquelme02 I will investigate providing that information in the render command as well 👍 |
Hello Nic,
I've been playing with Clay for a few weeks
now after a friend recommended it to me.
Unfortunately I've hit a brick wall when it comes to string handling when
I tried integrating it into an existing project. We handle text by shaping
our paragraphs with HarfBuzz and caching the result, which is an array of
glyph information - all further text operations work by specifying start
and end indices into that array. Meanwhile Clay can only give us raw strings
and no realistic method to extract the necessary indices from them.
To summarize: Clay provides a string slice, and what we
need is actually the start and end indices of that slice.
(we also need the entire original string, although this part I could easily
solve by passing around a handle to our cache through the element config).
Can you think of a feasible solution on Clay's side? I would love to
use this library without maintaing a local copy that does what I need.
The text was updated successfully, but these errors were encountered: