We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 264

Summary: Adjust rendered surface width, add an "SDL_PixelFormat *format" parameter.
Product: SDL_ttf Reporter: Samuel Mimram <smimram>
Component: miscAssignee: Sam Lantinga <slouken>
Status: RESOLVED WONTFIX QA Contact: Sam Lantinga <slouken>
Severity: enhancement    
Priority: P2    
Version: unspecified   
Hardware: All   
OS: All   
URL: http://bugs.debian.org/206057

Description Samuel Mimram 2006-06-25 17:40:11 UTC
Dear Developers!

Sometimes the "something" text is as wide as "somethingi". I wrote a line editor
for SDL, and it is a problem for me to determine the cursor position in pixels.
(I cannot say precisely the with of the text on the cursor's left side)
My wish is that the rendered surface be _exactly_ as wide as the rendered text.

The second is that TTF_RenderText_Shaded() and TTF_RenderText_Solid() should have an "SDL_PixelFormat *format" parameter, so the newly generated surface would fit in the application instantly without any additional blitting.

I know it is not christmas so my third wish is very very optional. Make a
function with the name of TTF_RenderText_AlphaShaded(). It would be a mix of the
...Solid and the ...Shaded. The RGB channels would be filled with the ...Solid
algorythm and the Alpha channel would be filled with the ...Shaded algorythm. The result would be instant for blitting onto the screen. (The surface would be
always 32bit and the untouched areas of the surface would be transparent black)

Thanks for the TTF library! You saved my life ;-)
Thanks for reading my wishes!
I hope you will find useful the above.


More infos on the Debian bug report can be found at :
http://bugs.debian.org/206057
Comment 1 Nicos 2006-06-30 04:33:35 UTC
A workaround: scan the resulting surface from left and from the right and find the x for the first non non-transparent pixel for each side. Subtracting those values from the width will give you the "true" width.