示例#1
0
        public void emitGlyph(int advance, short lsbDelta, short rsbDelta,
                              short spriteLeft, short spriteTop, ushort sx, ushort sy, uint uvTopLeft, uint uvBottomRight, byte layer)
        {
            glyphLayout.adjustPosition(lsbDelta, rsbDelta);

            if (firstCharacterInWord == int.MinValue)
            {
                firstCharacterInWord = glyphLayout.currentPositionPixels;
            }

            Span <sGlyphVertex> destSpan = buffer.appendGlyph();

            glyphLayout.emitGlyph(destSpan, 0, id | layer,
                                  spriteLeft, spriteTop, sx, sy, uvTopLeft, uvBottomRight);

            glyphLayout.advance(advance);

            var ba = lineBreaker.glyph(glyphLayout.currentPositionPixels);

            switch (ba)
            {
            case eBreakAction.None:
                return;

            case eBreakAction.LineFeed:
                newline();
                return;

            case eBreakAction.MoveLastWord:
                break;

            default:
                throw new ApplicationException();
            }

            CPoint offsetToNextLine = new CPoint();
            int    xMovingFrom      = firstCharacterInWord;
            int    xMovingTo        = lineStartPosition;

            offsetToNextLine.x = lineStartPosition - firstCharacterInWord;              // We want this to be negative number, because moving left.
            offsetToNextLine.y = lineHeight;

            var destSlice = finalDestSpan.Slice(destOffset);

            buffer.copyWithOffset(destSlice, offsetToNextLine);
            destOffset += buffer.length;
            buffer.clear();

            int movedWidth = glyphLayout.currentPositionPixels - firstCharacterInWord;

            glyphLayout.newLine(lineStartPosition + movedWidth, lineHeight, true);                      // True to keep the damn RSB delta
        }
示例#2
0
        public void emitGlyph(int advance, short lsbDelta, short rsbDelta,
                              short spriteLeft, short spriteTop, ushort sx, ushort sy, uint uvTopLeft, uint uvBottomRight, byte layer)
        {
            glyphLayout.adjustPosition(lsbDelta, rsbDelta);

            if (firstCharacterInWord == int.MinValue)
            {
                firstCharacterInWord = glyphLayout.currentPositionPixels;
            }

            glyphLayout.advance(advance);

            maxY = Math.Max(maxY, glyphLayout.spriteTop(spriteTop) + sy);

            var ba = lineBreaker.glyph(glyphLayout.currentPositionPixels);

            switch (ba)
            {
            case eBreakAction.None:
                return;

            case eBreakAction.LineFeed:
                newline();
                return;

            case eBreakAction.MoveLastWord:
                break;

            default:
                throw new ApplicationException();
            }

            maxLineWidth = Math.Max(maxLineWidth, firstCharacterInWord);

            int movedWidth = glyphLayout.currentPositionPixels - firstCharacterInWord;

            glyphLayout.newLine(movedWidth, lineHeight, true);                  // True to keep the damn RSB delta
            maxY += lineHeight;
        }