private static void LockFont(string folder, string filename, out IntPtr handle, out IntPtr addr, out int length) { try { NoesisFontProvider provider = NoesisFontProvider.instance; Value v; provider._fonts.TryGetValue(folder + "/" + filename, out v); if (v.font != null && v.font.content != null) { GCHandle h = GCHandle.Alloc(v.font.content, GCHandleType.Pinned); handle = GCHandle.ToIntPtr(h); addr = h.AddrOfPinnedObject(); length = v.font.content.Length; return; } } catch (Exception exception) { Error.UnhandledException(exception); } handle = IntPtr.Zero; addr = IntPtr.Zero; length = 0; }
private static void OpenFont(IntPtr cPtr, IntPtr stream, string folder, string id) { NoesisFontProvider provider = (NoesisFontProvider)Noesis.Extend.GetExtendInstance(cPtr); Value v; provider._fonts.TryGetValue(folder + "/" + id, out v); if (v.font != null && v.font.content != null) { Noesis_FontProviderCopyBuffer(cPtr, stream, v.font.content, v.font.content.Length); } }