Exemple #1
0
        public void doLayout(float offset, TextBuff buff, int start, int count, TextStyle style)
        {
            this._start = start;
            this._count = count;
            this._advances.reset(count);
            this._positions.reset(count);
            this._advance = 0;
            this._bounds  = default;

            var font = FontManager.instance.getOrCreate(style.fontFamily, style.fontWeight, style.fontStyle).font;

            font.RequestCharactersInTextureSafe(buff.text, style.UnityFontSize, style.UnityFontStyle);

            int wordstart = start == buff.size
                ? start
                : LayoutUtils.getPrevWordBreakForCache(buff, start + 1);
            int wordend;

            for (int iter = start; iter < start + count; iter = wordend)
            {
                wordend = LayoutUtils.getNextWordBreakForCache(buff, iter);
                int wordCount = Mathf.Min(start + count, wordend) - iter;
                this.layoutWord(offset, iter - start, buff.subBuff(wordstart, wordend - wordstart),
                                iter - wordstart, wordCount, style, font);
                wordstart = wordend;
            }
            this._count = count;
        }
Exemple #2
0
        public void doLayout(float offset, TextBuff buff, int start, int count, TextStyle style)
        {
            this._start = start;
            this._count = count;
            this._advances.resize(count, 0);
            this._positions.resize(count, 0);
            this._advance = 0;
            this._bounds  = null;

            int wordstart = start == buff.size
                ? start
                : LayoutUtils.getPrevWordBreakForCache(buff, start + 1);
            int wordend;

            for (int iter = start; iter < start + count; iter = wordend)
            {
                wordend = LayoutUtils.getNextWordBreakForCache(buff, iter);
                int wordCount = Math.Min(start + count, wordend) - iter;
                this.layoutWord(offset, iter - start, buff.subBuff(wordstart, wordend - wordstart),
                                iter - wordstart, wordCount, style);
                wordstart = wordend;
            }
            this._count = count;
        }
Exemple #3
0
        public void doLayout(float offset, TextBuff buff, int start, int count, TextStyle style)
        {
            this._start = start;
            this._count = count;
            this._advances.reset(count);
            this._positions.reset(count);
            this._advance = 0;
            this._bounds  = default;

            Font font = FontManager.instance.getOrCreate(style.fontFamily, style.fontWeight, style.fontStyle).font;

            char startingChar = buff.text[buff.offset + start];

            if (char.IsHighSurrogate(startingChar) || EmojiUtils.isSingleCharEmoji(startingChar))
            {
                this.layoutEmoji(buff.text.Substring(buff.offset + start, count), style, font, start, count);
            }
            else
            {
                font.RequestCharactersInTextureSafe(buff.text, style.UnityFontSize, style.UnityFontStyle);

                int wordstart = start == buff.size
                    ? start
                    : LayoutUtils.getPrevWordBreakForCache(buff, start + 1);
                int wordend;
                for (int iter = start; iter < start + count; iter = wordend)
                {
                    wordend = LayoutUtils.getNextWordBreakForCache(buff, iter);
                    int wordCount = Mathf.Min(start + count, wordend) - iter;
                    this.layoutWord(offset, iter - start, buff.subBuff(wordstart, wordend - wordstart),
                                    iter - wordstart, wordCount, style, font);
                    wordstart = wordend;
                }
            }
            this._count = count;
        }