Problem with Nuclex.Fonts

Tiptup200's picture

First I'd like to say that I LOVE THIS library, it makes my game seem so much more professional, now to the problem...

When theres a whole lot of text being drawn using TextManager Game Component, sometimes a random character on the screen will only be draw half way (O will turn into U, L will turn into l), it only happens if theirs a lot of text being drawn, and if the text is the same it will be a specific letter if you know what I mean.

Like lets say on my menu screen it has the menu choices at the left right (they arent changing), and you have the current choice at the bottom (also not changing) and you have the description which is kinda long. A certain letter somewhere will be half drawn...

My game is almost done and this tiny glitch can make my game look a little unprofessional. I'd love some help! thank you for the library.

Cygon's picture

Strange...

Sorry for answering so late, didn't notice your message the whole week. Guess I really should set up an email notification for my forum :)

I have never seen this happening on my test systems. If it was just a round-off error it wouldn't eat away the whole baseline of an L, so I'm pretty much puzzled as to what is happening.

Can you try isolating that coordinates, string and font that make this happen? Then we'd have an easy reproduction case.

Tiptup3000's picture

Well, it only happens when

Well, it only happens when their lots of text on screen. To add to the amount of text I draw most of the text 4x times for shadowing purposes.

the font is Segoe UI, the coordinates doesn't affect it because I also have scrolling text which will do it.

EXAMPLE: http://filelabs.net/files/exampleREgk.png

Tiptup200's picture

err

I guess my last comment didnt post or something...

Well, it only happens where theirs a whole lot of text on the screen. And the coordinates don't affect it either.

EXAMPLE: http://filelabs.net/files/example0k8Y.png

Cygon's picture

I have an idea...

Looks like there is precisely one triangle missing (each character consists of 2 rendered triangles for a total of 6 vertices per character). Combined with the fact that it only happens with large amounts of text, I think I have an idea what is going on:

The TextManager collects vertices and sends them to the graphics device in batches of 4096 vertices at a time. If the 4096 vertex limit is reached before the frame ends, an intermediate batch flush will be performed. This limit would be reached after 682 full characters (* 6 vertices each) = 4092 vertices, only enough space for one additional triangle, so the final character before the intermediate render step would get divided between two DrawPrimitive() calls.

Maybe there's a bug in this division code that causes it to loose one triangle in that step. I'll investigate the problem, if you need a temporary fix, I think you can work around the problem by changing the batch size in Nuclex.Fonts/Source/VertexBatcher.cs line #34 to 4094 (or by just increasing it to a size where the intermediate batch flush doesn't occur anymore, eg. 8192 maybe). I'll report back when I can reproduce the problem!

Tiptup200's picture

Sounds good, I'll await your

Sounds good, I'll await your results...

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Lines and paragraphs break automatically.
  • Allowed HTML tags: <br> <a> <em> <strong> <u> <i> <b> <cite> <blockcode> <code> <ul> <ol> <li> <dl> <dt> <dd> <p> <pre> <span>
  • You can highlight code with any of the following tags: <blockcode>

More information about formatting options