Пример #1
0
            public PaduakDisposableTestSegment(string testData)
            {
                _font     = new PaduakDisposableFont();
                _testData = Marshal.StringToCoTaskMemAnsi(testData);
                IntPtr error         = new IntPtr(0);
                int    numCodePoints = Graphite2Api.CountUnicodeCharacters(Encform.Utf8, _testData, IntPtr.Zero, ref error);

                Seg = Graphite2Api.MakeSeg(_font.Font, _font.Face, 0, IntPtr.Zero, Encform.Utf8, _testData, numCodePoints, 0);
            }
Пример #2
0
        public void MakeSeg_WithTestStringAndPaduakFont_ReturnsNonNullSegment()
        {
            using (var font = new PaduakDisposableFont())
            {
                IntPtr str           = Marshal.StringToCoTaskMemAnsi("hello world");
                IntPtr error         = new IntPtr(0);
                int    numCodePoints = Graphite2Api.CountUnicodeCharacters(Encform.Utf8, str, IntPtr.Zero, ref error);
                IntPtr seg           = Graphite2Api.MakeSeg(font.Font, font.Face, 0, IntPtr.Zero, Encform.Utf8, str, numCodePoints, 0);
                Assert.AreNotEqual(IntPtr.Zero, seg);

                Graphite2Api.SegDestroy(seg);
                Marshal.FreeCoTaskMem(str);
            }
        }