Exemplo n.º 1
0
        public void Add(byte[] ttf, float pixel_height, IEnumerable <FontBakerCharacterRange> ranges)
        {
            var ttfPtr = new FakePtr <byte>(ttf);

            foreach (var range in ranges)
            {
                if (range.Start > range.End)
                {
                    continue;
                }

                var cd = new StbTrueType.stbtt_packedchar[range.End - range.Start + 1];
                for (var i = 0; i < cd.Length; ++i)
                {
                    cd[i] = new StbTrueType.stbtt_packedchar();
                }

                StbTrueType.stbtt_PackFontRange(pc, ttfPtr, 0, pixel_height, range.Start,
                                                range.End - range.Start + 1, new FakePtr <StbTrueType.stbtt_packedchar>(cd));

                for (var i = 0; i < cd.Length; ++i)
                {
                    result[(char)(i + range.Start)] = cd[i];
                }
            }
        }
Exemplo n.º 2
0
 public static void memset <T>(FakePtr <T> a, T value, long size) where T : new()
 {
     for (long i = 0; i < size; ++i)
     {
         a[i] = value;
     }
 }
Exemplo n.º 3
0
        public static void memmove <T>(FakePtr <T> a, FakePtr <T> b, long size) where T : new()
        {
            FakePtr <T> temp = FakePtr <T> .CreateWithSize(size);

            memcpy(temp, b, size);
            memcpy(a, temp, size);
        }
Exemplo n.º 4
0
 public static void memcpy <T>(FakePtr <T> a, FakePtr <T> b, long size) where T : new()
 {
     for (long i = 0; i < size; ++i)
     {
         a[i] = b[i];
     }
 }
Exemplo n.º 5
0
        public static int memcmp <T>(FakePtr <T> a, FakePtr <T> b, long size) where T : new()
        {
            var result = 0;

            for (long i = 0; i < size; ++i)
            {
                if (!a[i].Equals(b[i]))
                {
                    result += 1;
                }
            }

            return(result);
        }
Exemplo n.º 6
0
        public static ulong strlen(FakePtr <sbyte> str)
        {
            ulong result = 0;

            for (int i = 0; ;)
            {
                if (str[i] == '\0')
                {
                    result = (ulong)i;
                    break;
                }
            }

            return(result);
        }
Exemplo n.º 7
0
 public static void memset <T>(FakePtr <T> a, T value, ulong size) where T : new()
 {
     memset(a, value, (long)size);
 }
Exemplo n.º 8
0
 public static void free <T>(FakePtr <T> ptr) where T : new()
 {
     // Do nothing
 }
Exemplo n.º 9
0
 public static int memcmp <T>(FakePtr <T> a, FakePtr <T> b, ulong size) where T : new()
 {
     return(memcmp(a, b, (long)size));
 }
Exemplo n.º 10
0
 public static void memmove <T>(FakePtr <T> a, FakePtr <T> b, ulong size) where T : new()
 {
     memmove(a, b, (long)size);
 }