Cygon4

Hi!

I'm just in the process of writing a proper text rendering component for XNA. It fully integrates into the content pipeline and can import any TrueType font during compile time. Just like any other XNA framework content, an .xnb file is generated from the font which can at runtime be loaded by XNA's ContentManager, eg.

BitmapFont myFont = this.content.load<BitmapFont>(
  "Content/Fonts/Arial"
);

// ...

this.myFont.drawText(
  new Vector2(100.0f, 100.0f),
  "Hello World",
  Color.White
);

The component is still in development and there will likely be some changes in its interface, but it's already fully usable. If you want to give it a go, you can find the component here:

http://www.nuclex.org/framework/fonts

-Markus-


Re: XNA Game Studio Express Ann: A "Proper" Text Rendering Component

Glenn Wilson

I will give it a go.. But I think MS are also working on something like this.. Get back to you on what I think.






Re: XNA Game Studio Express Ann: A "Proper" Text Rendering Component

Glenn Wilson

Got it working and it looks good, Had to play a bit with the main project... ie recreating it as it would not load from the downloaded file..... Once I did get it working it looks to run well.






Re: XNA Game Studio Express Ann: A "Proper" Text Rendering Component

George Clingerman

Well, I've had no luck getting this up and running and I've been banging my head on it all afternoon. Any time I try to use the Nuclex.Fonts.Content.Pipeline.TrueTypeImporter.dll in a project or even try to run the sample project right out of the box, I get the error

"Error loading pipeline assembly "<filepath>\Nuclex.Fonts.Content.Pipeline.TrueTypeImporter.dll"

I'm really looking forward to playing with this, but I'm not sure where to go from here. Anyone else getting this error and have some ideas of some things I should try




Re: XNA Game Studio Express Ann: A "Proper" Text Rendering Component

Cygon4

This might be one of two things:

- Nuclex.Fonts.Content.Pipeline.TrueTypeImporter.dll references Nuclex.Fonts.dll, so it needs to be able to load it at compile time (eg. both files have to be in the same directory)
- The Importer was written in C++/CLI (due to FreeType) and requires the Visual C++ 2005 runtime. Maybe this is missing. You can download it here: Visual C++ 2005 Redistributable Package.

The final release will have an installer that ensures the Visual C++ 2005 runtime is installed. Maybe I can even get rid of the interdependency between the two assemblies.

-Markus-





Re: XNA Game Studio Express Ann: A "Proper" Text Rendering Component

Glenn Wilson

I have it working at the moment and it does all right, but as it needs those extra dlls, have you tried it on the x360...






Re: XNA Game Studio Express Ann: A "Proper" Text Rendering Component

Leaf.

Glenn Wilson wrote:

I have it working at the moment and it does all right, but as it needs those extra dlls, have you tried it on the x360...

As was mentioned its the content importer that is written in C++/CLI and that only needs to run on Windows.

Cheers,
Leaf.






Re: XNA Game Studio Express Ann: A "Proper" Text Rendering Component

Cygon4

Exactly

Your game only links against Nuclex.Fonts.dll which will have a PC and an XBox 360 version in the final release. Nuclex.Fonts.Content.Pipeline.TrueTypeImporter.dll is only needed during build time (by XNA GSE itself) and only that one requires the VC2005 runtime!

Sadly, I don't have an XBox 360, but I'll try putting together an XBox 360 version of the Nuclex.Fonts assembly. Source code of everything will be released once its done (probably by the weekend) as well!

-Markus-





Re: XNA Game Studio Express Ann: A "Proper" Text Rendering Component

Leaf.

I notice you have some unfinished VectorFont bits in there. I've been looking into rasterizing glyphs at runtime and wondered if you had any thoughts on vector rasterization in pure managed code. In C++ I would use FreeType but obviously that is not a valid option for the Xbox 360.

Cheers,
Leaf.






Re: XNA Game Studio Express Ann: A "Proper" Text Rendering Component

George Clingerman

Well, I've installed the Visual C++ Runtime redistributable (and have verified that it's there in the Add/Remove programs list) and I have verified that the two dlls are in the same folder (and they definitely are in your sample project), but I'm still getting the same error.

Are there any more requirements for the Importer dll Maybe this is because I've never installed the full blown Visual Studio on this PC and am only running the Express versions so there's something present when Studio is installed that I'm missing





Re: XNA Game Studio Express Ann: A "Proper" Text Rendering Component

Cygon4

George Clingerman wrote:
Well, I've installed the Visual C++ Runtime redistributable (and have verified that it's there in the Add/Remove programs list) and I have verified that the two dlls are in the same folder (and they definitely are in your sample project), but I'm still getting the same error.

Are there any more requirements for the Importer dll Maybe this is because I've never installed the full blown Visual Studio on this PC and am only running the Express versions so there's something present when Studio is installed that I'm missing


I have never even installed the full Visual Studio on the system I used to develop this component. Only Visual C# 2005 Express and Visual C++ 2005 Express, both updated with SP1 and the SP1 Beta Update for Vista.

If the error message doesn't reveal further informations, you could try compiling it by yourself. I just uploaded a new release which includes the full source code to both Nuclex.Fonts assemblies. I'm sorry, but I'm out of ideas what might be going wrong here...

-Markus-





Re: XNA Game Studio Express Ann: A "Proper" Text Rendering Component

Cygon4

Leaf. wrote:

I notice you have some unfinished VectorFont bits in there. I've been looking into rasterizing glyphs at runtime and wondered if you had any thoughts on vector rasterization in pure managed code. In C++ I would use FreeType but obviously that is not a valid option for the Xbox 360.

Cheers,
Leaf.



I've just been thinking about processing the FT_Outline structure returned by FreeType into some format I could use to construct extruded meshes for a given string. However, it appears that you need a solid knowledge of Bezier curves to even interpret this structure. I'm still thinking whether the effort is worth it or whether I'll just extrude some text in blender and export that into an .x file when I need it.

-Markus-





Re: XNA Game Studio Express Ann: A "Proper" Text Rendering Component

George Clingerman

Well, now I've recreated the issue on two separate PCs. I did try installing Visual C++ Express just to see if that added some missing requirement but it didn't do the trick.

I'm not running Vista, just good old fashioned Windows XP but I'd imagine the dll should work on both.

Is anyone else experiencing this error or am I the only having trouble getting this to work





Re: XNA Game Studio Express Ann: A "Proper" Text Rendering Component

Rick Mogstad

Yep, same error message for me.






Re: XNA Game Studio Express Ann: A "Proper" Text Rendering Component

Cygon4

Got it!!

I just installed a fresh Windows XP, Visual C# 2005 Express and XNA Game Studio Express in Virtual PC and tried it myself.

The error happens because my DLL apparently requires a different version of the VC2005 runtimes. My development machine is running Visual C++ 2005 Express with SP1 and SP1 Update for Vista (BETA!). Either the embedded manifest is wrong or a newer runtime is referenced which is not available as a redistributable kit yet. Anyway, I learned my lesson: Never use unsupported software for production work.

I recompiled the importer with Visual C++ 2005 Express without any Service Packs and provided an updated release. Everything should be fine now, sorry for the hazzle!

-Markus-