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]; } } }
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; } }
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); }
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]; } }
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); }
public static ulong strlen(FakePtr <sbyte> str) { ulong result = 0; for (int i = 0; ;) { if (str[i] == '\0') { result = (ulong)i; break; } } return(result); }
public static void memset <T>(FakePtr <T> a, T value, ulong size) where T : new() { memset(a, value, (long)size); }
public static void free <T>(FakePtr <T> ptr) where T : new() { // Do nothing }
public static int memcmp <T>(FakePtr <T> a, FakePtr <T> b, ulong size) where T : new() { return(memcmp(a, b, (long)size)); }
public static void memmove <T>(FakePtr <T> a, FakePtr <T> b, ulong size) where T : new() { memmove(a, b, (long)size); }