示例#1
0
        protected void Add(int code, int sid)
        {
            var name = CompactFontFormatStandardStrings.GetName(sid);

            codeToNameMap[code] = name;
            Add(code, name);
        }
        protected static string GetString(List <Operand> operands, string[] stringIndex)
        {
            if (operands.Count == 0)
            {
                throw new InvalidOperationException("Cannot read a string from an empty operands array.");
            }

            if (!operands[0].Int.HasValue)
            {
                throw new InvalidOperationException($"The first operand for reading a string was not an integer. Got: {operands[0].Decimal}");
            }

            var index = operands[0].Int.Value;

            if (index >= 0 && index <= 390)
            {
                return(CompactFontFormatStandardStrings.GetName(index));
            }

            var stringIndexIndex = index - 391;

            if (stringIndexIndex >= 0 && stringIndexIndex < stringIndex.Length)
            {
                return(stringIndex[stringIndexIndex]);
            }

            return($"SID{index}");
        }