Exemplo n.º 1
0
        private void parseKerningEntry(string line)
        {
            //////////////////////////////////////////////////////////////////////////
            // line to parse:
            // kerning first=121  second=44  amount=-7
            //////////////////////////////////////////////////////////////////////////

            // first
            int    first;
            int    index  = line.IndexOf("first=");
            int    index2 = line.IndexOf(' ', index);
            string value  = line.Substring(index, index2 - index);

            first = Cocos2D.CCUtils.CCParseInt(value.Replace("first=", ""));

            // second
            int second;

            index  = line.IndexOf("second=");
            index2 = line.IndexOf(' ', index);
            value  = line.Substring(index, index2 - index);
            second = Cocos2D.CCUtils.CCParseInt(value.Replace("second=", ""));

            // amount
            int amount;

            index  = line.IndexOf("amount=");
            index2 = line.IndexOf(' ', index);
            value  = line.Substring(index);
            amount = Cocos2D.CCUtils.CCParseInt(value.Replace("amount=", ""));

            try
            {
                var element = new CCKerningHashElement();
                element.amount = amount;
                element.key    = (first << 16) | (second & 0xffff);
                m_pKerningDictionary.Add(element.key, element);
            }
            catch (Exception)
            {
                Cocos2D.CCLog.Log("Failed to parse font line: {0}", line);
            }
        }
Exemplo n.º 2
0
        private void parseKerningEntry(string line)
        {
            //////////////////////////////////////////////////////////////////////////
            // line to parse:
            // kerning first=121  second=44  amount=-7
            //////////////////////////////////////////////////////////////////////////

            // first
            int first;
            int index = line.IndexOf("first=");
            int index2 = line.IndexOf(' ', index);
            string value = line.Substring(index, index2 - index);
            first = Cocos2D.CCUtils.CCParseInt(value.Replace("first=", ""));

            // second
            int second;
            index = line.IndexOf("second=");
            index2 = line.IndexOf(' ', index);
            value = line.Substring(index, index2 - index);
            second = Cocos2D.CCUtils.CCParseInt(value.Replace("second=", ""));

            // amount
            int amount;
            index = line.IndexOf("amount=");
            index2 = line.IndexOf(' ', index);
            value = line.Substring(index);
            amount = Cocos2D.CCUtils.CCParseInt(value.Replace("amount=", ""));

            try
            {
                var element = new CCKerningHashElement();
                element.amount = amount;
                element.key = (first << 16) | (second & 0xffff);
                m_pKerningDictionary.Add(element.key, element);
            }
            catch (Exception)
            {
                Cocos2D.CCLog.Log("Failed to parse font line: {0}", line);
            }
        }