// 座標は変換後。Yは上がプラス! private void AddTextHorizontalMultiLine( string text, float left, float top, float width, float height, float scale, bool autoLineBreak, float lineHeight) { int letterCount = text.Length; if (letterCount == 0) { return; } LayoutState layout = new LayoutState(); layout.Initialize(_font, width, height, scale, true, lineHeight); float ascent = (float)(_font.ascent) * scale; for (int i = 0; i < letterCount; i++) { CharacterInfo ch; // 改行検出 char c = text[i]; if (c == '\t') { c = ' '; } if (c == '\n') { // 下にはみ出したら抜ける if (layout.BreakLine() == false) { break; } } else if (_font.GetCharacterInfo(c, out ch) == true) { // 行はみ出した if (layout.TryPut(ref ch) == false) { // 自動改行でないなら抜ける。改行してみてはみ出したら抜ける if (!autoLineBreak || (layout.BreakLine() == false)) { break; } } if (AddChar( left + layout.x, top - layout.y - ascent, scale, ref ch) == false) { break; } layout.Put(ref ch); } } }