From 953581698d2fade30ed76cdae3f8c3a0031b35fb Mon Sep 17 00:00:00 2001 From: dr scofield (aka dirk husemann) Date: Mon, 31 Aug 2009 09:28:56 +0200 Subject: - making font name used by VectorRenderModule configurable: can be set via [VectorRender] font_name = "Comic Sans MS" in OpenSim.ini - adding osSetFontName OSSL function --- .../Scripting/VectorRender/VectorRenderModule.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs') diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs index e83b1a8..bf275fa 100644 --- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs @@ -51,6 +51,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender private Scene m_scene; private IDynamicTextureManager m_textureManager; private Graphics m_graph; + private string m_fontName = "Arial"; public VectorRenderModule() { @@ -123,6 +124,12 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender Bitmap bitmap = new Bitmap(1024, 1024, PixelFormat.Format32bppArgb); m_graph = Graphics.FromImage(bitmap); } + + IConfig cfg = config.Configs["VectorRender"]; + if (null != cfg) + { + m_fontName = cfg.GetString("font_name", m_fontName); + } } public void PostInitialise() @@ -397,7 +404,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender Point startPoint = new Point(0, 0); Point endPoint = new Point(0, 0); Pen drawPen = new Pen(Color.Black, 7); - string fontName = "Arial"; + string fontName = m_fontName; float fontSize = 14; Font myFont = new Font(fontName, fontSize); SolidBrush myBrush = new SolidBrush(Color.Black); @@ -449,8 +456,10 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender } else { - graph.DrawString("URL couldn't be resolved or is", new Font("Arial",6), myBrush, startPoint); - graph.DrawString("not an image. Please check URL.", new Font("Arial", 6), myBrush, new Point(startPoint.X, 12 + startPoint.Y)); + graph.DrawString("URL couldn't be resolved or is", new Font(m_fontName,6), + myBrush, startPoint); + graph.DrawString("not an image. Please check URL.", new Font(m_fontName, 6), + myBrush, new Point(startPoint.X, 12 + startPoint.Y)); graph.DrawRectangle(drawPen, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y); } startPoint.X += endPoint.X; -- cgit v1.1