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

Added the ability to go between a string offset and render position. #391

Merged
merged 2 commits into from
Oct 3, 2024

Conversation

slouken
Copy link
Collaborator

@slouken slouken commented Oct 3, 2024

This allows things like implementing a cursor that automatically follows font size and text direction changes.

@1bsyl
Copy link
Contributor

1bsyl commented Oct 3, 2024

@slouken since you're in a middle of modification, there are a few shadow variables:

showfont.c:457:33: warning: declaration of ‘outline’ shadows a previous local [-Wshadow]
457 | int outline = TTF_GetFontOutline(font);
| ^~~~~~~
/showfont.c:128:9: note: shadowed declaration is here
128 | int outline;
| ^~~~~~~
showfont.c:501:35: warning: declaration of ‘ptsize’ shadows a previous local [-Wshadow]
501 | float ptsize = TTF_GetFontSize(font);
| ^~~~~~
showfont.c:118:11: note: shadowed declaration is here
118 | float ptsize;
| ^~~~~~
showfont.c:508:35: warning: declaration of ‘ptsize’ shadows a previous local [-Wshadow]
508 | float ptsize = TTF_GetFontSize(font);
| ^~~~~~
showfont.c:118:11: note: shadowed declaration is here
118 | float ptsize;

This allows things like implementing a cursor that automatically follows font size and text direction changes.
@slouken slouken marked this pull request as ready for review October 3, 2024 16:09
@slouken slouken merged commit 426cd5e into libsdl-org:main Oct 3, 2024
5 checks passed
@slouken slouken deleted the measure-engine branch October 3, 2024 16:12
@sezero
Copy link
Contributor

sezero commented Oct 3, 2024

This breaks build if harfbuzz is disabled:

src/SDL_ttf.c: In function ‘TTF_OpenFontWithProperties’:
src/SDL_ttf.c:1922: error: ‘TTF_Font’ has no member named ‘hb_direction’
src/SDL_ttf.c:1922: error: ‘HB_DIRECTION_LTR’ undeclared (first use in this function)
src/SDL_ttf.c:1922: error: (Each undeclared identifier is reported only once
src/SDL_ttf.c:1922: error: for each function it appears in.)
src/SDL_ttf.c:1923: error: ‘TTF_Font’ has no member named ‘hb_script’
src/SDL_ttf.c:1923: error: ‘HB_SCRIPT_UNKNOWN’ undeclared (first use in this function)

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.

3 participants