Hello Guest

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - OnlineCop

Pages: [1]
1
Support / How can I get the normals for a tk2dTextMesh?
« on: March 16, 2013, 02:05:43 am »
I am applying some Megafier filters to my GameObjects so I can do funky effects, like stretching, wrapping, etc.

If I attach a Megafier onto a tk2dTextMesh in Unity while the app is NOT running, I can see the text bending around as expected in the Inspector. I get errors when I run the app with a Megafier attached, however, as it is trying to use the material's normals, which the TextMesh does not generate.

tk2dSprites, of course, have normals, so those are not adversely affected.

Have you used Megafiers? If so, do you know if a work-around so I can get its visual effects to apply to this text?

2
tk2dTextMesh.cs has a switch statement that says "else if (idx == ' ')" among other characters, like periods, semi-colons, and other characters.

Remove all the characters you don't want the "break to next line" code to soft-wrap there (make sure that the space character IS still there).

3
I just created a new Unity project, and imported 2D Toolkit version 1.8b1. I created a new GameObject and selected it, then tried to add a tk2dTextMesh component to it. This caused an IndexOutOfRangeException error in the Unity console.

It turns out that I had not yet created a font.

I was able to fix this by importing a .fnt and .png file, creating a Font from the Project->Create->tk2d->Font.

It would be helpful if we could get a "Whoa there; you need to create a font first!" popup (or even a Debug.Log() message) to explain that the developer (us, not you) forgot to do that step.

4
Support / Re: Implementing word wrap
« on: August 31, 2012, 06:55:35 pm »
This is very nice. Thanks!

Could I request an additional feature (for the final release)? Concatenation.

If we could have a "Max Height" option that chops off anything that tries to Word Wrap past that maximum, we could have 1-line text that simply concatenates if someone tries to type too long (again, not on a per-chararacter but on a per-pixel boundary). Or, if it spans 2+ lines, it will wrap normally until it hits the Max Height, and any text past that is removed.

5
Support / Implementing word wrap
« on: August 30, 2012, 07:58:00 pm »
If I edit tk2dTextMesh.cs and change "private Vector2 GetMeshDimensionsForString()" to "public Vector2 GetMeshDimensionsForString()", I can iterate over each of my strings and add newlines (\n) as needed to give it a "word wrap" ability on a per-pixel (as opposed to a per-character) basis. This is especially useful when I use a variable-width font, since character-counting makes lines of lowercase "LLLL" and uppercase "WWWW" break very differently.

That said, if I try to determine the height of the text, I notice that the GetMeshDimensionsForString() calculates its height off of the font's lineHeight variable. That height is often different from the actual height of the glyphs being used (the tallest of my glyphs reaches about 42 pixels, while the .fnt file defines lineHeight to be 64).

The attached screenshot shows a popup I've created with a TextMesh, as well as the properties for that TextMesh. I have added a child GameObject and attached a BoxCollider to it to indicate to my word wrap code how large the "word wrap box" needs to be. That makes it easier for my developers to eyeball things without changing (or forgetting to change) the dimensions somewhere.

It does not correctly chop off the last line, however. What I want to do is calculate the height of the font, calculate the height of this GameObject+BoxCollider combo, and chop off anything that spills over. I should have lines 1-5, but line 6 (which has the text, "excrement at you. Stand back!") needs to actually be removed (I might add an ellipsis '...' to the end of "they will fling", but that's more of an aside).

Is there a way to calculate the height of the used glyphs, instead of relying on the lineHeight property? I assume it would take the character's 'height' and 'yoffset' into account to ensure that the tall characters (like a pipe '|') and hanging letters (like lowercase 'g' or 'y') are all handled. It might also take the lineSpacing multiplied by some scaling factor into account.

...Unless I'm just reinventing the wheel here and you already have some sort of "concatenate long lines" option that I can just call.

Ideas?

6
Support / Re: How is kerning handled when DupeCaps is enabled?
« on: August 30, 2012, 03:53:37 pm »
ToUpper() or ToLower() is fine to use, if it would just triple the kerning table otherwise. What does Dupe Caps choose to use: uppercase or lowercase?  As in, does it duplicate the capital letters into the space of the lowercase ones, or copy the lowercase ones in place of the capital ones?  Do we want to ToUpper() all of our lowercase text, or do we want to ToLower() all of our uppercase ones?

7
Support / How is kerning handled when DupeCaps is enabled?
« on: August 29, 2012, 08:34:41 pm »
If I import a font that contains kerning information and apply the "Dupe Caps" option for the tk2dFont, will the kerning for various "cases" of the characters be applied?

ae
aE
Ae
AE

The id for 'a' is 97, and 'e' is 101. I can set the kerning between those two with the lines:

kerning first=97 second=101 amount=-1

Now, the id for 'E' is 69, so both the 'ae' and 'aE' should be rendering the same glyph, but will the kerning still apply between the letters?  If not, do I have to create its own kerning entry:

kerning first=97 second=69 amount=-1

If this is the case, I have to do a separate kerning for each of these scenarios above:

kerning first=97 second=101 amount=-1
kerning first=97 second=69 amount=-1
kerning first=65 second=101 amount=-1
kerning first=65 second=69 amount=-1

instead of just a single line (I'm not sure if the Dupe Caps uses uppercase glyphs, lowercase glyphs, or chooses based on which one is available -- or picks one if both are available?), which is nearly 4x the amount of test scenarios I'll have to check for when writing the kerning info.

8
Support / Rebuild Index: automate offline
« on: April 03, 2012, 07:02:48 pm »
We've got a bunch of programmers working on various atlases, and we've found that the toolkit doesn't rebuild or reindex itself when atlases are added (version 1.56 final; this may have already been addressed in a newer update).

I found the "Rebuild Index" menu from within TK2DROOT/tk2d/Editor/tk2dEditorUtility.cs file and just wondered if there was a way to call this from OUTSIDE of Unity (for example, create a nightly/weekly cron job that will let everything rebuild)?

Or does Unity have to be open for it to process correctly?

9
Support / Re: tk2dtextmesh gizmo off visually within Unity3d
« on: February 21, 2012, 12:46:38 am »
As a follow-up: The fonts were generated using GlyphDesigner (http://glyphdesigner.71squared.com/) version 1.5.2 (953). I'll let them know what's happened when importing it into Unity (I might as well just send them the URL to this forum discussion).

But I wanted to post this name in here in case any future searches turn up with the same kind of oddity.

10
Support / Re: tk2dtextmesh gizmo off visually within Unity3d
« on: February 20, 2012, 10:22:13 pm »
The gizmo mode is set to center. Pivot (whether using a space or an underscore) appears to place the gizmo at the bottom-left corner of the mesh, and doesn't appear to move based on the whitespace between the words.

For the font, do I provide the .fnt file, the .prefab, or the .mat?

11
Support / tk2dtextmesh gizmo off visually within Unity3d
« on: February 20, 2012, 07:24:16 pm »
When I add a tk2dtextmesh to my scene, the gizmo (the thing that lets you move/rescale/rotate your objects) appears in different locations of Unity based upon the type of whitespace found in the text.

I currently have a small timer animation which should show the text "TIME LEFT".




When the words are separated with a space, the gizmo appears below the text (sometimes far below), and what appears to be centered to the average width of each of the space-separated words.

If I replace the space between the words with an underscore, the gizmo is centered (both horizontally and vertically) over the text as I would expect.




This only appears to be a visual (editor) anomaly, but I was wondering what I could do (edit one of the .cs files?) to correct this so I can use spaces between my words without it moving the gizmo around (screenshots and text settings attached, if it helps explain).

Pages: [1]