Example #1
0
        public static int stbtt__matches(byte *fc, uint offset, byte *name, int flags)
        {
            int  nlen = (int)(CRuntime.Strlen((sbyte *)(name)));
            uint nm   = 0;
            uint hd   = 0;

            if (stbtt__isfont(fc + offset) == 0)
            {
                return(0);
            }
            if ((flags) != 0)
            {
                hd = stbtt__find_table(fc, offset, "head");
                if ((ttUSHORT(fc + hd + 44) & 7) != (flags & 7))
                {
                    return(0);
                }
            }

            nm = stbtt__find_table(fc, offset, "name");
            if (nm == 0)
            {
                return(0);
            }
            if ((flags) != 0)
            {
                if ((stbtt__matchpair(fc, nm, name, nlen, 16, -1)) != 0)
                {
                    return(1);
                }
                if ((stbtt__matchpair(fc, nm, name, nlen, 1, -1)) != 0)
                {
                    return(1);
                }
                if ((stbtt__matchpair(fc, nm, name, nlen, 3, -1)) != 0)
                {
                    return(1);
                }
            }
            else
            {
                if ((stbtt__matchpair(fc, nm, name, nlen, 16, 17)) != 0)
                {
                    return(1);
                }
                if ((stbtt__matchpair(fc, nm, name, nlen, 1, 2)) != 0)
                {
                    return(1);
                }
                if ((stbtt__matchpair(fc, nm, name, nlen, 3, -1)) != 0)
                {
                    return(1);
                }
            }

            return(0);
        }