diff options
author | dr scofield (aka dirk husemann) | 2009-08-31 09:28:56 +0200 |
---|---|---|
committer | dr scofield (aka dirk husemann) | 2009-08-31 10:30:10 +0200 |
commit | 953581698d2fade30ed76cdae3f8c3a0031b35fb (patch) | |
tree | 75154a48797a15df0749a57eb3aea196678b569f | |
parent | Remove typo version of ReplaceableInterface property from RegionCombinerModule. (diff) | |
download | opensim-SC-953581698d2fade30ed76cdae3f8c3a0031b35fb.zip opensim-SC-953581698d2fade30ed76cdae3f8c3a0031b35fb.tar.gz opensim-SC-953581698d2fade30ed76cdae3f8c3a0031b35fb.tar.bz2 opensim-SC-953581698d2fade30ed76cdae3f8c3a0031b35fb.tar.xz |
- making font name used by VectorRenderModule configurable: can be set
via
[VectorRender]
font_name = "Comic Sans MS"
in OpenSim.ini
- adding osSetFontName OSSL function
5 files changed, 31 insertions, 3 deletions
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 | |||
51 | private Scene m_scene; | 51 | private Scene m_scene; |
52 | private IDynamicTextureManager m_textureManager; | 52 | private IDynamicTextureManager m_textureManager; |
53 | private Graphics m_graph; | 53 | private Graphics m_graph; |
54 | private string m_fontName = "Arial"; | ||
54 | 55 | ||
55 | public VectorRenderModule() | 56 | public VectorRenderModule() |
56 | { | 57 | { |
@@ -123,6 +124,12 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
123 | Bitmap bitmap = new Bitmap(1024, 1024, PixelFormat.Format32bppArgb); | 124 | Bitmap bitmap = new Bitmap(1024, 1024, PixelFormat.Format32bppArgb); |
124 | m_graph = Graphics.FromImage(bitmap); | 125 | m_graph = Graphics.FromImage(bitmap); |
125 | } | 126 | } |
127 | |||
128 | IConfig cfg = config.Configs["VectorRender"]; | ||
129 | if (null != cfg) | ||
130 | { | ||
131 | m_fontName = cfg.GetString("font_name", m_fontName); | ||
132 | } | ||
126 | } | 133 | } |
127 | 134 | ||
128 | public void PostInitialise() | 135 | public void PostInitialise() |
@@ -397,7 +404,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
397 | Point startPoint = new Point(0, 0); | 404 | Point startPoint = new Point(0, 0); |
398 | Point endPoint = new Point(0, 0); | 405 | Point endPoint = new Point(0, 0); |
399 | Pen drawPen = new Pen(Color.Black, 7); | 406 | Pen drawPen = new Pen(Color.Black, 7); |
400 | string fontName = "Arial"; | 407 | string fontName = m_fontName; |
401 | float fontSize = 14; | 408 | float fontSize = 14; |
402 | Font myFont = new Font(fontName, fontSize); | 409 | Font myFont = new Font(fontName, fontSize); |
403 | SolidBrush myBrush = new SolidBrush(Color.Black); | 410 | SolidBrush myBrush = new SolidBrush(Color.Black); |
@@ -449,8 +456,10 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
449 | } | 456 | } |
450 | else | 457 | else |
451 | { | 458 | { |
452 | graph.DrawString("URL couldn't be resolved or is", new Font("Arial",6), myBrush, startPoint); | 459 | graph.DrawString("URL couldn't be resolved or is", new Font(m_fontName,6), |
453 | graph.DrawString("not an image. Please check URL.", new Font("Arial", 6), myBrush, new Point(startPoint.X, 12 + startPoint.Y)); | 460 | myBrush, startPoint); |
461 | graph.DrawString("not an image. Please check URL.", new Font(m_fontName, 6), | ||
462 | myBrush, new Point(startPoint.X, 12 + startPoint.Y)); | ||
454 | graph.DrawRectangle(drawPen, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y); | 463 | graph.DrawRectangle(drawPen, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y); |
455 | } | 464 | } |
456 | startPoint.X += endPoint.X; | 465 | startPoint.X += endPoint.X; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 0de5c9b..bca019b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -880,6 +880,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
880 | return drawList; | 880 | return drawList; |
881 | } | 881 | } |
882 | 882 | ||
883 | public string osSetFontName(string drawList, string fontName) | ||
884 | { | ||
885 | CheckThreatLevel(ThreatLevel.None, "osSetFontName"); | ||
886 | |||
887 | m_host.AddScriptLPS(1); | ||
888 | drawList += "FontName "+ fontName +"; "; | ||
889 | return drawList; | ||
890 | } | ||
891 | |||
883 | public string osSetPenSize(string drawList, int penSize) | 892 | public string osSetPenSize(string drawList, int penSize) |
884 | { | 893 | { |
885 | CheckThreatLevel(ThreatLevel.None, "osSetPenSize"); | 894 | CheckThreatLevel(ThreatLevel.None, "osSetPenSize"); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index b129b39..49aa45a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | |||
@@ -99,6 +99,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
99 | string osDrawFilledRectangle(string drawList, int width, int height); | 99 | string osDrawFilledRectangle(string drawList, int width, int height); |
100 | string osDrawPolygon(string drawList, LSL_List x, LSL_List y); | 100 | string osDrawPolygon(string drawList, LSL_List x, LSL_List y); |
101 | string osDrawFilledPolygon(string drawList, LSL_List x, LSL_List y); | 101 | string osDrawFilledPolygon(string drawList, LSL_List x, LSL_List y); |
102 | string osSetFontName(string drawList, string fontName); | ||
102 | string osSetFontSize(string drawList, int fontSize); | 103 | string osSetFontSize(string drawList, int fontSize); |
103 | string osSetPenSize(string drawList, int penSize); | 104 | string osSetPenSize(string drawList, int penSize); |
104 | string osSetPenColour(string drawList, string colour); | 105 | string osSetPenColour(string drawList, string colour); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 45492dd..8f52d99 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -282,6 +282,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
282 | return m_OSSL_Functions.osSetFontSize(drawList, fontSize); | 282 | return m_OSSL_Functions.osSetFontSize(drawList, fontSize); |
283 | } | 283 | } |
284 | 284 | ||
285 | public string osSetFontName(string drawList, string fontName) | ||
286 | { | ||
287 | return m_OSSL_Functions.osSetFontName(drawList, fontName); | ||
288 | } | ||
289 | |||
285 | public string osSetPenSize(string drawList, int penSize) | 290 | public string osSetPenSize(string drawList, int penSize) |
286 | { | 291 | { |
287 | return m_OSSL_Functions.osSetPenSize(drawList, penSize); | 292 | return m_OSSL_Functions.osSetPenSize(drawList, penSize); |
diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 2303873..4cf5a8d 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example | |||
@@ -761,6 +761,10 @@ | |||
761 | ; Density of tree population | 761 | ; Density of tree population |
762 | tree_density = 1000.0 | 762 | tree_density = 1000.0 |
763 | 763 | ||
764 | [VectorRender] | ||
765 | |||
766 | ; the font to use for rendering text (default: Arial) | ||
767 | ; font_name = "Arial" | ||
764 | 768 | ||
765 | [ScriptEngine.DotNetEngine] | 769 | [ScriptEngine.DotNetEngine] |
766 | Enabled = true | 770 | Enabled = true |