Added:
/trunk/source/directwrite/GlyphRunDescription.cpp
/trunk/source/directwrite/GlyphRunDescription.h
/trunk/source/directwrite/ITextRenderer.cpp
/trunk/source/directwrite/ITextRenderer.h
/trunk/source/directwrite/Strikethrough.cpp
/trunk/source/directwrite/Strikethrough.h
/trunk/source/directwrite/Underline.cpp
/trunk/source/directwrite/Underline.h
Deleted:
/trunk/source/directwrite/TextRenderer.cpp
/trunk/source/directwrite/TextRenderer.h
Modified:
/trunk/build/ReleaseNotes.txt
/trunk/build/SlimDX.vcxproj
/trunk/build/SlimDX.vcxproj.filters
/trunk/source/directwrite/GlyphRunDW.cpp
/trunk/source/directwrite/GlyphRunDW.h
/trunk/source/directwrite/InlineObject.cpp
/trunk/source/directwrite/InlineObject.h
/trunk/source/directwrite/TextLayout.cpp
/trunk/source/directwrite/TextLayout.h
/trunk/source/directwrite/ToDo.txt
=======================================
--- /dev/null
+++ /trunk/source/directwrite/GlyphRunDescription.cpp Fri Mar 2 11:05:32
2012
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2007-2012 SlimDX Group
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
copy
+* of this software and associated documentation files (the "Software"), to
deal
+* in the Software without restriction, including without limitation the
rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+* THE SOFTWARE.
+*/
+#include "stdafx.h"
+
+#include "GlyphRunDescription.h"
+
+using namespace System;
+
+namespace SlimDX
+{
+namespace DirectWrite
+{
+ GlyphRunDescription::GlyphRunDescription(const
DWRITE_GLYPH_RUN_DESCRIPTION &desc)
+ {
+ LocaleName = gcnew String(desc.localeName);
+ Text = gcnew String(desc.string);
+ StringLength = desc.stringLength;
+ TextPosition = desc.textPosition;
+
+ ClusterMap = gcnew array<short>(StringLength);
+ for (int i = 0; i < StringLength; i++)
+ ClusterMap[i] = desc.clusterMap[i];
+ }
+}
+}
=======================================
--- /dev/null
+++ /trunk/source/directwrite/GlyphRunDescription.h Fri Mar 2 11:05:32 2012
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2007-2012 SlimDX Group
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
copy
+* of this software and associated documentation files (the "Software"), to
deal
+* in the Software without restriction, including without limitation the
rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+* THE SOFTWARE.
+*/
+#pragma once
+
+namespace SlimDX
+{
+ namespace DirectWrite
+ {
+ public ref class GlyphRunDescription
+ {
+ internal:
+ GlyphRunDescription(const DWRITE_GLYPH_RUN_DESCRIPTION &desc);
+
+ public:
+ property System::String^ LocaleName;
+ property System::String^ Text;
+ property int StringLength;
+ property array<short>^ ClusterMap;
+ property int TextPosition;
+ };
+ }
+}
=======================================
--- /dev/null
+++ /trunk/source/directwrite/ITextRenderer.cpp Fri Mar 2 11:05:32 2012
@@ -0,0 +1,199 @@
+/*
+* Copyright (c) 2007-2012 SlimDX Group
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
copy
+* of this software and associated documentation files (the "Software"), to
deal
+* in the Software without restriction, including without limitation the
rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+* THE SOFTWARE.
+*/
+#include "stdafx.h"
+
+#include "DirectWriteException.h"
+
+#include "ITextRenderer.h"
+
+const IID IID_IDWriteTextRenderer = __uuidof(IDWriteTextRenderer);
+
+using namespace System;
+
+namespace SlimDX
+{
+namespace DirectWrite
+{
+ ITextRendererShim *ITextRendererShim::CreateInstance(ITextRenderer
^wrappedInterface)
+ {
+ if (wrappedInterface == nullptr)
+ return NULL;
+
+ return new ITextRendererShim(wrappedInterface);
+ }
+
+ ITextRendererShim::ITextRendererShim(ITextRenderer ^wrappedInterface)
+ : m_WrappedInterface(wrappedInterface),
+ m_refCount(1)
+ {
+ }
+
+ HRESULT ITextRendererShim::QueryInterface(const IID &iid, LPVOID *ppv)
+ {
+ if (iid == IID_IDWriteTextRenderer)
+ {
+ AddRef();
+ *reinterpret_cast<IDWriteTextRenderer**>(ppv) = this;
+ return S_OK;
+ }
+
+ return E_NOTIMPL;
+ }
+
+ ULONG ITextRendererShim::AddRef()
+ {
+ return ++m_refCount;
+ }
+
+ ULONG ITextRendererShim::Release()
+ {
+ if (--m_refCount == 0)
+ {
+ delete this;
+ }
+ return m_refCount;
+ }
+
+ HRESULT ITextRendererShim::IsPixelSnappingDisabled(void*
clientDrawingContext, BOOL* isDisabled)
+ {
+ try
+ {
+ *isDisabled =
m_WrappedInterface->IsPixelSnappingDisabled(IntPtr(clientDrawingContext));
+ return S_OK;
+ }
+ catch(SlimDXException^ e)
+ {
+ return e->ResultCode.Code;
+ }
+ catch(...)
+ {
+ return E_FAIL;
+ }
+ }
+
+ HRESULT ITextRendererShim::GetCurrentTransform(void*
clientDrawingContext, DWRITE_MATRIX* transform)
+ {
+ try
+ {
+ Matrix3x2 result =
m_WrappedInterface->GetCurrentTransform(IntPtr(clientDrawingContext));
+ memcpy(transform, &result, sizeof(DWRITE_MATRIX));
+ return S_OK;
+ }
+ catch(SlimDXException^ e)
+ {
+ return e->ResultCode.Code;
+ }
+ catch(...)
+ {
+ return E_FAIL;
+ }
+ }
+
+ HRESULT ITextRendererShim::GetPixelsPerDip(void* clientDrawingContext,
FLOAT* pixelsPerDip)
+ {
+ try
+ {
+ *pixelsPerDip =
m_WrappedInterface->GetPixelsPerDip(IntPtr(clientDrawingContext));
+ return S_OK;
+ }
+ catch(SlimDXException^ e)
+ {
+ return e->ResultCode.Code;
+ }
+ catch(...)
+ {
+ return E_FAIL;
+ }
+ }
+
+ HRESULT ITextRendererShim::DrawGlyphRun(void* clientDrawingContext, FLOAT
baselineOriginX, FLOAT baselineOriginY, DWRITE_MEASURING_MODE
measuringMode, DWRITE_GLYPH_RUN const* glyphRun,
+ DWRITE_GLYPH_RUN_DESCRIPTION const* glyphRunDescription, IUnknown*
clientDrawingEffect)
+ {
+ try
+ {
+ Result result =
m_WrappedInterface->DrawGlyphRun(IntPtr(clientDrawingContext),
baselineOriginX, baselineOriginY, static_cast<MeasuringMode>(measuringMode),
+ gcnew GlyphRun(*glyphRun), gcnew
GlyphRunDescription(*glyphRunDescription), IntPtr(clientDrawingEffect));
+
+ return result.Code;
+ }
+ catch(SlimDXException^ e)
+ {
+ return e->ResultCode.Code;
+ }
+ catch(...)
+ {
+ return E_FAIL;
+ }
+ }
+
+ HRESULT ITextRendererShim::DrawUnderline(void* clientDrawingContext,
FLOAT baselineOriginX, FLOAT baselineOriginY, DWRITE_UNDERLINE const*
underline, IUnknown* clientDrawingEffect)
+ {
+ try
+ {
+ Result result =
m_WrappedInterface->DrawUnderline(IntPtr(clientDrawingContext),
baselineOriginX, baselineOriginY, gcnew Underline(*underline),
IntPtr(clientDrawingEffect));
+ return result.Code;
+ }
+ catch(SlimDXException^ e)
+ {
+ return e->ResultCode.Code;
+ }
+ catch(...)
+ {
+ return E_FAIL;
+ }
+ }
+
+ HRESULT ITextRendererShim::DrawStrikethrough(void* clientDrawingContext,
FLOAT baselineOriginX, FLOAT baselineOriginY, DWRITE_STRIKETHROUGH const*
strikethrough, IUnknown* clientDrawingEffect)
+ {
+ try
+ {
+ Result result =
m_WrappedInterface->DrawStrikethrough(IntPtr(clientDrawingContext),
baselineOriginX, baselineOriginY, gcnew Strikethrough(*strikethrough),
IntPtr(clientDrawingEffect));
+ return result.Code;
+ }
+ catch(SlimDXException^ e)
+ {
+ return e->ResultCode.Code;
+ }
+ catch(...)
+ {
+ return E_FAIL;
+ }
+ }
+
+ HRESULT ITextRendererShim::DrawInlineObject(void* clientDrawingContext,
FLOAT originX, FLOAT originY, IDWriteInlineObject* inlineObject, BOOL
isSideways, BOOL isRightToLeft, IUnknown* clientDrawingEffect)
+ {
+ try
+ {
+ Result result =
m_WrappedInterface->DrawInlineObject(IntPtr(clientDrawingContext), originX,
originY, InlineObject::FromPointer(inlineObject), isSideways != 0,
isRightToLeft != 0, IntPtr(clientDrawingEffect));
+ return result.Code;
+ }
+ catch(SlimDXException^ e)
+ {
+ return e->ResultCode.Code;
+ }
+ catch(...)
+ {
+ return E_FAIL;
+ }
+ }
+}
+}
=======================================
--- /dev/null
+++ /trunk/source/directwrite/ITextRenderer.h Fri Mar 2 11:05:32 2012
@@ -0,0 +1,119 @@
+/*
+* Copyright (c) 2007-2012 SlimDX Group
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
copy
+* of this software and associated documentation files (the "Software"), to
deal
+* in the Software without restriction, including without limitation the
rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+* THE SOFTWARE.
+*/
+#pragma once
+
+extern const IID IID_IDWriteTextRenderer;
+
+#include "../ComObject.h"
+#include "../math/Matrix3x2.h"
+
+#include "InlineObject.h"
+#include "Enums.h"
+#include "GlyphRunDW.h"
+#include "GlyphRunDescription.h"
+#include "Underline.h"
+#include "Strikethrough.h"
+
+namespace SlimDX
+{
+ namespace DirectWrite
+ {
+ public interface struct ITextRenderer
+ {
+ Matrix3x2 GetCurrentTransform(System::IntPtr drawingContext);
+ float GetPixelsPerDip(System::IntPtr drawingContext);
+ bool IsPixelSnappingDisabled(System::IntPtr drawingContext);
+
+ Result DrawGlyphRun(System::IntPtr drawingContext, float
baselineOriginX, float baselineOriginY, MeasuringMode measuringMode,
GlyphRun^ glyphRun, GlyphRunDescription^ glyphRunDescription,
System::IntPtr clientDrawingEffect);
+ Result DrawInlineObject(System::IntPtr drawingContext, float
baselineOriginX, float baselineOriginY, InlineObject^ inlineObject, bool
isSideways, bool isRightToLeft, System::IntPtr clientDrawingEffect);
+ Result DrawStrikethrough(System::IntPtr drawingContext, float
baselineOriginX, float baselineOriginY, Strikethrough^ strikethrough,
System::IntPtr clientDrawingEffect);
+ Result DrawUnderline(System::IntPtr drawingContext, float
baselineOriginX, float baselineOriginY, Underline^ underline,
System::IntPtr clientDrawingEffect);
+ };
+
+ class ITextRendererShim : public IDWriteTextRenderer
+ {
+ public:
+ static ITextRendererShim *CreateInstance(ITextRenderer
^wrappedInterface);
+
+ STDMETHOD(QueryInterface)(REFIID riid, void **ppvObject);
+ STDMETHOD_(ULONG, AddRef)();
+ STDMETHOD_(ULONG, Release)();
+
+ STDMETHOD(IsPixelSnappingDisabled)(
+ void* clientDrawingContext,
+ BOOL* isDisabled
+ );
+
+ STDMETHOD(GetCurrentTransform)(
+ void* clientDrawingContext,
+ DWRITE_MATRIX* transform
+ );
+
+ STDMETHOD(GetPixelsPerDip)(
+ void* clientDrawingContext,
+ FLOAT* pixelsPerDip
+ );
+
+ STDMETHOD(DrawGlyphRun)(
+ void* clientDrawingContext,
+ FLOAT baselineOriginX,
+ FLOAT baselineOriginY,
+ DWRITE_MEASURING_MODE measuringMode,
+ DWRITE_GLYPH_RUN const* glyphRun,
+ DWRITE_GLYPH_RUN_DESCRIPTION const* glyphRunDescription,
+ IUnknown* clientDrawingEffect
+ );
+
+ STDMETHOD(DrawUnderline)(
+ void* clientDrawingContext,
+ FLOAT baselineOriginX,
+ FLOAT baselineOriginY,
+ DWRITE_UNDERLINE const* underline,
+ IUnknown* clientDrawingEffect
+ );
+
+ STDMETHOD(DrawStrikethrough)(
+ void* clientDrawingContext,
+ FLOAT baselineOriginX,
+ FLOAT baselineOriginY,
+ DWRITE_STRIKETHROUGH const* strikethrough,
+ IUnknown* clientDrawingEffect
+ );
+
+ STDMETHOD(DrawInlineObject)(
+ void* clientDrawingContext,
+ FLOAT originX,
+ FLOAT originY,
+ IDWriteInlineObject* inlineObject,
+ BOOL isSideways,
+ BOOL isRightToLeft,
+ IUnknown* clientDrawingEffect
+ );
+
+ private:
+ ITextRendererShim(ITextRenderer ^wrappedInterface);
+
+ int m_refCount;
+ gcroot<ITextRenderer ^> m_WrappedInterface;
+ };
+ }
+}
=======================================
--- /dev/null
+++ /trunk/source/directwrite/Strikethrough.cpp Fri Mar 2 11:05:32 2012
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2007-2012 SlimDX Group
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
copy
+* of this software and associated documentation files (the "Software"), to
deal
+* in the Software without restriction, including without limitation the
rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+* THE SOFTWARE.
+*/
+#include "stdafx.h"
+
+#include "Strikethrough.h"
+
+using namespace System;
+
+namespace SlimDX
+{
+namespace DirectWrite
+{
+ Strikethrough::Strikethrough(const DWRITE_STRIKETHROUGH &strikethrough)
+ {
+ Width = strikethrough.width;
+ Thickness = strikethrough.thickness;
+ Offset = strikethrough.offset;
+ ReadingDirection =
static_cast<DirectWrite::ReadingDirection>(strikethrough.readingDirection);
+ FlowDirection =
static_cast<DirectWrite::FlowDirection>(strikethrough.flowDirection);
+ LocaleName = gcnew String(strikethrough.localeName);
+ MeasuringMode =
static_cast<DirectWrite::MeasuringMode>(strikethrough.measuringMode);
+ }
+}
+}
=======================================
--- /dev/null
+++ /trunk/source/directwrite/Strikethrough.h Fri Mar 2 11:05:32 2012
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2007-2012 SlimDX Group
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
copy
+* of this software and associated documentation files (the "Software"), to
deal
+* in the Software without restriction, including without limitation the
rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+* THE SOFTWARE.
+*/
+#pragma once
+
+#include "Enums.h"
+
+namespace SlimDX
+{
+ namespace DirectWrite
+ {
+ public ref class Strikethrough
+ {
+ internal:
+ Strikethrough(const DWRITE_STRIKETHROUGH &strikethrough);
+
+ public:
+ property float Width;
+ property float Thickness;
+ property float Offset;
+ property ReadingDirection ReadingDirection;
+ property FlowDirection FlowDirection;
+ property System::String^ LocaleName;
+ property MeasuringMode MeasuringMode;
+ };
+ }
+}
=======================================
--- /dev/null
+++ /trunk/source/directwrite/Underline.cpp Fri Mar 2 11:05:32 2012
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2007-2012 SlimDX Group
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
copy
+* of this software and associated documentation files (the "Software"), to
deal
+* in the Software without restriction, including without limitation the
rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+* THE SOFTWARE.
+*/
+#include "stdafx.h"
+
+#include "Underline.h"
+
+using namespace System;
+
+namespace SlimDX
+{
+namespace DirectWrite
+{
+ Underline::Underline(const DWRITE_UNDERLINE &underline)
+ {
+ Width = underline.width;
+ Thickness = underline.thickness;
+ Offset = underline.offset;
+ RunHeight = underline.runHeight;
+ ReadingDirection =
static_cast<DirectWrite::ReadingDirection>(underline.readingDirection);
+ FlowDirection =
static_cast<DirectWrite::FlowDirection>(underline.flowDirection);
+ LocaleName = gcnew String(underline.localeName);
+ MeasuringMode =
static_cast<DirectWrite::MeasuringMode>(underline.measuringMode);
+ }
+}
+}
=======================================
--- /dev/null
+++ /trunk/source/directwrite/Underline.h Fri Mar 2 11:05:32 2012
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2007-2012 SlimDX Group
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
copy
+* of this software and associated documentation files (the "Software"), to
deal
+* in the Software without restriction, including without limitation the
rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+* THE SOFTWARE.
+*/
+#pragma once
+
+#include "Enums.h"
+
+namespace SlimDX
+{
+ namespace DirectWrite
+ {
+ public ref class Underline
+ {
+ internal:
+ Underline(const DWRITE_UNDERLINE &underline);
+
+ public:
+ property float Width;
+ property float Thickness;
+ property float Offset;
+ property float RunHeight;
+ property ReadingDirection ReadingDirection;
+ property FlowDirection FlowDirection;
+ property System::String^ LocaleName;
+ property MeasuringMode MeasuringMode;
+ };
+ }
+}
=======================================
--- /trunk/source/directwrite/TextRenderer.cpp Sat Jan 28 10:03:11 2012
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
-* Copyright (c) 2007-2012 SlimDX Group
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
copy
-* of this software and associated documentation files (the "Software"), to
deal
-* in the Software without restriction, including without limitation the
rights
-* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-* copies of the Software, and to permit persons to whom the Software is
-* furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
in
-* all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE
-* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM,
-* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-* THE SOFTWARE.
-*/
-#include "stdafx.h"
-
-#include "DirectWriteException.h"
-
-#include "TextRenderer.h"
-
-const IID IID_IDWriteTextRenderer = __uuidof(IDWriteTextRenderer);
-
-using namespace System;
-
-namespace SlimDX
-{
-namespace DirectWrite
-{
-}
-}
=======================================
--- /trunk/source/directwrite/TextRenderer.h Sat Jan 28 10:03:11 2012
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
-* Copyright (c) 2007-2012 SlimDX Group
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
copy
-* of this software and associated documentation files (the "Software"), to
deal
-* in the Software without restriction, including without limitation the
rights
-* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-* copies of the Software, and to permit persons to whom the Software is
-* furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
in
-* all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE
-* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM,
-* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-* THE SOFTWARE.
-*/
-#pragma once
-
-extern const IID IID_IDWriteTextRenderer;
-
-#include "../ComObject.h"
-
-namespace SlimDX
-{
- namespace DirectWrite
- {
- public ref class TextRenderer : public ComObject
- {
- COMOBJECT(IDWriteTextRenderer, TextRenderer);
- };
- }
-}
=======================================
--- /trunk/build/ReleaseNotes.txt Sun Jan 1 10:03:31 2012
+++ /trunk/build/ReleaseNotes.txt Fri Mar 2 11:05:32 2012
@@ -1,20 +1,3 @@
-Samples
- * Fixed a UI rendering bug in the SampleFramework.
-
-DXGI
- * Added missing result code.
-
-Direct3D 9
- * Fixed pinning of UVAtlas callbacks.
- * Fixed a bug in AnimationController.GetAnimationSet that failed for base
animation sets.
-
-Direct3D 10
- * Fixed bug in Get/Set of bool arrays in EffectScalarVariable.
- * EffectResourceVariable now allows clearing an array of resources.
-
-Direct3D 11
- * Added missing UnorderedAccessViewBufferFlags flag.
- * Removed invalid range checks from FFT AttachBuffersAndPrecompute
- * Added overloads to EffectVectorVariable.Set for int and bool vectors.
- * Fixed bug in Get/Set of bool arrays in EffectScalarVariable.
- * EffectResourceVariable now allows clearing an array of resources.
+DirectWrite
+ * Changed TextRenderer into ITextRenderer to allow user implementation.
+ * Added Strikethrough and Underline classes
=======================================
--- /trunk/build/SlimDX.vcxproj Sat Feb 4 15:26:17 2012
+++ /trunk/build/SlimDX.vcxproj Fri Mar 2 11:05:32 2012
@@ -758,6 +758,10 @@
<ClCompile Include="..\source\direct3d9\PresentStatistics.cpp" />
<ClCompile Include="..\source\direct3d9\SwapChainEx.cpp" />
<ClCompile Include="..\source\directinput\RawBufferedData.cpp" />
+ <ClCompile Include="..\source\directwrite\GlyphRunDescription.cpp" />
+ <ClCompile Include="..\source\directwrite\ITextRenderer.cpp" />
+ <ClCompile Include="..\source\directwrite\Strikethrough.cpp" />
+ <ClCompile Include="..\source\directwrite\Underline.cpp" />
<ClCompile Include="..\source\multimedia\AdpcmWaveFormat.cpp" />
<ClCompile Include="..\source\multimedia\XWMAStream.cpp" />
<ClCompile Include="..\source\ObjectTable.cpp" />
@@ -1149,7 +1153,6 @@
<ClCompile Include="..\source\directwrite\TextAnalysisSource.cpp" />
<ClCompile Include="..\source\directwrite\TextAnalyzer.cpp" />
<ClCompile Include="..\source\directwrite\TextRange.cpp" />
- <ClCompile Include="..\source\directwrite\TextRenderer.cpp" />
<ClCompile Include="..\source\directwrite\TextFormat.cpp" />
<ClCompile Include="..\source\directwrite\TextLayout.cpp" />
<ClCompile Include="..\source\directwrite\LocalizedStrings.cpp" />
@@ -1440,6 +1443,10 @@
<ClInclude Include="..\source\direct3d9\PresentStatistics.h" />
<ClInclude Include="..\source\direct3d9\SwapChainEx.h" />
<ClInclude Include="..\source\directinput\RawBufferedData.h" />
+ <ClInclude Include="..\source\directwrite\GlyphRunDescription.h" />
+ <ClInclude Include="..\source\directwrite\ITextRenderer.h" />
+ <ClInclude Include="..\source\directwrite\Strikethrough.h" />
+ <ClInclude Include="..\source\directwrite\Underline.h" />
<ClInclude Include="..\source\Enums.h" />
<ClInclude Include="..\source\InternalHelpers.h" />
<ClInclude Include="..\source\multimedia\AdpcmWaveFormat.h" />
@@ -1881,7 +1888,6 @@
<ClInclude Include="..\source\directwrite\TextAnalysisSource.h" />
<ClInclude Include="..\source\directwrite\TextAnalyzer.h" />
<ClInclude Include="..\source\directwrite\TextRange.h" />
- <ClInclude Include="..\source\directwrite\TextRenderer.h" />
<ClInclude Include="..\source\directwrite\TextFormat.h" />
<ClInclude Include="..\source\directwrite\Trimming.h" />
<ClInclude Include="..\source\directwrite\ClusterMetrics.h" />
=======================================
--- /trunk/build/SlimDX.vcxproj.filters Mon Jun 13 21:41:59 2011
+++ /trunk/build/SlimDX.vcxproj.filters Fri Mar 2 11:05:32 2012
@@ -2280,9 +2280,6 @@
<ClCompile Include="..\source\directwrite\TextRange.cpp">
<Filter>DirectWrite\Text</Filter>
</ClCompile>
- <ClCompile Include="..\source\directwrite\TextRenderer.cpp">
- <Filter>DirectWrite\Text</Filter>
- </ClCompile>
<ClCompile Include="..\source\directwrite\TextFormat.cpp">
<Filter>DirectWrite\Text\TextFormat</Filter>
</ClCompile>
@@ -2779,6 +2776,18 @@
<ClCompile Include="..\source\multimedia\AdpcmWaveFormat.cpp">
<Filter>Multimedia\WaveFormat</Filter>
</ClCompile>
+ <ClCompile Include="..\source\directwrite\ITextRenderer.cpp">
+ <Filter>DirectWrite\Text</Filter>
+ </ClCompile>
+ <ClCompile Include="..\source\directwrite\GlyphRunDescription.cpp">
+ <Filter>DirectWrite\Glyphs</Filter>
+ </ClCompile>
+ <ClCompile Include="..\source\directwrite\Strikethrough.cpp">
+ <Filter>DirectWrite</Filter>
+ </ClCompile>
+ <ClCompile Include="..\source\directwrite\Underline.cpp">
+ <Filter>DirectWrite</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\source\direct3d10\Direct3D10Exception.h">
@@ -4395,9 +4404,6 @@
<ClInclude Include="..\source\directwrite\TextRange.h">
<Filter>DirectWrite\Text</Filter>
</ClInclude>
- <ClInclude Include="..\source\directwrite\TextRenderer.h">
- <Filter>DirectWrite\Text</Filter>
- </ClInclude>
<ClInclude Include="..\source\directwrite\TextFormat.h">
<Filter>DirectWrite\Text\TextFormat</Filter>
</ClInclude>
@@ -4924,6 +4930,18 @@
<ClInclude Include="..\source\multimedia\AdpcmWaveFormat.h">
<Filter>Multimedia\WaveFormat</Filter>
</ClInclude>
+ <ClInclude Include="..\source\directwrite\ITextRenderer.h">
+ <Filter>DirectWrite\Text</Filter>
+ </ClInclude>
+ <ClInclude Include="..\source\directwrite\GlyphRunDescription.h">
+ <Filter>DirectWrite\Glyphs</Filter>
+ </ClInclude>
+ <ClInclude Include="..\source\directwrite\Strikethrough.h">
+ <Filter>DirectWrite</Filter>
+ </ClInclude>
+ <ClInclude Include="..\source\directwrite\Underline.h">
+ <Filter>DirectWrite</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources.resx">
=======================================
--- /trunk/source/directwrite/GlyphRunDW.cpp Sat Jan 28 10:03:11 2012
+++ /trunk/source/directwrite/GlyphRunDW.cpp Fri Mar 2 11:05:32 2012
@@ -31,6 +31,27 @@
{
namespace DirectWrite
{
+ GlyphRun::GlyphRun(const DWRITE_GLYPH_RUN &run)
+ {
+ FontFace = DirectWrite::FontFace::FromPointer(run.fontFace);
+ FontSize = run.fontEmSize;
+ GlyphCount = run.glyphCount;
+ IsSideways = run.isSideways != 0;
+ BidiLevel = run.bidiLevel;
+
+ GlyphIndices = gcnew array<short>(GlyphCount);
+ GlyphAdvances = gcnew array<float>(GlyphCount);
+ GlyphOffsets = gcnew array<GlyphOffset>(GlyphCount);
+
+ for (int i = 0; i < GlyphCount; i++)
+ {
+ GlyphIndices[i] = run.glyphIndices[i];
+ GlyphAdvances[i] = run.glyphAdvances[i];
+ GlyphOffsets[i].AdvanceOffset = run.glyphOffsets[i].advanceOffset;
+ GlyphOffsets[i].AscenderOffset = run.glyphOffsets[i].ascenderOffset;
+ }
+ }
+
DWRITE_GLYPH_RUN GlyphRun::ToUnmanaged(stack_array<UINT16> &indices,
stack_array<FLOAT> &advances, stack_array<DWRITE_GLYPH_OFFSET> &offsets)
{
DWRITE_GLYPH_RUN result;
=======================================
--- /trunk/source/directwrite/GlyphRunDW.h Sat Jan 28 10:03:11 2012
+++ /trunk/source/directwrite/GlyphRunDW.h Fri Mar 2 11:05:32 2012
@@ -35,8 +35,11 @@
{
internal:
DWRITE_GLYPH_RUN ToUnmanaged(stack_array<UINT16> &indices,
stack_array<FLOAT> &advances, stack_array<DWRITE_GLYPH_OFFSET> &offsets);
+ GlyphRun(const DWRITE_GLYPH_RUN &run);
public:
+ GlyphRun() { }
+
property FontFace^ FontFace;
property float FontSize;
property int GlyphCount;
=======================================
--- /trunk/source/directwrite/InlineObject.cpp Sat Jan 28 10:03:11 2012
+++ /trunk/source/directwrite/InlineObject.cpp Fri Mar 2 11:05:32 2012
@@ -24,7 +24,7 @@
#include "DirectWriteException.h"
#include "IClientDrawingEffect.h"
#include "InlineObject.h"
-#include "TextRenderer.h"
+#include "ITextRenderer.h"
const IID IID_IDWriteInlineObject = __uuidof(IDWriteInlineObject);
@@ -34,15 +34,20 @@
{
namespace DirectWrite
{
- Result InlineObject::Draw(IntPtr clientDrawingContext, TextRenderer
^renderer,
+ Result InlineObject::Draw(IntPtr clientDrawingContext, ITextRenderer
^renderer,
float originX, float originY, bool isSideways, bool isRightToLeft,
IClientDrawingEffect ^clientDrawingEffect)
{
IUnknown *nativeClientDrawingEffect = clientDrawingEffect == nullptr ?
0 :
reinterpret_cast<IUnknown*>(clientDrawingEffect->ComPointer.ToPointer());
void *nativeClientDrawingContext = static_cast<void
*>(clientDrawingContext);
- return RECORD_DW(InternalPointer->Draw(nativeClientDrawingContext,
renderer->InternalPointer,
- originX, originY, isSideways ? TRUE : FALSE, isRightToLeft ? TRUE :
FALSE,
- nativeClientDrawingEffect));
+
+ ITextRendererShim *shim = ITextRendererShim::CreateInstance(renderer);
+
+ HRESULT hr = InternalPointer->Draw(nativeClientDrawingContext, shim,
+ originX, originY, isSideways ? TRUE : FALSE, isRightToLeft ? TRUE :
FALSE, nativeClientDrawingEffect);
+
+ shim->Release();
+ return RECORD_DW(hr);
}
Result InlineObject::GetBreakConditions([Out] BreakCondition %before,
[Out] BreakCondition %after)
=======================================
--- /trunk/source/directwrite/InlineObject.h Sat Jan 28 10:03:11 2012
+++ /trunk/source/directwrite/InlineObject.h Fri Mar 2 11:05:32 2012
@@ -32,7 +32,7 @@
{
namespace DirectWrite
{
- ref class TextRenderer;
+ interface struct ITextRenderer;
interface struct IClientDrawingEffect;
public ref class InlineObject : public ComObject
@@ -40,7 +40,7 @@
COMOBJECT(IDWriteInlineObject, InlineObject);
public:
- Result Draw(System::IntPtr clientDrawingContext, TextRenderer ^renderer,
+ Result Draw(System::IntPtr clientDrawingContext, ITextRenderer
^renderer,
float originX, float originY, bool isSideways, bool isRightToLeft,
IClientDrawingEffect ^clientDrawingEffect);
Result GetBreakConditions([Out] BreakCondition %before, [Out]
BreakCondition %after);
=======================================
--- /trunk/source/directwrite/TextLayout.cpp Sat Jan 28 10:03:11 2012
+++ /trunk/source/directwrite/TextLayout.cpp Fri Mar 2 11:05:32 2012
@@ -29,7 +29,7 @@
#include "OverhangMetrics.h"
#include "TextLayout.h"
#include "TextMetrics.h"
-#include "TextRenderer.h"
+#include "ITextRenderer.h"
const IID IID_IDWriteTextLayout = __uuidof(IDWriteTextLayout);
@@ -68,9 +68,14 @@
return minWidth;
}
- Result TextLayout::Draw(IntPtr clientDrawingContext, TextRenderer
^renderer, float originX, float originY)
- {
- return RECORD_DW(InternalPointer->Draw(static_cast<void
*>(clientDrawingContext), renderer->InternalPointer, originX, originY));
+ Result TextLayout::Draw(IntPtr clientDrawingContext, ITextRenderer
^renderer, float originX, float originY)
+ {
+ ITextRendererShim *shim = ITextRendererShim::CreateInstance(renderer);
+
+ HRESULT hr = InternalPointer->Draw(static_cast<void
*>(clientDrawingContext), shim, originX, originY);
+ shim->Release();
+
+ return RECORD_DW(hr);
}
HitTestMetrics TextLayout::HitTestPoint( float pointX, float pointY,
[Out] bool% isTrailingHit, [Out] bool% isInside )
=======================================
--- /trunk/source/directwrite/TextLayout.h Sat Jan 28 10:03:11 2012
+++ /trunk/source/directwrite/TextLayout.h Fri Mar 2 11:05:32 2012
@@ -40,7 +40,7 @@
value class OverhangMetrics;
value class TextMetrics;
ref class InlineObject;
- ref class TextRenderer;
+ interface struct ITextRenderer;
interface struct IClientDrawingEffect;
public ref class TextLayout : public TextFormat
@@ -54,7 +54,7 @@
TextLayout( Factory^ factory, String^ text, TextFormat^ format, float
maxWidth, float maxHeight );
float DetermineMinWidth();
- Result Draw(IntPtr clientDrawingContext, TextRenderer ^renderer, float
originX, float originY);
+ Result Draw(IntPtr clientDrawingContext, ITextRenderer ^renderer, float
originX, float originY);
HitTestMetrics HitTestPoint( float pointX, float pointY, [Out] bool%
isTrailingHit, [Out] bool% isInside );
HitTestMetrics HitTestTextPosition( int textPosition, bool
isTrailingHit, [Out] float% pointX, [Out] float% pointY );
array< HitTestMetrics >^ HitTestTextRange( int textPosition, int
textLength, float originX, float originY );
=======================================
--- /trunk/source/directwrite/ToDo.txt Fri Jun 25 12:37:16 2010
+++ /trunk/source/directwrite/ToDo.txt Fri Mar 2 11:05:32 2012
@@ -11,8 +11,4 @@
IDWriteTextAnalysisSource (TextAnalysisSource)
The interface implemented by the text analyzer's client to provide text
to
the analyzer.
-IDWriteTextRenderer (TextRenderer)
- DWRITE_GLYPH_RUN_DESCRIPTION
- DWRITE_STRIKETHROUGH
- DWRITE_UNDERLINE
DWRITE_ALPHA_MAX