VectorText Spaces?

Aug 20, 2010 at 10:19 PM

Am I correct that VectorText currently doesn't support spaces? In the text to draw I mean?

Coordinator
Aug 20, 2010 at 11:00 PM

It should have no problem with spaces. The example application displays a "Hello World", with a space between both words.

Now that you say it, I do notice that the first picture in the docs (the outlined text) seems to be missing the space. I'll have to check whether this is me being careless when making those pictures or a bug in the outline rendering code. Could be either the importer or the vertex generation code.

Do you render your text as outlines?

Aug 21, 2010 at 7:12 AM

ah, yes its only affecting outline mode.  The other two worked perfectly.

Coordinator
Aug 21, 2010 at 8:23 AM

Houston, we have a bug :)

Already located the issue, it's a stupid optimization attempt of mine:

      for(int characterIndex = 0; characterIndex < text.Length; ++characterIndex) {
        int fontCharacterIndex;

        // Only add this character to the mesh if there is an actual font character
        // for this unicode symbol in the font (characters not imported by the user
        // will be silently skipped -- this is the only sane option imho)
        if(font.CharacterMap.TryGetValue(text[characterIndex], out fontCharacterIndex)) {
          VectorFontCharacter character = font.Characters[fontCharacterIndex];

          if(character.Outlines.Count > 0) {
            // ...more code...

            // Adjust the base vertex index for the next character
            baseVertexIndex += outlineVertexCount;

            // Advance to the next character
            position += character.Advancement;
          }

        } // if
      } // for

It only updates the position at which the next character will be drawn when the processed character contains any outlines. So that excludes the space character from updating the cursor position. Doh!

Will be fixed in the next release.