1
Support / Error in tk2dTextGeomGen when unsupported glyph is found from string
« on: January 02, 2014, 02:56:04 pm »
Hello,
we have released a game that displays Facebook name of the player and her friends in ranking lists. We support most important character sets in our tk2d bitmap font but we have already a few players whose name we can't render. Most of the time unsupported glyphs are rendered empty (as we saw in testing phase) but name of one of our players causes the following exception to happen:
I/Unity (19151): NullReferenceException: Object reference not set to an instance of an object
I/Unity (19151): at tk2dTextGeomGen.GetMeshDimensionsForString (System.String str, .GeomData geomData) [0x00000] in <filename unknown>:0
I/Unity (19151): at tk2dTextGeomGen.SetTextMeshGeom (UnityEngine.Vector3[] pos, UnityEngine.Vector2[] uv, UnityEngine.Vector2[] uv2, UnityEngine.Color32[] color, Int32 offset, .GeomData geomData) [0x00000] in <filename unknown>:0
I/Unity (19151): at tk2dTextMesh.DoNotUse__CommitInternal () [0x00000] in <filename unknown>:0
I/Unity (19151): at tk2dUpdateManager.FlushQueuesInternal () [0x00000] in <filename unknown>:0
I/Unity (19151): at tk2dUpdateManager.FlushQueues () [0x00000] in <filename unknown>:0
I/Unity (19151): at tk2dCamera.OnPreCull () [0x00000] in <filename unknown>:0
We have planned to implement a workaround: we want to render the text with a system font when it contains glyphs that we don't have in our bitmap font. Can you tell us how we could identify this situation? Pseudo code:
--
we have released a game that displays Facebook name of the player and her friends in ranking lists. We support most important character sets in our tk2d bitmap font but we have already a few players whose name we can't render. Most of the time unsupported glyphs are rendered empty (as we saw in testing phase) but name of one of our players causes the following exception to happen:
I/Unity (19151): NullReferenceException: Object reference not set to an instance of an object
I/Unity (19151): at tk2dTextGeomGen.GetMeshDimensionsForString (System.String str, .GeomData geomData) [0x00000] in <filename unknown>:0
I/Unity (19151): at tk2dTextGeomGen.SetTextMeshGeom (UnityEngine.Vector3[] pos, UnityEngine.Vector2[] uv, UnityEngine.Vector2[] uv2, UnityEngine.Color32[] color, Int32 offset, .GeomData geomData) [0x00000] in <filename unknown>:0
I/Unity (19151): at tk2dTextMesh.DoNotUse__CommitInternal () [0x00000] in <filename unknown>:0
I/Unity (19151): at tk2dUpdateManager.FlushQueuesInternal () [0x00000] in <filename unknown>:0
I/Unity (19151): at tk2dUpdateManager.FlushQueues () [0x00000] in <filename unknown>:0
I/Unity (19151): at tk2dCamera.OnPreCull () [0x00000] in <filename unknown>:0
We have planned to implement a workaround: we want to render the text with a system font when it contains glyphs that we don't have in our bitmap font. Can you tell us how we could identify this situation? Pseudo code:
--
Code: [Select]
public tk2dTextMesh tk2dText;
void SetName(string playerName) {
if(tk2dText.HasUnsupportedGlyphs(playerName)) {
// render name with system font
...
} else {
// all glyphs supported -> render name with tk2dTextMesh
tk2dText.text = playerName;
tk2dText.Commit();
}
}