Exemple #1
0
        public override void Transform(GenericLineTransformer transformer, DocumentLine line)
        {
            try
            {
                if (Length == 0)
                {
                    return;
                }

                var formattedOffset = 0;
                var endOffset       = line.EndOffset;

                if (StartOffset > line.Offset)
                {
                    formattedOffset = StartOffset - line.Offset;
                }

                if (EndOffset < line.EndOffset)
                {
                    endOffset = EndOffset;
                }

                transformer.SetTextStyle(line, formattedOffset, endOffset - line.Offset - formattedOffset,
                                         _colorMap.GetBrush(_foreground),
                                         _colorMap.GetBrush(_background),
                                         GetFontStyle(),
                                         GetFontWeight(),
                                         IsUnderline());
            }
            catch (Exception ex)
            {
                _exceptionHandler?.Invoke(ex);
            }
        }
Exemple #2
0
        public override void Transform(GenericLineTransformer transformer, DocumentLine line)
        {
            if (Length == 0)
            {
                return;
            }

            if (!_colorMap.Contains(Foreground))
            {
                return;
            }

            var formattedOffset = 0;
            var endOffset       = line.EndOffset;

            if (StartOffset > line.Offset)
            {
                formattedOffset = StartOffset - line.Offset;
            }

            if (EndOffset < line.EndOffset)
            {
                endOffset = EndOffset;
            }

            transformer.SetTextStyle(line, formattedOffset, endOffset - line.Offset - formattedOffset, _colorMap.GetForegroundBrush(Foreground));
        }