Drawing an `ofTrueTypeFont` into an `ofFbo`

Hello.

I’ve noticed that drawing an ofTrueTypeFont into an ofFbo produces some artefacts around the edges of the characters.

The first line of text in the image below was drawn into the FBO. The second line of text was not drawn into the FBO.

Is there a way to make the first line look like the second line?

Thanks!

48 pm

ofEnableAlphaBlending();

//...

// Draw FBO
if (shouldRedraw)
{
    fbo.begin();
    ofClear(0, 0);
    font->drawString(text, x, y);
    fbo.end();
}

fbo.draw(origin.x, origin.y);

// Draw font
font->drawString(text, x + dx, y + dy);

before fob.end() can you try ofClearAlpha();

the thing about alpha drawn into an fbo is the pixels in the fbo have alpha, so if you mix a pixel that is 50% opaque, such as the edge of type with the pixel that is 100% opaque, the result is 75% opaque – so some transparency. The edges you are seeing are that transparency in the fbo when you draw it. ofClearAlpha will set all alpha to be opaque. You can also make an FBO which is just RGB and not RGBA.

Thanks Zach! That solved it.