コード例 #1
0
            public void Input(char c)
            {
                if (c == '\r')
                {
                    HasCurrentGlyph = false;
                    return;
                }

                if (c == '\n')
                {
                    _fullLineCount++;
                    _finalLineHeight = _font.LineSpacing;
                    HasCurrentGlyph  = false;

                    Offset.X = 0;
                    Offset.Y = _font.LineSpacing * _fullLineCount;
                    return;
                }

                if (HasCurrentGlyph)
                {
                    Offset.X += _font.Spacing + CurrentGlyph.WidthIncludingBearings;
                }

                HasCurrentGlyph = _font.ResolveGlyphWithFallback(c, out CurrentGlyph);
                if (!HasCurrentGlyph)
                {
                    throw new ArgumentException(
                              Errors.TextContainsUnresolvableCharacters, "text");
                }

                UpdateWidth();
                UpdateCurrentLineHeight();
            }