Documentation
API documentation is currently available in HTML at http://www.rufelt.com/fw1fontwrapper/.

Minimal C++ code example
Drawing strings on the screen is easily achieved in a few lines of code. See the downloadable samples for additional feature examples.

#include "FW1FontWrapper.h"

void drawText(ID3D11Device *pDevice, ID3D11DeviceContext *pContext) {
	IFW1Factory *pFW1Factory;
	HRESULT hResult = FW1CreateFactory(FW1_VERSION, &pFW1Factory);
	
	IFW1FontWrapper *pFontWrapper;
	hResult = pFW1Factory->CreateFontWrapper(pDevice, L"Arial", &pFontWrapper);
	
	pFontWrapper->DrawString(
		pContext,
		L"Text",// String
		128.0f,// Font size
		100.0f,// X position
		50.0f,// Y position
		0xff0099ff,// Text color, 0xAaBbGgRr
		0// Flags (for example FW1_RESTORESTATE to keep context states unchanged)
	);
	
	pFontWrapper->Release();
	pFW1Factory->Release();
}

Last edited Dec 17, 2011 at 3:17 PM by ErikRufelt, version 7

Comments

jackforest2012 Apr 11, 2012 at 4:57 AM 
Hi, when I use this program to display characters, my other drawings are overlapped.

After doing some research, the reason may be that we need to set the pixel format of drawing string to be alpha blended. Is there anyway in FW1FontWrapper to set this render state?

Best regards. (and sorry for unskilled English....)

ErikRufelt Jan 31, 2012 at 12:42 PM 
The issue seems to be resolved in the new 295.51 beta drivers.

ErikRufelt Jan 12, 2012 at 9:14 PM 
This is a driver bug in the beta drivers, which can be circumvented by disabling the geometry shader using FW1_NOGEOMETRYSHADER flag when drawing strings, or by creating the font-wrapper object with params.

The bug has been reported to NVidia and will hopefully be fixed in the release drivers.

See the Discussions page for an explanation of the issue.

likerox Jan 5, 2012 at 11:12 AM 
Hi!

First of all, this is outstanding work. Thanks a lot for sharing!

I have a small problem though, this code runs fine on my GeForce 285.79 drivers however if I upgrade to the latest GeForce 290.53 beta drivers then the text isn't displayed.

Do you have any idea what might be causing this?

Regards.