Using additional Fonts in TorqueX
by ManifestoGames · in General Discussion · 09/20/2007 (10:43 am) · 1 replies
Hi,
I need to use an additional Font in my TorqueX project. Reading the documentation, it says:
The font to use for rendering the text. The default engine font is specified in the project TorqueEngineData. When using the default engine font, it is not necessary to provide a relative path or file extension: style.FontType = "arial16"; Other projects may also provide additional fonts. When using fonts other than the default engine font the relative path needs to be provided: style.FontType = "data/fonts/myfont";
But when I try to use the font path, I get this error:
Btw, I already checked and the font file is in the specified path.
Value cannot be null.
Parameter name: s
at System.IO.StringReader..ctor(String s)
at System.Xml.XmlDocument.LoadXml(String xml)
at GarageGames.Torque.Core.ResourceManager.LoadFont(String asset)
at GarageGames.Torque.GUI.GUITextStyle.set_FontType(String value)
So, I tried to use the same path, including the font file extension, but then I get an error related to some xml file missing.
Could not find file 'C:\Development\game\bin\x86\Debug\data\fonts\chumbly_font.xml'.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials)
at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)
at System.Xml.XmlTextReaderImpl.OpenUrlDelegate(Object xmlResolver)
at System.Threading.CompressedStack.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.CompressedStack.Run(CompressedStack compressedStack, ContextCallback callback, Object state)
at System.Xml.XmlTextReaderImpl.OpenUrl()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
at System.Xml.XmlDocument.Load(XmlReader reader)
at System.Xml.XmlDocument.Load(String filename)
at GarageGames.Torque.Core.ResourceManager.LoadFont(String asset)
at GarageGames.Torque.GUI.GUITextStyle.set_FontType(String value)
Any ideias?
Thanks!
Btw, I already checked if the font file is in the specified path.
I need to use an additional Font in my TorqueX project. Reading the documentation, it says:
The font to use for rendering the text. The default engine font is specified in the project TorqueEngineData. When using the default engine font, it is not necessary to provide a relative path or file extension: style.FontType = "arial16"; Other projects may also provide additional fonts. When using fonts other than the default engine font the relative path needs to be provided: style.FontType = "data/fonts/myfont";
But when I try to use the font path, I get this error:
Btw, I already checked and the font file is in the specified path.
Value cannot be null.
Parameter name: s
at System.IO.StringReader..ctor(String s)
at System.Xml.XmlDocument.LoadXml(String xml)
at GarageGames.Torque.Core.ResourceManager.LoadFont(String asset)
at GarageGames.Torque.GUI.GUITextStyle.set_FontType(String value)
So, I tried to use the same path, including the font file extension, but then I get an error related to some xml file missing.
Could not find file 'C:\Development\game\bin\x86\Debug\data\fonts\chumbly_font.xml'.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials)
at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)
at System.Xml.XmlTextReaderImpl.OpenUrlDelegate(Object xmlResolver)
at System.Threading.CompressedStack.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.CompressedStack.Run(CompressedStack compressedStack, ContextCallback callback, Object state)
at System.Xml.XmlTextReaderImpl.OpenUrl()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
at System.Xml.XmlDocument.Load(XmlReader reader)
at System.Xml.XmlDocument.Load(String filename)
at GarageGames.Torque.Core.ResourceManager.LoadFont(String asset)
at GarageGames.Torque.GUI.GUITextStyle.set_FontType(String value)
Any ideias?
Thanks!
Btw, I already checked if the font file is in the specified path.
About the author
Torque 3D Owner Stephen Zepp