Esempio n. 1
0
        /// <summary>
        /// Reads indexed string data.
        /// </summary>
        private static string[] ReadStringIndex(CompactFontFormatData data)
        {
            var index = CompactFontFormatIndexReader.ReadIndex(data);

            if (index.Length == 0)
            {
                return(EmptyArray <string> .Instance);
            }

            var count = index.Length - 1;

            var result = new string[count];

            for (var i = 0; i < count; i++)
            {
                var length = index[i + 1] - index[i];

                if (length < 0)
                {
                    throw new InvalidOperationException($"Negative object length {length} at {i}. Current position: {data.Position}.");
                }

                result[i] = data.ReadString(length, OtherEncodings.Iso88591);
            }

            return(result);
        }
Esempio n. 2
0
        private static string ReadTag(CompactFontFormatData data)
        {
            var tag = data.ReadString(4, OtherEncodings.Iso88591);

            return(tag);
        }