Beispiel #1
0
 public void ToggleHTML(string text)
 {
     this.useHTMLRendering = TinyHTMLParsers.IsHTMLMode(text);
     if (!this.DisableHTMLRendering)
     {
         this.textPrimitiveImpl = TextPrimitiveFactory.CreateTextPrimitiveImp(TinyHTMLParsers.IsHTMLMode(text));
     }
 }
Beispiel #2
0
 public SizeF GetTextSize(SizeF proposedSize, TextParams textParams)
 {
     if (this.isDirty)
     {
         this.isDirty   = false;
         this.TextBlock = TinyHTMLParsers.Parse(textParams);
     }
     return(this.TextBlock.GetTextSize(proposedSize, textParams));
 }
Beispiel #3
0
 public SizeF GetTextSize(TextParams textParams)
 {
     if (this.isDirty)
     {
         this.isDirty   = false;
         this.TextBlock = TinyHTMLParsers.Parse(textParams);
     }
     return(this.TextBlock.GetTextSize(new SizeF(float.MaxValue, float.MaxValue), textParams));
 }
Beispiel #4
0
        public SizeF MeasureOverride(SizeF availableSize, TextParams textParams)
        {
            this.isDirty   = false;
            this.TextBlock = TinyHTMLParsers.Parse(textParams);
            Size size1 = Size.Ceiling(this.TextBlock.GetTextSize(availableSize, textParams));
            Size size2 = LayoutUtils.FlipSizeIf(textParams.textOrientation == Orientation.Vertical, size1);
            Size size3 = LayoutUtils.FlipSizeIf(textParams.textOrientation == Orientation.Vertical, size1);

            size2.Width  = Math.Max(size2.Width, size3.Width);
            size2.Height = Math.Max(size2.Height, size3.Height);
            return((SizeF)size2);
        }
Beispiel #5
0
        public SizeF GetTextSize(TextParams textParams)
        {
            if (this.isDirty)
            {
                this.isDirty   = false;
                this.TextBlock = TinyHTMLParsers.Parse(textParams);
            }

            SizeF proposedSize = new SizeF(float.MaxValue, float.MaxValue);
            SizeF textSize     = this.TextBlock.GetTextSize(proposedSize, textParams);

            return(textSize);
        }
Beispiel #6
0
        public void PaintPrimitive(Telerik.WinControls.Paint.IGraphics graphics, float angle, System.Drawing.SizeF scale, TextParams textParams)
        {
            if (this.isDirty)
            {
                this.isDirty   = false;
                this.TextBlock = TinyHTMLParsers.Parse(textParams);
            }

            RectangleF   paintingRectangle = textParams.paintingRectangle;
            StringFormat format            = textParams.CreateStringFormat();

            this.TextBlock.PaintFormatTextBlock(graphics, paintingRectangle, true, format, TextFormatFlags.Default, textParams.textWrap, textParams.ClipText);
            format.Dispose();
        }
Beispiel #7
0
        public void PaintPrimitive(
            IGraphics graphics,
            float angle,
            SizeF scale,
            TextParams textParams)
        {
            if (this.isDirty)
            {
                this.isDirty   = false;
                this.TextBlock = TinyHTMLParsers.Parse(textParams);
            }
            RectangleF        paintingRectangle = textParams.paintingRectangle;
            StringFormat      stringFormat      = textParams.CreateStringFormat();
            Graphics          underlayGraphics  = (Graphics)graphics.UnderlayGraphics;
            TextRenderingHint textRenderingHint = underlayGraphics.TextRenderingHint;

            underlayGraphics.TextRenderingHint = textParams.textRenderingHint;
            this.TextBlock.PaintFormatTextBlock(graphics, paintingRectangle, true, stringFormat, TextFormatFlags.Default, textParams.textWrap, textParams.ClipText);
            underlayGraphics.TextRenderingHint = textRenderingHint;
            stringFormat.Dispose();
        }
Beispiel #8
0
        public System.Drawing.SizeF MeasureOverride(System.Drawing.SizeF availableSize, TextParams textParams)
        {
            if (previousAvailableSize != availableSize)
            {
                this.isDirty          = true;
                previousAvailableSize = availableSize;
            }

            if (this.isDirty)
            {
                this.isDirty   = false;
                this.TextBlock = TinyHTMLParsers.Parse(textParams);
            }

            Size textSize = Size.Ceiling(this.TextBlock.GetTextSize(availableSize, textParams));
            Size res      = LayoutUtils.FlipSizeIf(textParams.textOrientation == Orientation.Vertical, textSize);
            Size minSize  = LayoutUtils.FlipSizeIf(textParams.textOrientation == Orientation.Vertical, textSize);

            res.Width  = Math.Max(res.Width, minSize.Width);
            res.Height = Math.Max(res.Height, minSize.Height);
            return(res);
        }