Exemplo n.º 1
0
        public static stbtt__buf stbtt__new_buf(void *p, ulong size)
        {
            stbtt__buf r = new stbtt__buf();

            r.data   = (byte *)(p);
            r.size   = ((int)(size));
            r.cursor = (int)(0);
            return((stbtt__buf)(r));
        }
        public static stbtt__buf stbtt__new_buf(void *p, ulong size)
        {
            var r = new stbtt__buf();

            r.data   = (byte *)p;
            r.size   = (int)size;
            r.cursor = 0;
            return(r);
        }
Exemplo n.º 3
0
        public static void stbtt__dict_get_ints(stbtt__buf *b, int key, int outcount, uint *_out_)
        {
            int        i        = 0;
            stbtt__buf operands = (stbtt__buf)(stbtt__dict_get(b, (int)(key)));

            for (i = (int)(0); ((i) < (outcount)) && ((operands.cursor) < (operands.size)); i++)
            {
                _out_[i] = (uint)(stbtt__cff_int(&operands));
            }
        }
Exemplo n.º 4
0
        public static void stbtt__dict_get_ints(stbtt__buf b, int key, int outcount, ref uint _out_)
        {
            int        i;
            stbtt__buf operands = stbtt__dict_get(b, key);

            for (i = (int)(0); ((i) < (outcount)) && ((operands.cursor) < (operands.size)); i++)
            {
                _out_ = stbtt__cff_int(operands);
            }
        }
Exemplo n.º 5
0
        public static stbtt__buf stbtt__buf_range(stbtt__buf *b, int o, int s)
        {
            stbtt__buf r = (stbtt__buf)(stbtt__new_buf((null), (ulong)(0)));

            if (((((o) < (0)) || ((s) < (0))) || ((o) > (b->size))) || ((s) > (b->size - o)))
            {
                return((stbtt__buf)(r));
            }
            r.data = b->data + o;
            r.size = (int)(s);
            return((stbtt__buf)(r));
        }
Exemplo n.º 6
0
        public static stbtt__buf stbtt__buf_range(stbtt__buf *b, int o, int s)
        {
            stbtt__buf r = stbtt__new_buf((null), 0);

            if (((((o) < (0)) || ((s) < (0))) || ((o) > (b->size))) || ((s) > (b->size - o)))
            {
                return(r);
            }
            r.data = b->data + o;
            r.size = s;
            return(r);
        }
        public static stbtt__buf stbtt__cff_index_get(stbtt__buf b, int i)
        {
            var count   = 0;
            var offsize = 0;
            var start   = 0;
            var end     = 0;

            stbtt__buf_seek(&b, 0);
            count   = (int)stbtt__buf_get(&b, 2);
            offsize = stbtt__buf_get8(&b);
            stbtt__buf_skip(&b, i * offsize);
            start = (int)stbtt__buf_get(&b, offsize);
            end   = (int)stbtt__buf_get(&b, offsize);
            return(stbtt__buf_range(&b, 2 + (count + 1) * offsize + start, end - start));
        }
Exemplo n.º 8
0
        public static stbtt__buf stbtt__cff_index_get(stbtt__buf b, int i)
        {
            int count   = 0;
            int offsize = 0;
            int start   = 0;
            int end     = 0;

            stbtt__buf_seek(&b, (int)(0));
            count   = (int)(stbtt__buf_get((&b), (int)(2)));
            offsize = (int)(stbtt__buf_get8(&b));
            stbtt__buf_skip(&b, (int)(i * offsize));
            start = (int)(stbtt__buf_get(&b, (int)(offsize)));
            end   = (int)(stbtt__buf_get(&b, (int)(offsize)));
            return((stbtt__buf)(stbtt__buf_range(&b, (int)(2 + (count + 1) * offsize + start), (int)(end - start))));
        }
        public static stbtt__buf stbtt__get_subrs(stbtt__buf cff, stbtt__buf fontdict)
        {
            uint subrsoff    = 0;
            var  private_loc = stackalloc uint[] { 0, 0 };
            var  pdict       = new stbtt__buf();

            stbtt__dict_get_ints(&fontdict, 18, 2, private_loc);
            if (private_loc[1] == 0 || private_loc[0] == 0)
            {
                return(stbtt__new_buf(null, 0));
            }
            pdict = stbtt__buf_range(&cff, (int)private_loc[1], (int)private_loc[0]);
            stbtt__dict_get_ints(&pdict, 19, 1, &subrsoff);
            if (subrsoff == 0)
            {
                return(stbtt__new_buf(null, 0));
            }
            stbtt__buf_seek(&cff, (int)(private_loc[1] + subrsoff));
            return(stbtt__cff_get_index(&cff));
        }
        public static stbtt__buf stbtt__get_subr(stbtt__buf idx, int n)
        {
            var count = stbtt__cff_index_count(&idx);
            var bias  = 107;

            if (count >= 33900)
            {
                bias = 32768;
            }
            else if (count >= 1240)
            {
                bias = 1131;
            }
            n += bias;
            if (n < 0 || n >= count)
            {
                return(stbtt__new_buf(null, 0));
            }
            return(stbtt__cff_index_get(idx, n));
        }
Exemplo n.º 11
0
        public static stbtt__buf stbtt__get_subr(stbtt__buf idx, int n)
        {
            int count = (int)(stbtt__cff_index_count(&idx));
            int bias  = (int)(107);

            if ((count) >= (33900))
            {
                bias = (int)(32768);
            }
            else if ((count) >= (1240))
            {
                bias = (int)(1131);
            }
            n += (int)(bias);
            if (((n) < (0)) || ((n) >= (count)))
            {
                return((stbtt__buf)(stbtt__new_buf((null), (ulong)(0))));
            }
            return((stbtt__buf)(stbtt__cff_index_get((stbtt__buf)(idx), (int)(n))));
        }
Exemplo n.º 12
0
        public static stbtt__buf stbtt__get_subr(stbtt__buf idx, int n)
        {
            int count = stbtt__cff_index_count(&idx);
            int bias  = 107;

            if ((count) >= (33900))
            {
                bias = 32768;
            }
            else if ((count) >= (1240))
            {
                bias = 1131;
            }
            n += bias;
            if (((n) < (0)) || ((n) >= (count)))
            {
                return(stbtt__new_buf((null), 0));
            }
            return(stbtt__cff_index_get(idx, n));
        }
Exemplo n.º 13
0
        public static stbtt__buf stbtt__get_subrs(stbtt__buf cff, stbtt__buf fontdict)
        {
            uint  subrsoff    = (uint)(0);
            uint *private_loc = stackalloc uint[2];

            private_loc[0] = (uint)(0);
            private_loc[1] = (uint)(0);

            stbtt__buf pdict = new stbtt__buf();

            stbtt__dict_get_ints(&fontdict, (int)(18), (int)(2), private_loc);
            if ((private_loc[1] == 0) || (private_loc[0] == 0))
            {
                return((stbtt__buf)(stbtt__new_buf((null), (ulong)(0))));
            }
            pdict = (stbtt__buf)(stbtt__buf_range(&cff, (int)(private_loc[1]), (int)(private_loc[0])));
            stbtt__dict_get_ints(&pdict, (int)(19), (int)(1), &subrsoff);
            if (subrsoff == 0)
            {
                return((stbtt__buf)(stbtt__new_buf((null), (ulong)(0))));
            }
            stbtt__buf_seek(&cff, (int)(private_loc[1] + subrsoff));
            return((stbtt__buf)(stbtt__cff_get_index(&cff)));
        }
Exemplo n.º 14
0
        public static stbtt__buf stbtt__get_subrs(stbtt__buf cff, stbtt__buf fontdict)
        {
            uint  subrsoff    = 0;
            uint *private_loc = stackalloc uint[2];

            private_loc[0] = 0;
            private_loc[1] = 0;

            stbtt__buf pdict = new stbtt__buf();

            stbtt__dict_get_ints(&fontdict, 18, 2, private_loc);
            if ((private_loc[1] == 0) || (private_loc[0] == 0))
            {
                return(stbtt__new_buf((null), 0));
            }
            pdict = stbtt__buf_range(&cff, (int)(private_loc[1]), (int)(private_loc[0]));
            stbtt__dict_get_ints(&pdict, 19, 1, &subrsoff);
            if (subrsoff == 0)
            {
                return(stbtt__new_buf((null), 0));
            }
            stbtt__buf_seek(&cff, (int)(private_loc[1] + subrsoff));
            return(stbtt__cff_get_index(&cff));
        }