示例#1
0
        public static uint stbtt__cff_int(stbtt__buf *b)
        {
            int b0 = (int)(stbtt__buf_get8(b));

            if (((b0) >= (32)) && (b0 <= 246))
            {
                return((uint)(b0 - 139));
            }
            else if (((b0) >= (247)) && (b0 <= 250))
            {
                return((uint)((b0 - 247) * 256 + stbtt__buf_get8(b) + 108));
            }
            else if (((b0) >= (251)) && (b0 <= 254))
            {
                return((uint)(-(b0 - 251) * 256 - stbtt__buf_get8(b) - 108));
            }
            else if ((b0) == (28))
            {
                return((uint)(stbtt__buf_get((b), (int)(2))));
            }
            else if ((b0) == (29))
            {
                return((uint)(stbtt__buf_get((b), (int)(4))));
            }
            return((uint)(0));
        }
        public static uint stbtt__cff_int(stbtt__buf *b)
        {
            int b0 = stbtt__buf_get8(b);

            if (b0 >= 32 && b0 <= 246)
            {
                return((uint)(b0 - 139));
            }
            if (b0 >= 247 && b0 <= 250)
            {
                return((uint)((b0 - 247) * 256 + stbtt__buf_get8(b) + 108));
            }
            if (b0 >= 251 && b0 <= 254)
            {
                return((uint)(-(b0 - 251) * 256 - stbtt__buf_get8(b) - 108));
            }
            if (b0 == 28)
            {
                return(stbtt__buf_get(b, 2));
            }
            if (b0 == 29)
            {
                return(stbtt__buf_get(b, 4));
            }
            return(0);
        }
示例#3
0
 public static stbtt__buf stbtt__dict_get(stbtt__buf *b, int key)
 {
     stbtt__buf_seek(b, (int)(0));
     while ((b->cursor) < (b->size))
     {
         int start = (int)(b->cursor);
         int end   = 0;
         int op    = 0;
         while ((stbtt__buf_peek8(b)) >= (28))
         {
             stbtt__cff_skip_operand(b);
         }
         end = (int)(b->cursor);
         op  = (int)(stbtt__buf_get8(b));
         if ((op) == (12))
         {
             op = (int)(stbtt__buf_get8(b) | 0x100);
         }
         if ((op) == (key))
         {
             return((stbtt__buf)(stbtt__buf_range(b, (int)(start), (int)(end - start))));
         }
     }
     return((stbtt__buf)(stbtt__buf_range(b, (int)(0), (int)(0))));
 }
        public static stbtt__buf stbtt__dict_get(stbtt__buf *b, int key)
        {
            stbtt__buf_seek(b, 0);
            while (b->cursor < b->size)
            {
                var start = b->cursor;
                var end   = 0;
                var op    = 0;
                while (stbtt__buf_peek8(b) >= 28)
                {
                    stbtt__cff_skip_operand(b);
                }

                end = b->cursor;
                op  = stbtt__buf_get8(b);
                if (op == 12)
                {
                    op = stbtt__buf_get8(b) | 0x100;
                }
                if (op == key)
                {
                    return(stbtt__buf_range(b, start, end - start));
                }
            }

            return(stbtt__buf_range(b, 0, 0));
        }
示例#5
0
 public static byte stbtt__buf_peek8(stbtt__buf *b)
 {
     if ((b->cursor) >= (b->size))
     {
         return((byte)(0));
     }
     return((byte)(b->data[b->cursor]));
 }
 public static byte stbtt__buf_peek8(stbtt__buf *b)
 {
     if (b->cursor >= b->size)
     {
         return(0);
     }
     return(b->data[b->cursor]);
 }
示例#7
0
 public static byte stbtt__buf_get8(stbtt__buf *b)
 {
     if ((b->cursor) >= (b->size))
     {
         return(0);
     }
     return(b->data[b->cursor++]);
 }
示例#8
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));
            }
        }
        public static void stbtt__dict_get_ints(stbtt__buf *b, int key, int outcount, uint *_out_)
        {
            var i        = 0;
            var operands = stbtt__dict_get(b, key);

            for (i = 0; i < outcount && operands.cursor < operands.size; i++)
            {
                _out_[i] = stbtt__cff_int(&operands);
            }
        }
示例#10
0
        public static uint stbtt__buf_get(stbtt__buf *b, int n)
        {
            uint v = 0;
            int  i = 0;

            for (i = 0; (i) < (n); i++)
            {
                v = (v << 8) | stbtt__buf_get8(b);
            }
            return(v);
        }
示例#11
0
        public static uint stbtt__buf_get(stbtt__buf *b, int n)
        {
            uint v = (uint)(0);
            int  i = 0;

            for (i = (int)(0); (i) < (n); i++)
            {
                v = (uint)((v << 8) | stbtt__buf_get8(b));
            }
            return((uint)(v));
        }
示例#12
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__buf_range(stbtt__buf *b, int o, int s)
        {
            var 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);
        }
示例#14
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));
        }
示例#15
0
        public static stbtt__buf stbtt__cff_get_index(stbtt__buf *b)
        {
            int count   = 0;
            int start   = 0;
            int offsize = 0;

            start = b->cursor;
            count = (int)(stbtt__buf_get((b), 2));
            if ((count) != 0)
            {
                offsize = stbtt__buf_get8(b);
                stbtt__buf_skip(b, offsize * count);
                stbtt__buf_skip(b, (int)(stbtt__buf_get(b, offsize) - 1));
            }

            return(stbtt__buf_range(b, start, b->cursor - start));
        }
示例#16
0
        public static stbtt__buf stbtt__cff_get_index(stbtt__buf *b)
        {
            int count   = 0;
            int start   = 0;
            int offsize = 0;

            start = (int)(b->cursor);
            count = (int)(stbtt__buf_get((b), (int)(2)));
            if ((count) != 0)
            {
                offsize = (int)(stbtt__buf_get8(b));
                stbtt__buf_skip(b, (int)(offsize * count));
                stbtt__buf_skip(b, (int)(stbtt__buf_get(b, (int)(offsize)) - 1));
            }

            return((stbtt__buf)(stbtt__buf_range(b, (int)(start), (int)(b->cursor - start))));
        }
示例#17
0
        public static void stbtt__cff_skip_operand(stbtt__buf *b)
        {
            int v  = 0;
            int b0 = (int)(stbtt__buf_peek8(b));

            if ((b0) == (30))
            {
                stbtt__buf_skip(b, (int)(1));
                while ((b->cursor) < (b->size))
                {
                    v = (int)(stbtt__buf_get8(b));
                    if (((v & 0xF) == (0xF)) || ((v >> 4) == (0xF)))
                    {
                        break;
                    }
                }
            }
            else
            {
                stbtt__cff_int(b);
            }
        }
        public static void stbtt__cff_skip_operand(stbtt__buf *b)
        {
            var v  = 0;
            int b0 = stbtt__buf_peek8(b);

            if (b0 == 30)
            {
                stbtt__buf_skip(b, 1);
                while (b->cursor < b->size)
                {
                    v = stbtt__buf_get8(b);
                    if ((v & 0xF) == 0xF || v >> 4 == 0xF)
                    {
                        break;
                    }
                }
            }
            else
            {
                stbtt__cff_int(b);
            }
        }
 public static void stbtt__buf_seek(stbtt__buf *b, int o)
 {
     b->cursor = o > b->size || o < 0 ? b->size : o;
 }
示例#20
0
 public static int stbtt__cff_index_count(stbtt__buf *b)
 {
     stbtt__buf_seek(b, (int)(0));
     return((int)(stbtt__buf_get((b), (int)(2))));
 }
示例#21
0
 public static void stbtt__buf_seek(stbtt__buf *b, int o)
 {
     b->cursor = (int)((((o) > (b->size)) || ((o) < (0))) ? b->size : o);
 }