james_lohr's picture

QuickFont

I'd just like to announce the release of QuickFont, a text printing and font generation library: http://www.opentk.com/project/QuickFont

I could only upload 4 images on the project page, so I've uploaded the remaining screenshots here.

Enjoy. :)

James L.

Images

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
james_lohr's picture

>>If the shadow is disabled, with a breakpoint in the method to render glyphs, the rendering is called twice.

I've tested this and I'm definitely only getting 1 pass when shadows are disabled. I've also looked at my code, and it seems very unlikely that there could be two passes with shadows disabled. Could you perhaps provide the minimum code to recreate it?

richardjmoss's picture

Excellent, thanks for this - this will replace my own shoddy and dysfunctional text rendering without a second thought!

Emzee's picture

Hiya, I'm just getting into OpenTK and QuickFont looks like a welcome and useful addition. Two comments based on my experiences:

(1) Consider a more canonical namespace than just "QuickFont", such as "OpenTK.Library.QuickFont" or eve "JamesLohr.OpenTK.QuickFont"?

(2) There's about 5 references making use of Linq that are easily replaced by common .NET 2.0 syntax. Why not get Linq right out of there?

Great work, and, Thanks!

yehiyam's picture

Hi
I'm looking into using QuickFont in my project.
Looking at the code I couldn't find if you have written support for right-to-left strings.
Is it something that you plan on adding in the future?

thanks
Yehiyam

Fidchells_eye's picture

The text is appearing mirrored, without moving the camera,
How do I fix this?

Signed Fidchells_eye

OpenNB's picture

I'm trying to use QuickFont with the .net OpenTK GLControl (glControl1) on my form but no matter what I do using QuickFont hides all other drawing on the screen or makes them semi transparent, not sure why.

This is the code I'm using in the GLControl's paint event, I'm quite new to OpenGL so I'm not sure if i'm doing something wrong here. When the control paints the line disappears..

            GL.ClearColor(0.95f, 0.95f, 0.95f, 1.0f);
 
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
 
            QFont qf = new QFont("LSANS.TTF", 6.0f);
            qf.Options.Colour = new Color4(0.2f, 0.2f, 0.2f, 1.0f);
 
// Draw a diagonal line
            GL.PushMatrix();
            GL.Color3(155, 155, 155);
            GL.Begin(BeginMode.Lines);
            GL.Vertex2(0, 0);
            GL.Vertex2(1, 1);
            GL.End();
            GL.PopMatrix();
 
//Write the text using QuickFont
            QFont.Begin();
            GL.PushMatrix();
            GL.Translate(Width * 0.1, Height * 0.1, 0);
            qf.Print("Test 1", QFontAlignment.Centre);
            GL.PopMatrix();
 
            QFont.End();
 
            glControl1.SwapBuffers();
ppc's picture

Try to add GL.Disable(EnableCap.Texture2D) after QFont.End()

OpenNB's picture

Ah yes, I found it out after experimenting a bit more, didn't think one statement might make the difference, just shows how much more I have yet to understand, thanks !

KimikoMuffin's picture

This is a pretty awesome library!

One question -- what license are you releasing it under? LGPL, like OpenTK itself? I have some features I want to implement for my game (specifically, coloring/tinting at render-time) which would require modifying the QuickFont source-code, and I want to make sure I'm doing everything in a kosher manner. ;)

KimikoMuffin's picture

-- oh, wait, there's how you do "tint at render-time," it's a matter of modifying the options. But, uh, my question about the license stands.