Пример #1
0
        int DrawLinePortion(Context cr, ChunkStyle style, TextLayout layout, DocumentLine line, int visualOffset, int logicalLength)
        {
            int logicalColumn    = line.GetLogicalColumn(editor, visualOffset);
            int logicalEndColumn = logicalColumn + logicalLength;
            int visualEndOffset  = line.GetVisualColumn(editor, logicalEndColumn);

            int visualLength = visualEndOffset - visualOffset;

            int indexOffset = visualOffset - 1;

            layout.SetFontStyle(style.FontStyle, indexOffset, visualLength);
            layout.SetFontWeight(style.FontWeight, indexOffset, visualLength);
            if (style.Underline)
            {
                layout.SetUnderline(indexOffset, visualLength);
            }
            layout.SetForeground(style.Foreground, indexOffset, visualLength);

            return(visualEndOffset);
        }
Пример #2
0
        public int XToColumn(DocumentLine line, double x)
        {
            int visualColumn = (int)(x / CharWidth) + 1;

            return(line.GetLogicalColumn(editor, visualColumn));
        }