aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
diff options
context:
space:
mode:
authorSean Dague2009-02-18 12:56:36 +0000
committerSean Dague2009-02-18 12:56:36 +0000
commit383f8b3ac601baef7b2cb322f53fb36b69367286 (patch)
treef90b2535f102be4f3ba50a41bb2668dc2cb956f2 /OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
parentremove legacy pre-migration code for mysql grid adapter, who knew this (diff)
downloadopensim-SC_OLD-383f8b3ac601baef7b2cb322f53fb36b69367286.zip
opensim-SC_OLD-383f8b3ac601baef7b2cb322f53fb36b69367286.tar.gz
opensim-SC_OLD-383f8b3ac601baef7b2cb322f53fb36b69367286.tar.bz2
opensim-SC_OLD-383f8b3ac601baef7b2cb322f53fb36b69367286.tar.xz
From: Christopher Yeoh <yeohc@au1.ibm.com>
The attached patch implements osGetDrawStringSize that looks like: vector osGetDrawStringSize(string contentType, string text, string fontName, int fontSize) in LSL. It is meant to be used in conjunction with the osDraw* functions. It returns accurate information on the size that a given string will be rendered given the specified font and font size. This allows for nicely formatted and positioned text on the generated image.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs18
1 files changed, 18 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 564648b..597592d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -677,6 +677,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
677 return drawList; 677 return drawList;
678 } 678 }
679 679
680 public LSL_Vector osGetDrawStringSize(string contentType, string text, string fontName, int fontSize)
681 {
682 CheckThreatLevel(ThreatLevel.VeryLow, "osGetDrawStringSize");
683 m_host.AddScriptLPS(1);
684
685 LSL_Vector vec = new LSL_Vector(0,0,0);
686 IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>();
687 if (textureManager != null)
688 {
689 double xSize, ySize;
690 textureManager.GetDrawStringSize(contentType, text, fontName, fontSize,
691 out xSize, out ySize);
692 vec.x = xSize;
693 vec.y = ySize;
694 }
695 return vec;
696 }
697
680 public void osSetStateEvents(int events) 698 public void osSetStateEvents(int events)
681 { 699 {
682 // This function is a hack. There is no reason for it's existence 700 // This function is a hack. There is no reason for it's existence