コード例 #1
0
        private int kerningAmountForFirst(int first, int second)
        {
            int num  = 0;
            int num1 = first << 16 | second & 65535;

            if (this.m_pConfiguration.m_pKerningDictionary != null && this.m_pConfiguration.m_pKerningDictionary.ContainsKey(num1))
            {
                tKerningHashElement item = this.m_pConfiguration.m_pKerningDictionary[num1];
                if (item != null)
                {
                    num = item.amount;
                }
            }
            return(num);
        }
コード例 #2
0
        private int kerningAmountForFirst(int first, int second)
        {
            int ret = 0;
            int key = (first << 16) | (second & 0xffff);

            if (m_pConfiguration.m_pKerningDictionary != null)
            {
                if (m_pConfiguration.m_pKerningDictionary.ContainsKey(key))
                {
                    tKerningHashElement element = m_pConfiguration.m_pKerningDictionary[key];
                    if (element != null)
                    {
                        ret = element.amount;
                    }
                }
            }
            return(ret);
        }
コード例 #3
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 tKerningHashElement();
                element.amount = amount;
                element.key    = (first << 16) | (second & 0xffff);
                m_pKerningDictionary.Add(element.key, element);
            }
            catch (Exception ex)
            {
                Cocos2D.CCLog.Log("Failed to parse font line: {0}", line);
            }
        }
コード例 #4
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 = ccUtils.ccParseInt(value.Replace("first=", ""));

            // second
            int second;

            index  = line.IndexOf("second=");
            index2 = line.IndexOf(' ', index);
            value  = line.Substring(index, index2 - index);
            second = ccUtils.ccParseInt(value.Replace("second=", ""));

            // amount
            int amount;

            index  = line.IndexOf("amount=");
            index2 = line.IndexOf(' ', index);
            value  = line.Substring(index);
            amount = ccUtils.ccParseInt(value.Replace("amount=", ""));

            tKerningHashElement element = new tKerningHashElement();

            element.amount = amount;
            element.key    = (first << 16) | (second & 0xffff);
            m_pKerningDictionary.Add(element.key, element);
        }
コード例 #5
0
        private void parseKerningEntry(string line)
        {
            int    num  = line.IndexOf("first=");
            int    num1 = line.IndexOf(' ', num);
            string str  = line.Substring(num, num1 - num);
            int    num2 = ccUtils.ccParseInt(str.Replace("first=", ""));

            num  = line.IndexOf("second=");
            num1 = line.IndexOf(' ', num);
            str  = line.Substring(num, num1 - num);
            int num3 = ccUtils.ccParseInt(str.Replace("second=", ""));

            num  = line.IndexOf("amount=");
            num1 = line.IndexOf(' ', num);
            str  = line.Substring(num);
            int num4 = ccUtils.ccParseInt(str.Replace("amount=", ""));
            tKerningHashElement _tKerningHashElement = new tKerningHashElement()
            {
                amount = num4,
                key    = num2 << 16 | num3 & 65535
            };

            this.m_pKerningDictionary.Add(_tKerningHashElement.key, _tKerningHashElement);
        }
コード例 #6
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 = int.Parse(value.Replace("first=", ""));

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

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

            tKerningHashElement element = new tKerningHashElement();
            element.amount = amount;
            element.key = (first << 16) | (second & 0xffff);
            m_pKerningDictionary.Add(element.key, element);
        }
コード例 #7
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 = CCUtils.CCParseInt(value.Replace("first=", ""));

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

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

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