a font from an assembly into a memory font object.
The only thing I am stuck on is getting the actual memory size of a byte
array so that I can allocate the memory for the pointer..
Here's the code
'Load the font from the assembly
Public myFonts As New PrivateFontCollection()
Dim asm As [Assembly] = Me.GetType.Assembly
Dim stm As Stream =
asm.GetManifestResourceStream("CreativeTools.FtraB k__.ttf")
Dim buffer(Convert.ToInt32(stm.Length)) As Byte
stm.Read(buffer, 0, Convert.ToInt32(stm.Length))
Dim pi As IntPtr = Marshal.AllocHGlobal(Marshal.SizeOf(byte) *
buffer.Length) <<
Marshal.Copy(buffer, 0, pi, buffer.Length)
myFonts.AddMemoryFont(pi, buffer.Length)
Marshal.FreeHGlobal(pi)
--
The line I am having problems with is the
Dim pi As IntPtr = Marshal.AllocHGlobal(Marshal.SizeOf(byte) *
buffer.Length)
I have tried
Dim pi As IntPtr = Marshal.AllocHGlobal(Marshal.SizeOf(buffer) *
buffer.Length)
Dim pi As IntPtr = Marshal.AllocHGlobal(Marshal.SizeOf(buffer.getType ) *
buffer.Length)
Dim pi As IntPtr = Marshal.AllocHGlobal(Marshal.SizeOf( buffer.Length) )
Dim pi As IntPtr = Marshal.AllocHGlobal(Marshal.SizeOf(buffer)
Dim pi As IntPtr = Marshal.AllocHGlobal(Marshal.SizeOf([Byte]) *
buffer.Length)
All to no avail! So how do I get the memory size of a byte array??
Any help would be greatly appreciated
All the best,
Jon