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.


Topics - 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
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.

3
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?

4
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.

5
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?

6
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]