/// <summary> /// /// </summary> private IEnumerable <ICharMetric> EnumerateCharMetricsByLine(int lineIndex, bool isTabProcess, bool isAddMetaChar) { var chars = _textView.Doc.Lines[lineIndex].Text.AsEnumerable(); if (isAddMetaChar) { if (lineIndex < _textView.Doc.Lines.LastIndex()) { chars = chars.Append(CharUtil.Space); } DebugUtil.DebugCode(() => { if (lineIndex < _textView.Doc.Lines.LastIndex()) { chars = chars.SkipLast(1).Append('↓'); } else { chars = chars.Concat("[EOF]"); } }); } var lineHeight = _textView.GetLineHeight(); var columnCounter = new ColumnCounter(_textView._settings.tabWidth); var originalIndex = 0; var index = 0; var lineLength = _textView.Doc.Lines[lineIndex].Length; var x = 0.0; var chItem = new CharMetric(); foreach (var ch in chars) { columnCounter.Add(ch); var sourceChar = ch; var color = Color.Black; var backgroundColor = Color.Transparent; #warning test //if (!CharUtil.CanDraw(ch) && ch != CharUtil.Tab) //{ // // バイナリファイルを開いた場合でも、それとなく表示できるようにしておく // ch = '?'; //} if (sourceChar == CharUtil.Tab && isTabProcess) { sourceChar = CharUtil.Space; for (var i = 0; i < columnCounter.LastCharCount; i++) { DebugUtil.DebugCode(() => { sourceChar = i == 0 ? '>' : '.'; color = Color.DarkCyan; backgroundColor = Color.FromRgb(0x00aaaa); }); var width = _textView.AsciiFont.MeasureChar(sourceChar).Width; yield return(chItem.Init( lineIndex, lineHeight, sourceChar, x, index, originalIndex, 1, color, backgroundColor, _textView.AsciiFont, width, _textView._settings.lineHeightAdjust / 2.0)); x += width; index++; } } else { DebugUtil.DebugCode(() => { if (sourceChar == CharUtil.FullWidthSpace) { sourceChar = '□'; color = Color.DarkCyan; } if (originalIndex >= lineLength) { color = Color.DarkCyan; } }); var tempChar = (sourceChar == CharUtil.Tab) ? CharUtil.Space : sourceChar; var font = CharUtil.IsAscii(tempChar) ? _textView.AsciiFont : _textView.JpFont; var width = font.MeasureChar(tempChar).Width *columnCounter.LastCharCount; yield return(chItem.Init( lineIndex, lineHeight, sourceChar, x, index, originalIndex, columnCounter.LastColumnCount, color, backgroundColor, font, width, _textView._settings.lineHeightAdjust / 2.0)); x += width; index++; } originalIndex++; } }