freeglut's glutStrokeString giving a "stroke font not found error" - opengl

I am trying to use glutStrokeString using freeglut.
The program runs fine up to the point it has to call glutStrokeString, then it outputs the console freeglut stroke font not found.
Any idea why?

GLUT_BITMAP_HELVETICA_18, as the name suggests, is a bitmap font. You can't use them with the Stroke rendering commands. So if you want to use that font, you have to use glutBitmapString.
FreeGLUT comes with two stroke fonts: GLUT_STROKE_ROMAN and GLUT_STROKE_MONO_ROMAN. So if you want to use the stroke commands to render the fonts, you have to use one of those kinds of fonts.

Just check out the file, gluit/freeglut_font.c, in your glut source code, contains everything you need to know, Also check fghFontByID() and fghStrokeByID() which are actually used to computed the font id for both the functions that is glutBitmapString() & glutStrokeString()
or check out this

Related

SFML 1.6 - Blured text [duplicate]

I'm using SFML 1.6 to make a small game, and I need to display some text, so I use the sf::String class. The problem is, when I increase the size to 96pt, the edges appear a little blurry. When I increase the size of text in Microsoft Word though, it appears very clean and has crisp edges. Is there a way to do that with SFML?
Looking at the SFML sources, it appears that it is using the embedded Arial font. Yes, it can also load the .ttf font file, but I guess you didn't load it yet.
So the problem is tht SFML tries to scale the fixed-size bitmap when you are rendering the text.
To get rid of the aliasing try following this sample http://www.sfml-dev.org/tutorials/1.4/graphics-fonts.php and load the .ttf manually.

Decoding Microsoft True Type Font Files

I am working on an embedded platform (STM32F407) with a TFT LCD as a display (480x800px) and would like to make my user interface somewhat customizable to the end user. I figured the best source of fonts would be windows compatible as their the most common.
My current implementation uses my own custom drawn font in a binary format and a descriptor table giving the character width and ascii value but having to draw my own font bit by bit is tedious.
I would like to read in a True Type Font file from an SD card and be able to use the different sized glyphs inside it but I have not seen a strait forward implementation on how to actually achieve this magic. Can somebody point me to a good c/c++ example of what I am looking for?
Even better as a way to iron out the kinks I would like to make a simple gcc command line program that will print out my input with a selected font using '#' as pixels. That way I can just worry about implementation and not any other random bugs that might pop up.
Can anybody help me out?
Perhaps you can use the Freetype library.
As duskwuff says: TTF is primarily a vector format, would need to write a renderer. Better off using an image file to define the font, or using a bitmap font format like FNT (Windows) or BDF (UNIX).
Here is my answer to my own question: AngelCode's BMFont & Useage. This makes choosing selective characters from the installed char set, mix in a font and exports an image with a map file to each character. Simple to use.

Large text appears blurry

I'm using SFML 1.6 to make a small game, and I need to display some text, so I use the sf::String class. The problem is, when I increase the size to 96pt, the edges appear a little blurry. When I increase the size of text in Microsoft Word though, it appears very clean and has crisp edges. Is there a way to do that with SFML?
Looking at the SFML sources, it appears that it is using the embedded Arial font. Yes, it can also load the .ttf font file, but I guess you didn't load it yet.
So the problem is tht SFML tries to scale the fixed-size bitmap when you are rendering the text.
To get rid of the aliasing try following this sample http://www.sfml-dev.org/tutorials/1.4/graphics-fonts.php and load the .ttf manually.

Why does creating a Font based on a nonexistent FontFamily work?

I am drawing some text with Gdi+ and I'm trying to make sure the Font I create actually exists. I noticed that it was working no matter what font I specified. I have the following code:
Font font(TEXT("SomeGibberishFOEIHSFUE"), 12, 0, UnitPoint);
if (!font.IsAvailable())
exit(0);
// draw text
I have no font installed on my system called SomeGibberishFOEIHSFUE, but IsAvailable returns TRUE and the program runs and draws the text with a font that looks like Arial instead of exiting. Why is this?
If I am using IsAvailable wrong, what function should I use to tell whether the creation of a Font succeeded or not? I have also tried GetLastStatus which returns Ok.
That's the Windows font mapper at work, it will always find a substitute font if it cannot supply the requested one. Falling back to the default GUI font if necessary. You could use the FontFamily class instead. The .NET version of it (looks like you're using it) will throw an ArgumentException when you use its constructor and pass a non-existing font. The native GDI+ version of it has an IsAvailable() method. Yes, kinda screwy behavior but that's not unusual in GDI+.

SDL changing cursor to Windows default

I'm making a simple windowed game and I want a standard system cursor instead of SDL's black one. Is this possible without manual creation of cursor?
This is not possible as far as I know. Because SDL works on all major platforms, even those without default cursors, SDL creators decided to always use a custom cursor. Drawing the default system cursor shouldn't be that hard though - just load the .cur file and paint it as a bitmap.
It is possible for you to to display 4 types of default SDL cursors with the help of SDL_CreateCursor. The SDL documentation provides this information:
http://www.libsdl.org/cgi/docwiki.cgi/SDL_CreateCursor