diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Scripting')
3 files changed, 33 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs index a8f841b..ab404bd 100644 --- a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs | |||
@@ -143,6 +143,18 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture | |||
143 | return UUID.Zero; | 143 | return UUID.Zero; |
144 | } | 144 | } |
145 | 145 | ||
146 | |||
147 | public void GetDrawStringSize(string contentType, string text, string fontName, int fontSize, | ||
148 | out double xSize, out double ySize) | ||
149 | { | ||
150 | xSize = 0; | ||
151 | ySize = 0; | ||
152 | if (RenderPlugins.ContainsKey(contentType)) | ||
153 | { | ||
154 | RenderPlugins[contentType].GetDrawStringSize(text, fontName, fontSize, out xSize, out ySize); | ||
155 | } | ||
156 | } | ||
157 | |||
146 | #endregion | 158 | #endregion |
147 | 159 | ||
148 | #region IRegionModule Members | 160 | #region IRegionModule Members |
diff --git a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs index 2eb8fc0..96618e0 100644 --- a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs | |||
@@ -84,6 +84,13 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL | |||
84 | return false; | 84 | return false; |
85 | } | 85 | } |
86 | 86 | ||
87 | public void GetDrawStringSize(string text, string fontName, int fontSize, | ||
88 | out double xSize, out double ySize) | ||
89 | { | ||
90 | xSize = 0; | ||
91 | ySize = 0; | ||
92 | } | ||
93 | |||
87 | #endregion | 94 | #endregion |
88 | 95 | ||
89 | #region IRegionModule Members | 96 | #region IRegionModule Members |
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs index 6a348a3..c3e39ad 100644 --- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs | |||
@@ -89,6 +89,20 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
89 | return true; | 89 | return true; |
90 | } | 90 | } |
91 | 91 | ||
92 | public void GetDrawStringSize(string text, string fontName, int fontSize, | ||
93 | out double xSize, out double ySize) | ||
94 | { | ||
95 | Bitmap bitmap = new Bitmap(1024, 1024, PixelFormat.Format32bppArgb); | ||
96 | Graphics graph = Graphics.FromImage(bitmap); | ||
97 | |||
98 | Font myFont = new Font(fontName, fontSize); | ||
99 | SizeF stringSize = new SizeF(); | ||
100 | stringSize = graph.MeasureString(text, myFont); | ||
101 | xSize = stringSize.Width; | ||
102 | ySize = stringSize.Height; | ||
103 | } | ||
104 | |||
105 | |||
92 | #endregion | 106 | #endregion |
93 | 107 | ||
94 | #region IRegionModule Members | 108 | #region IRegionModule Members |