SDL_ttf bug with the letter j

Hello, I’m having a problem with the SDL_ttf library
(2.0.5) with the letter j (lowercase). I’m getting a
weird artifact on the texture which appears on the
right side of the texture. The problem varies
depending on the point size and location of the j.
However, it usually shows up at larger point sizes and
when j is in front of the string. And the problem is
always reproducable once you find the settings. And I
have verified this on two totally different computers.

I have included two sample screenshots of the problem
running different font types (arial and times). The
artifact almost looks like a comma. I was running an
unmodified version of “showfont” which is the demo
that comes with the library. (I also get this behavior
with glfont.) I specified 60 point for this screen
capture and used the strings “j” and “join”.

So far, I have only found the problem with the
lowercase j.

This is a particular problem for me because I have
written an OpenGL routine ontop of SDL_ttf that loads
each letter individually into its own texture and
display list so I can do stuff similar to the example
in the OpenGL Programming Guide. So I get this problem
almost everytime I use the letter j.

Can somebody tell me what’s causing this and how I can
fix this?

Also, is there a way I can coerce the SDL_ttf to load
bitmap fonts in .FON format as well as .TTF? I noticed
that the library can actually load the .FON files, but
quits once it realizes the fonts aren’t vectors
(scalable).

Thanks,
Eric__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better


-------------- next part --------------
A non-text attachment was scrubbed…
Name: j_arial.jpg
Type: image/pjpeg
Size: 17081 bytes
Desc: j_arial.jpg
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20020730/dbecf290/attachment.bin
-------------- next part --------------
A non-text attachment was scrubbed…
Name: j_times.jpg
Type: image/pjpeg
Size: 21666 bytes
Desc: j_times.jpg
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20020730/dbecf290/attachment-0001.bin

If you look at your image closely, you’ll realize that the artifact is
the left few pixels of the j, cut off and one line higher.

Apparently, when it’s at the front of the string, the x coordinate of
the pixels is going negative and wrapping to the right side one line
higher.

I have no idea WHY this is happening, as I don’t use SDL_ttf. It could
be your code, it could be code in the library. Does SDL_ttf specify
the draw routines, or do you? If you do, then it could easily be your
code dealing improperly with negative coordinates.

You might look for similar behavior in uppercase V, lowercase y, and
italic fonts.

 Kent

Tuesday, July 30, 2002, 12:35:26 AM, you wrote:> Hello, I’m having a problem with the SDL_ttf library

(2.0.5) with the letter j (lowercase). I’m getting a
weird artifact on the texture which appears on the
right side of the texture. The problem varies
depending on the point size and location of the j.
However, it usually shows up at larger point sizes and
when j is in front of the string. And the problem is
always reproducable once you find the settings. And I
have verified this on two totally different computers.

I have included two sample screenshots of the problem
running different font types (arial and times). The
artifact almost looks like a comma. I was running an
unmodified version of “showfont” which is the demo
that comes with the library. (I also get this behavior
with glfont.) I specified 60 point for this screen
capture and used the strings “j” and “join”.

So far, I have only found the problem with the
lowercase j.

This is a particular problem for me because I have
written an OpenGL routine ontop of SDL_ttf that loads
each letter individually into its own texture and
display list so I can do stuff similar to the example
in the OpenGL Programming Guide. So I get this problem
almost everytime I use the letter j.

Can somebody tell me what’s causing this and how I can
fix this?

Also, is there a way I can coerce the SDL_ttf to load
bitmap fonts in .FON format as well as .TTF? I noticed
that the library can actually load the .FON files, but
quits once it realizes the fonts aren’t vectors
(scalable).

Thanks,
Eric


Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com


Kent Quirk, CTO, CogniToy
@Kent_Quirk
http://www.cognitoy.com

The screenshots were right from the official demos
that come with the SDL_ttf library. I didn’t modify
them in anyway. My impression is that the problem in
in the library itself because the library creates and
returns the SDL_Surface.

So far I have been unable to create similar effects
with other letters (and type settings). It seems to be
restricted to the letter j.

Thanks,
Eric

— Kent Quirk <kent_quirk at cognitoy.com> wrote:> If you look at your image closely, you’ll realize

that the artifact is
the left few pixels of the j, cut off and one line
higher.

Apparently, when it’s at the front of the string,
the x coordinate of
the pixels is going negative and wrapping to the
right side one line
higher.

I have no idea WHY this is happening, as I don’t use
SDL_ttf. It could
be your code, it could be code in the library. Does
SDL_ttf specify
the draw routines, or do you? If you do, then it
could easily be your
code dealing improperly with negative coordinates.

You might look for similar behavior in uppercase V,
lowercase y, and
italic fonts.

 Kent

Do You Yahoo!?
Yahoo! Health - Feel better, live better

This is a particular problem for me because I have
written an OpenGL routine ontop of SDL_ttf that loads
each letter individually into its own texture and
display list so I can do stuff similar to the example
in the OpenGL Programming Guide. So I get this problem
almost everytime I use the letter j.

Can somebody tell me what’s causing this and how I can
fix this?

Can you send me a link to the font so that I can check it out?

Also, is there a way I can coerce the SDL_ttf to load
bitmap fonts in .FON format as well as .TTF? I noticed
that the library can actually load the .FON files, but
quits once it realizes the fonts aren’t vectors
(scalable).

I’m not sure, it sounds like you’ll be able to figure it out. :slight_smile:
Is it FreeType that’s aborting the load, or SDL_ttf?

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment

Can you send me a link to the font so that I can
check it out?

I placed a copy of my two fonts on my webserver at
serendipity.stanford.edu/~pinky/temp/Fonts
But these are fonts that came with my standard Windows
distribution.

Also, is there a way I can coerce the SDL_ttf to
load
bitmap fonts in .FON format as well as .TTF? I
noticed
that the library can actually load the .FON files,
but
quits once it realizes the fonts aren’t vectors
(scalable).

I’m not sure, it sounds like you’ll be able to
figure it out. :slight_smile:
Is it FreeType that’s aborting the load, or SDL_ttf?

It’s SDL_ttf that aborts. It would be really nice to
have one standard way of loading fonts (vector or
bitmap) into SDL. Since freetype seems to support both
formats I was hoping somebody had already figured this
out.

Thanks,
Eric__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better