Skip to content

Commit c61fbca

Browse files
authored
Merge pull request #144 from manju-summoner/FixCustomTextRenderer
Fix custom text renderer
2 parents 8a587f8 + c60b0cd commit c61fbca

File tree

4 files changed

+308
-0
lines changed

4 files changed

+308
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Copyright (c) Amer Koleci and contributors.
2+
// Distributed under the MIT license. See the LICENSE file in the project root for more information.
3+
4+
using SharpGen.Runtime;
5+
6+
namespace Vortice.DirectWrite
7+
{
8+
[Shadow(typeof(IDWriteTextRendererShadow))]
9+
partial interface IDWriteTextRenderer
10+
{
11+
}
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Copyright (c) Amer Koleci and contributors.
2+
// Distributed under the MIT license. See the LICENSE file in the project root for more information.
3+
4+
using SharpGen.Runtime;
5+
6+
namespace Vortice.DirectWrite
7+
{
8+
[Shadow(typeof(IDWriteTextRenderer1Shadow))]
9+
partial interface IDWriteTextRenderer1
10+
{
11+
}
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
// Copyright (c) Amer Koleci and contributors.
2+
// Distributed under the MIT license. See the LICENSE file in the project root for more information.
3+
4+
namespace Vortice.DirectWrite
5+
{
6+
partial class IDWriteTextRenderer1Shadow : Vortice.DirectWrite.IDWriteTextRendererShadow
7+
{
8+
protected internal unsafe partial class IDWriteTextRenderer1Vtbl : Vortice.DirectWrite.IDWriteTextRendererShadow.IDWriteTextRendererVtbl
9+
{
10+
public IDWriteTextRenderer1Vtbl(int numberOfCallbackMethods) : base(numberOfCallbackMethods + 4)
11+
{
12+
AddMethod(new DrawGlyphRunDelegate_(DrawGlyphRun_), 10);
13+
AddMethod(new DrawUnderlineDelegate_(DrawUnderline_), 11);
14+
AddMethod(new DrawStrikethroughDelegate_(DrawStrikethrough_), 12);
15+
AddMethod(new DrawInlineObjectDelegate_(DrawInlineObject_), 13);
16+
}
17+
18+
[System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute(System.Runtime.InteropServices.CallingConvention.StdCall)]
19+
private delegate int DrawGlyphRunDelegate_(System.IntPtr thisObject, void* _clientDrawingContext, float _baselineOriginX, float _baselineOriginY, int _orientationAngle, int _measuringMode, void* _glyphRun, void* _glyphRunDescription, void* _clientDrawingEffect);
20+
private static unsafe int DrawGlyphRun_(System.IntPtr thisObject, void* _clientDrawingContext, float _baselineOriginX, float _baselineOriginY, int _orientationAngle, int _measuringMode, void* _glyphRun, void* _glyphRunDescription, void* _clientDrawingEffect)
21+
{
22+
try
23+
{
24+
System.IntPtr clientDrawingContext = (System.IntPtr)_clientDrawingContext;
25+
float baselineOriginX = (float)_baselineOriginX;
26+
float baselineOriginY = (float)_baselineOriginY;
27+
Vortice.DirectWrite.GlyphOrientationAngle orientationAngle = (Vortice.DirectWrite.GlyphOrientationAngle)_orientationAngle;
28+
Vortice.DCommon.MeasuringMode measuringMode = (Vortice.DCommon.MeasuringMode)_measuringMode;
29+
ref Vortice.DirectWrite.GlyphRun.__Native glyphRun_ = ref System.Runtime.CompilerServices.Unsafe.AsRef<Vortice.DirectWrite.GlyphRun.__Native>(_glyphRun);
30+
Vortice.DirectWrite.GlyphRun glyphRun;
31+
ref Vortice.DirectWrite.GlyphRunDescription.__Native glyphRunDescription_ = ref System.Runtime.CompilerServices.Unsafe.AsRef<Vortice.DirectWrite.GlyphRunDescription.__Native>(_glyphRunDescription);
32+
Vortice.DirectWrite.GlyphRunDescription glyphRunDescription = default;
33+
SharpGen.Runtime.IUnknown clientDrawingEffect = default;
34+
System.IntPtr clientDrawingEffect_ = (System.IntPtr)_clientDrawingEffect;
35+
IDWriteTextRenderer1 @this = (IDWriteTextRenderer1)ToShadow<Vortice.DirectWrite.IDWriteTextRenderer1Shadow>(thisObject).Callback;
36+
{
37+
glyphRun = new Vortice.DirectWrite.GlyphRun();
38+
glyphRun.__MarshalFrom(ref glyphRun_);
39+
}
40+
41+
glyphRunDescription.__MarshalFrom(ref glyphRunDescription_);
42+
clientDrawingEffect = clientDrawingEffect_ != System.IntPtr.Zero ? new SharpGen.Runtime.ComObject(clientDrawingEffect_) : null;
43+
@this.DrawGlyphRun(clientDrawingContext, baselineOriginX, baselineOriginY, orientationAngle, measuringMode, glyphRun, ref glyphRunDescription, clientDrawingEffect);
44+
return SharpGen.Runtime.Result.Ok.Code;
45+
}
46+
catch (System.Exception __exception__)
47+
{
48+
IDWriteTextRenderer1 @this = (IDWriteTextRenderer1)ToShadow<Vortice.DirectWrite.IDWriteTextRenderer1Shadow>(thisObject).Callback;
49+
(@this as SharpGen.Runtime.IExceptionCallback)?.RaiseException(__exception__);
50+
return SharpGen.Runtime.Result.GetResultFromException(__exception__).Code;
51+
}
52+
}
53+
54+
[System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute(System.Runtime.InteropServices.CallingConvention.StdCall)]
55+
private delegate int DrawUnderlineDelegate_(System.IntPtr thisObject, void* _clientDrawingContext, float _baselineOriginX, float _baselineOriginY, int _orientationAngle, void* _underline, void* _clientDrawingEffect);
56+
private static unsafe int DrawUnderline_(System.IntPtr thisObject, void* _clientDrawingContext, float _baselineOriginX, float _baselineOriginY, int _orientationAngle, void* _underline, void* _clientDrawingEffect)
57+
{
58+
try
59+
{
60+
System.IntPtr clientDrawingContext = (System.IntPtr)_clientDrawingContext;
61+
float baselineOriginX = (float)_baselineOriginX;
62+
float baselineOriginY = (float)_baselineOriginY;
63+
Vortice.DirectWrite.GlyphOrientationAngle orientationAngle = (Vortice.DirectWrite.GlyphOrientationAngle)_orientationAngle;
64+
ref Vortice.DirectWrite.Underline.__Native underline_ = ref System.Runtime.CompilerServices.Unsafe.AsRef<Vortice.DirectWrite.Underline.__Native>(_underline);
65+
Vortice.DirectWrite.Underline underline = default;
66+
SharpGen.Runtime.IUnknown clientDrawingEffect = default;
67+
System.IntPtr clientDrawingEffect_ = (System.IntPtr)_clientDrawingEffect;
68+
IDWriteTextRenderer1 @this = (IDWriteTextRenderer1)ToShadow<Vortice.DirectWrite.IDWriteTextRenderer1Shadow>(thisObject).Callback;
69+
underline.__MarshalFrom(ref underline_);
70+
clientDrawingEffect = clientDrawingEffect_ != System.IntPtr.Zero ? new SharpGen.Runtime.ComObject(clientDrawingEffect_) : null;
71+
@this.DrawUnderline(clientDrawingContext, baselineOriginX, baselineOriginY, orientationAngle, ref underline, clientDrawingEffect);
72+
return SharpGen.Runtime.Result.Ok.Code;
73+
}
74+
catch (System.Exception __exception__)
75+
{
76+
IDWriteTextRenderer1 @this = (IDWriteTextRenderer1)ToShadow<Vortice.DirectWrite.IDWriteTextRenderer1Shadow>(thisObject).Callback;
77+
(@this as SharpGen.Runtime.IExceptionCallback)?.RaiseException(__exception__);
78+
return SharpGen.Runtime.Result.GetResultFromException(__exception__).Code;
79+
}
80+
}
81+
82+
[System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute(System.Runtime.InteropServices.CallingConvention.StdCall)]
83+
private delegate int DrawStrikethroughDelegate_(System.IntPtr thisObject, void* _clientDrawingContext, float _baselineOriginX, float _baselineOriginY, int _orientationAngle, void* _strikethrough, void* _clientDrawingEffect);
84+
private static unsafe int DrawStrikethrough_(System.IntPtr thisObject, void* _clientDrawingContext, float _baselineOriginX, float _baselineOriginY, int _orientationAngle, void* _strikethrough, void* _clientDrawingEffect)
85+
{
86+
try
87+
{
88+
System.IntPtr clientDrawingContext = (System.IntPtr)_clientDrawingContext;
89+
float baselineOriginX = (float)_baselineOriginX;
90+
float baselineOriginY = (float)_baselineOriginY;
91+
Vortice.DirectWrite.GlyphOrientationAngle orientationAngle = (Vortice.DirectWrite.GlyphOrientationAngle)_orientationAngle;
92+
ref Vortice.DirectWrite.Strikethrough.__Native strikethrough_ = ref System.Runtime.CompilerServices.Unsafe.AsRef<Vortice.DirectWrite.Strikethrough.__Native>(_strikethrough);
93+
Vortice.DirectWrite.Strikethrough strikethrough = default;
94+
SharpGen.Runtime.IUnknown clientDrawingEffect = default;
95+
System.IntPtr clientDrawingEffect_ = (System.IntPtr)_clientDrawingEffect;
96+
IDWriteTextRenderer1 @this = (IDWriteTextRenderer1)ToShadow<Vortice.DirectWrite.IDWriteTextRenderer1Shadow>(thisObject).Callback;
97+
strikethrough.__MarshalFrom(ref strikethrough_);
98+
clientDrawingEffect = clientDrawingEffect_ != System.IntPtr.Zero ? new SharpGen.Runtime.ComObject(clientDrawingEffect_) : null;
99+
@this.DrawStrikethrough(clientDrawingContext, baselineOriginX, baselineOriginY, orientationAngle, ref strikethrough, clientDrawingEffect);
100+
return SharpGen.Runtime.Result.Ok.Code;
101+
}
102+
catch (System.Exception __exception__)
103+
{
104+
IDWriteTextRenderer1 @this = (IDWriteTextRenderer1)ToShadow<Vortice.DirectWrite.IDWriteTextRenderer1Shadow>(thisObject).Callback;
105+
(@this as SharpGen.Runtime.IExceptionCallback)?.RaiseException(__exception__);
106+
return SharpGen.Runtime.Result.GetResultFromException(__exception__).Code;
107+
}
108+
}
109+
110+
[System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute(System.Runtime.InteropServices.CallingConvention.StdCall)]
111+
private delegate int DrawInlineObjectDelegate_(System.IntPtr thisObject, void* _clientDrawingContext, float _originX, float _originY, int _orientationAngle, void* _inlineObject, SharpGen.Runtime.RawBool _isSideways, SharpGen.Runtime.RawBool _isRightToLeft, void* _clientDrawingEffect);
112+
private static unsafe int DrawInlineObject_(System.IntPtr thisObject, void* _clientDrawingContext, float _originX, float _originY, int _orientationAngle, void* _inlineObject, SharpGen.Runtime.RawBool _isSideways, SharpGen.Runtime.RawBool _isRightToLeft, void* _clientDrawingEffect)
113+
{
114+
try
115+
{
116+
System.IntPtr clientDrawingContext = (System.IntPtr)_clientDrawingContext;
117+
float originX = (float)_originX;
118+
float originY = (float)_originY;
119+
Vortice.DirectWrite.GlyphOrientationAngle orientationAngle = (Vortice.DirectWrite.GlyphOrientationAngle)_orientationAngle;
120+
Vortice.DirectWrite.IDWriteInlineObject inlineObject = default;
121+
System.IntPtr inlineObject_ = (System.IntPtr)_inlineObject;
122+
SharpGen.Runtime.RawBool isSideways = (SharpGen.Runtime.RawBool)_isSideways;
123+
SharpGen.Runtime.RawBool isRightToLeft = (SharpGen.Runtime.RawBool)_isRightToLeft;
124+
SharpGen.Runtime.IUnknown clientDrawingEffect = default;
125+
System.IntPtr clientDrawingEffect_ = (System.IntPtr)_clientDrawingEffect;
126+
IDWriteTextRenderer1 @this = (IDWriteTextRenderer1)ToShadow<Vortice.DirectWrite.IDWriteTextRenderer1Shadow>(thisObject).Callback;
127+
inlineObject = inlineObject_ != System.IntPtr.Zero ? new Vortice.DirectWrite.IDWriteInlineObjectNative(inlineObject_) : null;
128+
clientDrawingEffect = clientDrawingEffect_ != System.IntPtr.Zero ? new SharpGen.Runtime.ComObject(clientDrawingEffect_) : null;
129+
@this.DrawInlineObject(clientDrawingContext, originX, originY, orientationAngle, inlineObject, isSideways, isRightToLeft, clientDrawingEffect);
130+
return SharpGen.Runtime.Result.Ok.Code;
131+
}
132+
catch (System.Exception __exception__)
133+
{
134+
IDWriteTextRenderer1 @this = (IDWriteTextRenderer1)ToShadow<Vortice.DirectWrite.IDWriteTextRenderer1Shadow>(thisObject).Callback;
135+
(@this as SharpGen.Runtime.IExceptionCallback)?.RaiseException(__exception__);
136+
return SharpGen.Runtime.Result.GetResultFromException(__exception__).Code;
137+
}
138+
}
139+
}
140+
141+
private static readonly Vortice.DirectWrite.IDWriteTextRenderer1Shadow.IDWriteTextRenderer1Vtbl VtblInstance = new(0);
142+
protected override SharpGen.Runtime.CppObjectVtbl Vtbl => VtblInstance;
143+
}
144+
}

0 commit comments

Comments
 (0)