Updated guides, updated copyright year
This commit is contained in:
Родитель
1f53e9cda4
Коммит
1b49d660f1
|
@ -14,6 +14,7 @@ namespace RichStringSandbox
|
|||
ResizeRedraw = true;
|
||||
this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.DoubleBuffer, true);
|
||||
|
||||
/*
|
||||
_richString = new RichString()
|
||||
.FontSize(18).FontFamily("Open Sans")
|
||||
.Alignment(TextAlignment.Center).MarginBottom(20)
|
||||
|
@ -22,6 +23,17 @@ namespace RichStringSandbox
|
|||
.Alignment(TextAlignment.Left)
|
||||
.Add("Para2a\nParam2b")
|
||||
;
|
||||
*/
|
||||
var rs = new RichString()
|
||||
.Alignment(TextAlignment.Center)
|
||||
.FontFamily("Segoe UI")
|
||||
.MarginBottom(20)
|
||||
.Add("Welcome To RichTextKit", fontSize:24, fontWeight: 700, fontItalic: true)
|
||||
.Paragraph().Alignment(TextAlignment.Left)
|
||||
.FontSize(18)
|
||||
.Add("This is a test string");
|
||||
|
||||
_richString = rs;
|
||||
}
|
||||
|
||||
private Bitmap _bitmap;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RichTextKit
|
||||
// Copyright © 2019 Topten Software. All Rights Reserved.
|
||||
// Copyright © 2019-2020 Topten Software. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this product except in compliance with the License. You may obtain
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RichTextKit
|
||||
// Copyright © 2019 Topten Software. All Rights Reserved.
|
||||
// Copyright © 2019-2020 Topten Software. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this product except in compliance with the License. You may obtain
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RichTextKit
|
||||
// Copyright © 2019 Topten Software. All Rights Reserved.
|
||||
// Copyright © 2019-2020 Topten Software. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this product except in compliance with the License. You may obtain
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RichTextKit
|
||||
// Copyright © 2019 Topten Software. All Rights Reserved.
|
||||
// Copyright © 2019-2020 Topten Software. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this product except in compliance with the License. You may obtain
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RichTextKit
|
||||
// Copyright © 2019 Topten Software. All Rights Reserved.
|
||||
// Copyright © 2019-2020 Topten Software. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this product except in compliance with the License. You may obtain
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RichTextKit
|
||||
// Copyright © 2019 Topten Software. All Rights Reserved.
|
||||
// Copyright © 2019-2020 Topten Software. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this product except in compliance with the License. You may obtain
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RichTextKit
|
||||
// Copyright © 2019 Topten Software. All Rights Reserved.
|
||||
// Copyright © 2019-2020 Topten Software. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this product except in compliance with the License. You may obtain
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RichTextKit
|
||||
// Copyright © 2019 Topten Software. All Rights Reserved.
|
||||
// Copyright © 2019-2020 Topten Software. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this product except in compliance with the License. You may obtain
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RichTextKit
|
||||
// Copyright © 2019 Topten Software. All Rights Reserved.
|
||||
// Copyright © 2019-2020 Topten Software. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this product except in compliance with the License. You may obtain
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RichTextKit
|
||||
// Copyright © 2019 Topten Software. All Rights Reserved.
|
||||
// Copyright © 2019-2020 Topten Software. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this product except in compliance with the License. You may obtain
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RichTextKit
|
||||
// Copyright © 2019 Topten Software. All Rights Reserved.
|
||||
// Copyright © 2019-2020 Topten Software. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this product except in compliance with the License. You may obtain
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RichTextKit
|
||||
// Copyright © 2019 Topten Software. All Rights Reserved.
|
||||
// Copyright © 2019-2020 Topten Software. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this product except in compliance with the License. You may obtain
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RichTextKit
|
||||
// Copyright © 2019 Topten Software. All Rights Reserved.
|
||||
// Copyright © 2019-2020 Topten Software. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this product except in compliance with the License. You may obtain
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RichTextKit
|
||||
// Copyright © 2019 Topten Software. All Rights Reserved.
|
||||
// Copyright © 2019-2020 Topten Software. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this product except in compliance with the License. You may obtain
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RichTextKit
|
||||
// Copyright © 2019 Topten Software. All Rights Reserved.
|
||||
// Copyright © 2019-2020 Topten Software. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this product except in compliance with the License. You may obtain
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RichTextKit
|
||||
// Copyright © 2019 Topten Software. All Rights Reserved.
|
||||
// Copyright © 2019-2020 Topten Software. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this product except in compliance with the License. You may obtain
|
||||
|
@ -14,7 +14,7 @@
|
|||
// under the License.
|
||||
|
||||
// RichTextKit
|
||||
// Copyright © 2019 Topten Software. All Rights Reserved.
|
||||
// Copyright © 2019-2020 Topten Software. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this product except in compliance with the License. You may obtain
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RichTextKit
|
||||
// Copyright © 2019 Topten Software. All Rights Reserved.
|
||||
// Copyright © 2019-2020 Topten Software. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this product except in compliance with the License. You may obtain
|
||||
|
@ -400,6 +400,17 @@ namespace Topten.RichTextKit
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Paint this text block
|
||||
/// </summary>
|
||||
/// <param name="canvas">The Skia canvas to paint to</param>
|
||||
/// <param name="options">Options controlling the paint operation</param>
|
||||
public void Paint(
|
||||
SKCanvas canvas,
|
||||
TextPaintOptions options = null)
|
||||
{
|
||||
Paint(canvas, SKPoint.Empty, options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Paint this text block
|
||||
|
@ -408,9 +419,9 @@ namespace Topten.RichTextKit
|
|||
/// <param name="position">The top left position within the canvas to draw at</param>
|
||||
/// <param name="options">Options controlling the paint operation</param>
|
||||
public void Paint(
|
||||
SKCanvas canvas,
|
||||
SKPoint position,
|
||||
TextPaintOptions options = null)
|
||||
SKCanvas canvas,
|
||||
SKPoint position,
|
||||
TextPaintOptions options = null)
|
||||
{
|
||||
Layout();
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RichTextKit
|
||||
// Copyright © 2019 Topten Software. All Rights Reserved.
|
||||
// Copyright © 2019-2020 Topten Software. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this product except in compliance with the License. You may obtain
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RichTextKit
|
||||
// Copyright © 2019 Topten Software. All Rights Reserved.
|
||||
// Copyright © 2019-2020 Topten Software. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this product except in compliance with the License. You may obtain
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RichTextKit
|
||||
// Copyright © 2019 Topten Software. All Rights Reserved.
|
||||
// Copyright © 2019-2020 Topten Software. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this product except in compliance with the License. You may obtain
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RichTextKit
|
||||
// Copyright © 2019 Topten Software. All Rights Reserved.
|
||||
// Copyright © 2019-2020 Topten Software. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this product except in compliance with the License. You may obtain
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RichTextKit
|
||||
// Copyright © 2019 Topten Software. All Rights Reserved.
|
||||
// Copyright © 2019-2020 Topten Software. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this product except in compliance with the License. You may obtain
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RichTextKit
|
||||
// Copyright © 2019 Topten Software. All Rights Reserved.
|
||||
// Copyright © 2019-2020 Topten Software. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this product except in compliance with the License. You may obtain
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RichTextKit
|
||||
// Copyright © 2019 Topten Software. All Rights Reserved.
|
||||
// Copyright © 2019-2020 Topten Software. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this product except in compliance with the License. You may obtain
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RichTextKit
|
||||
// Copyright © 2019 Topten Software. All Rights Reserved.
|
||||
// Copyright © 2019-2020 Topten Software. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this product except in compliance with the License. You may obtain
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RichTextKit
|
||||
// Copyright © 2019 Topten Software. All Rights Reserved.
|
||||
// Copyright © 2019-2020 Topten Software. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this product except in compliance with the License. You may obtain
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RichTextKit
|
||||
// Copyright © 2019 Topten Software. All Rights Reserved.
|
||||
// Copyright © 2019-2020 Topten Software. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this product except in compliance with the License. You may obtain
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RichTextKit
|
||||
// Copyright © 2019 Topten Software. All Rights Reserved.
|
||||
// Copyright © 2019-2020 Topten Software. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this product except in compliance with the License. You may obtain
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RichTextKit
|
||||
// Copyright © 2019 Topten Software. All Rights Reserved.
|
||||
// Copyright © 2019-2020 Topten Software. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this product except in compliance with the License. You may obtain
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RichTextKit
|
||||
// Copyright © 2019 Topten Software. All Rights Reserved.
|
||||
// Copyright © 2019-2020 Topten Software. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"), you may
|
||||
// not use this product except in compliance with the License. You may obtain
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RichTextKit
|
||||
// Copyright © 2019 Topten Software. All Rights Reserved.
|
||||
// Copyright © 2019-2020 Topten Software. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this product except in compliance with the License. You may obtain
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RichTextKit
|
||||
// Copyright © 2019 Topten Software. All Rights Reserved.
|
||||
// Copyright © 2019-2020 Topten Software. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this product except in compliance with the License. You may obtain
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RichTextKit
|
||||
// Copyright © 2019 Topten Software. All Rights Reserved.
|
||||
// Copyright © 2019-2020 Topten Software. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this product except in compliance with the License. You may obtain
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RichTextKit
|
||||
// Copyright © 2019 Topten Software. All Rights Reserved.
|
||||
// Copyright © 2019-2020 Topten Software. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this product except in compliance with the License. You may obtain
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RichTextKit
|
||||
// Copyright © 2019 Topten Software. All Rights Reserved.
|
||||
// Copyright © 2019-2020 Topten Software. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this product except in compliance with the License. You may obtain
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RichTextKit
|
||||
// Copyright © 2019 Topten Software. All Rights Reserved.
|
||||
// Copyright © 2019-2020 Topten Software. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this product except in compliance with the License. You may obtain
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RichTextKit
|
||||
// Copyright © 2019 Topten Software. All Rights Reserved.
|
||||
// Copyright © 2019-2020 Topten Software. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this product except in compliance with the License. You may obtain
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RichTextKit
|
||||
// Copyright © 2019 Topten Software. All Rights Reserved.
|
||||
// Copyright © 2019-2020 Topten Software. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this product except in compliance with the License. You may obtain
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RichTextKit
|
||||
// Copyright © 2019 Topten Software. All Rights Reserved.
|
||||
// Copyright © 2019-2020 Topten Software. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this product except in compliance with the License. You may obtain
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RichTextKit
|
||||
// Copyright © 2019 Topten Software. All Rights Reserved.
|
||||
// Copyright © 2019-2020 Topten Software. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this product except in compliance with the License. You may obtain
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RichTextKit
|
||||
// Copyright © 2019 Topten Software. All Rights Reserved.
|
||||
// Copyright © 2019-2020 Topten Software. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this product except in compliance with the License. You may obtain
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RichTextKit
|
||||
// Copyright © 2019 Topten Software. All Rights Reserved.
|
||||
// Copyright © 2019-2020 Topten Software. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this product except in compliance with the License. You may obtain
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RichTextKit
|
||||
// Copyright © 2019 Topten Software. All Rights Reserved.
|
||||
// Copyright © 2019-2020 Topten Software. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this product except in compliance with the License. You may obtain
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RichTextKit
|
||||
// Copyright © 2019 Topten Software. All Rights Reserved.
|
||||
// Copyright © 2019-2020 Topten Software. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this product except in compliance with the License. You may obtain
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RichTextKit
|
||||
// Copyright © 2019 Topten Software. All Rights Reserved.
|
||||
// Copyright © 2019-2020 Topten Software. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this product except in compliance with the License. You may obtain
|
||||
|
|
|
@ -3,7 +3,7 @@ title: "License"
|
|||
isMarkdown: false
|
||||
---
|
||||
<h1 id="license">License</h1>
|
||||
<p>Copyright © 2019 Topten Software. All Rights Reserved.</p>
|
||||
<p>Copyright © 2019-2020 Topten Software. All Rights Reserved.</p>
|
||||
<p>Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
|
||||
product except in compliance with the License. You may obtain a copy of the License at</p>
|
||||
<p><a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a></p>
|
||||
|
|
|
@ -7,19 +7,50 @@ title: Basic Concepts
|
|||
The page describes some basic concepts that are important to understand
|
||||
when working with RichTextKit.
|
||||
|
||||
## Rich Strings
|
||||
|
||||
The easiest way to work with RichTextKit is with the `RichString` class which
|
||||
provides a convenient set of methods for constructing richly decorated text.
|
||||
|
||||
~~~
|
||||
// Create a RichString
|
||||
var rs = new RichString()
|
||||
.Alignment(TextAlignment.Center)
|
||||
.FontFamily("Segoe UI")
|
||||
.MarginBottom(20)
|
||||
.Add("Welcome To RichTextKit", fontSize:24, fontWeight: 700, fontItalic: true)
|
||||
.Paragraph().Alignment(TextAlignment.Left)
|
||||
.FontSize(18)
|
||||
.Add("This is a test string");
|
||||
~~~
|
||||
|
||||
If you want to wrap and/or crop it, set the Max properties:
|
||||
|
||||
~~~
|
||||
rs.MaxWidth = 640;
|
||||
rs.MaxHeight = 480;
|
||||
~~~
|
||||
|
||||
And then you can paint it:
|
||||
|
||||
~~~
|
||||
// Paint it
|
||||
rs.Paint(skia_canvas, new SKPoint(50, 50));
|
||||
~~~
|
||||
|
||||
You can also get it's measured size:
|
||||
|
||||
~~~
|
||||
Console.WriteLine($"Size: {rs.MeasuredWidth} x {rs.MeasuredHeight});
|
||||
~~~
|
||||
|
||||
and lots more. See the [T:Topten.RichTextKit.RichString] class for details.
|
||||
|
||||
|
||||
## Text Blocks
|
||||
|
||||
RichTextKit primarily works with individual blocks of text where each is
|
||||
essentially a paragraph.
|
||||
|
||||
RichTextKit doesn't provide document level constructs like list items,
|
||||
block quotes, tables, table cells, divs etc... This project is strictly
|
||||
about laying out a single block of text with rich (aka attributed) text
|
||||
and then providing various functions for working with that text block.
|
||||
|
||||
RichTextKit doesn't have a concept of a DOM - that's a higher level concept
|
||||
that RichTextKit is not attempting to solve.
|
||||
Text blocks are a lower level concept that describes a single block of
|
||||
text. Internally RichString builds a single text block for each paragraph.
|
||||
|
||||
Text blocks can contain forced line breaks with a newline character (`\n`).
|
||||
These should be considered as in-paragraph "soft returns", as opposed to
|
||||
|
@ -38,6 +69,9 @@ single style and these text runs are referred to a "style runs".
|
|||
|
||||
Style runs are represented by the [T:Topten.RichTextKit.StyleRun] class.
|
||||
|
||||
Styles are only used if dealing with TextBlocks directly and generally don't
|
||||
need to be used if you're using the higher-level RichString interface.
|
||||
|
||||
## Font Fallback
|
||||
|
||||
Font fallback is the process of switching to a different font when the specified
|
||||
|
|
|
@ -10,7 +10,8 @@ any editing capabilities, it does include the ability to calculate where
|
|||
the caret should be displayed.
|
||||
|
||||
To determine where the caret should be displayed, call the
|
||||
[GetCaretInfo](./ref/Topten.RichTextKit.TextBlock.GetCaretInfo)
|
||||
[RichString.GetCaretInfo](./ref/Topten.RichTextKit.RichString.GetCaretInfo) or
|
||||
[TextBlock.GetCaretInfo](./ref/Topten.RichTextKit.TextBlock.GetCaretInfo)
|
||||
method which will return a [T:Topten.RichTextKit.CaretInfo] structure describing
|
||||
where the caret should be drawn, the shape of the caret (sloped for italic) and
|
||||
other useful details about the current caret position.
|
||||
|
|
|
@ -4,7 +4,7 @@ title: Hit Testing
|
|||
|
||||
# Hit Testing
|
||||
|
||||
Hit testing lets you find the line and character cluster that a coordinate
|
||||
Hit testing lets you find the character cluster that a co-ordinate
|
||||
is either directly over and/or closest to. This can be used to be build a range
|
||||
selection feature and/or as part of a more comprehensive editor.
|
||||
|
||||
|
@ -13,8 +13,8 @@ selection feature and/or as part of a more comprehensive editor.
|
|||
var htr = tb.HitTest(x, y);
|
||||
```
|
||||
|
||||
The co-ordinates passed to the [HitTest](./ref/Topten.RichTextKit.TextBlock.HitTest)
|
||||
method must be relative to the top-left corner of the text block. (ie: you'll probably
|
||||
The co-ordinates passed to the [RichString.HitTest](./ref/Topten.RichTextKit.RichString.HitTest) and [TextBlock.HitTest](./ref/Topten.RichTextKit.TextBlock.HitTest)
|
||||
methods must be relative to the top-left corner of the object. (ie: you'll probably
|
||||
need to adjust the co-ordinates by subtracting the top-left position of where you're
|
||||
displaying the text block).
|
||||
|
||||
|
|
|
@ -4,7 +4,28 @@ title: Controlling Layout
|
|||
|
||||
# Controlling Layout
|
||||
|
||||
The following properties can be used to control the layout of a text block:
|
||||
The following properties can be used to control the layout of a RichString:
|
||||
|
||||
* [P:Topten.RichTextKit.RichString.MaxWidth]
|
||||
* [P:Topten.RichTextKit.RichString.MaxHeight]
|
||||
* [P:Topten.RichTextKit.RichString.MaxLines]
|
||||
* [P:Topten.RichTextKit.RichString.DefaultAlignment]
|
||||
* [P:Topten.RichTextKit.RichString.DefaultDirection]
|
||||
|
||||
Per-paragraph control of layout is available through the following
|
||||
fluent methods:
|
||||
|
||||
* [P:Topten.RichTextKit.RichString.MarginLeft]
|
||||
* [P:Topten.RichTextKit.RichString.MarginTop]
|
||||
* [P:Topten.RichTextKit.RichString.MarginRight]
|
||||
* [P:Topten.RichTextKit.RichString.MarginBottom]
|
||||
* [P:Topten.RichTextKit.RichString.Alignment]
|
||||
* [P:Topten.RichTextKit.RichString.TextDirection]
|
||||
|
||||
|
||||
# TextBlocks
|
||||
|
||||
The following properties can be used to control the layout of a TextBlock:
|
||||
|
||||
* [P:Topten.RichTextKit.TextBlock.MaxWidth]
|
||||
* [P:Topten.RichTextKit.TextBlock.MaxHeight]
|
||||
|
|
|
@ -4,7 +4,7 @@ title: License
|
|||
|
||||
# License
|
||||
|
||||
Copyright © 2019 Topten Software. All Rights Reserved.
|
||||
Copyright © 2020 Topten Software. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
|
||||
product except in compliance with the License. You may obtain a copy of the License at
|
||||
|
|
|
@ -2,12 +2,23 @@
|
|||
title: Measuring Text
|
||||
---
|
||||
|
||||
# Measuring Text
|
||||
# Measuring RichString
|
||||
|
||||
The `RichString` class provides various measurements of its contained text.
|
||||
|
||||
* [P:Topten.RichTextKit.RichString.MeasuredWidth]
|
||||
* [P:Topten.RichTextKit.RichString.MeasuredHeight]
|
||||
* [P:Topten.RichTextKit.RichString.MeasuredLength]
|
||||
* [P:Topten.RichTextKit.RichString.LineCount]
|
||||
|
||||
|
||||
# Measuring TextBlock
|
||||
|
||||
The `TextBlock` class provides various measurements of its contained text.
|
||||
|
||||
* [P:Topten.RichTextKit.TextBlock.MeasuredWidth]
|
||||
* [P:Topten.RichTextKit.TextBlock.MeasuredHeight]
|
||||
* [P:Topten.RichTextKit.TextBlock.MeasuredLength]
|
||||
* [P:Topten.RichTextKit.TextBlock.MeasuredPadding]
|
||||
* [P:Topten.RichTextKit.TextBlock.MeasuredOverhang]
|
||||
|
||||
|
|
|
@ -4,12 +4,11 @@ title: Rendering Text
|
|||
|
||||
# Rendering Text
|
||||
|
||||
Once you've created and initialized a text block, you can render it to a SkiaSharp canvas
|
||||
using its [Paint()]((./ref/Topten.RichTextKit.TextBlock.Paint)) method:
|
||||
Text can be rendered using [RichString.Paint()]((./ref/Topten.RichTextKit.RichString.Paint)) or [TextBlock.Paint()]((./ref/Topten.RichTextKit.TextBlock.Paint)) methods:
|
||||
|
||||
~~~csharp
|
||||
// Paint at (0,0)
|
||||
tb.Paint(canvas);
|
||||
textBlockOrRichString.Paint(canvas);
|
||||
~~~
|
||||
|
||||
By default the text will be rendered at the position (0,0). `Use SKCanvas.Translate()` to set
|
||||
|
@ -17,13 +16,13 @@ the paint position or pass the position as a second parameter:
|
|||
|
||||
~~~csharp
|
||||
// Paint at (100,100)
|
||||
tb.Paint(canvas, new SKPoint(100,100));
|
||||
textBlockOrRichString.Paint(canvas, new SKPoint(100,100));
|
||||
~~~
|
||||
|
||||
|
||||
## Rendering with a Selection Highlight
|
||||
|
||||
A text block can also be rendered with part of the text highlighted.
|
||||
Text can also be rendered with part of the text highlighted.
|
||||
|
||||
~~~csharp
|
||||
// Highlight code points 10 through 19...
|
||||
|
@ -35,7 +34,7 @@ var options = new TextPaintOptions()
|
|||
}
|
||||
|
||||
// Paint with options
|
||||
tb.Paint(canvas, new SKPaint(100,100), options);
|
||||
textBlockOrRichString.Paint(canvas, new SKPaint(100,100), options);
|
||||
~~~
|
||||
|
||||
|
||||
|
|
|
@ -4,7 +4,11 @@ title: Creating a TextBlock
|
|||
|
||||
# Creating a TextBlock
|
||||
|
||||
The primary class you work with when using RichTextKit is the [T:Topten.RichTextKit.TextBlock] class. This section describes how to create a text block and add text to it.
|
||||
The TextBlock class is a low-level class for working with a single block of text. In
|
||||
general you probably don't need to use this class as the higher level RichString class
|
||||
is easier to work with and provides most of the same capabilities.
|
||||
|
||||
Never-the-less, this section describes how to work with the TextBlock class.
|
||||
|
||||
## Create a Text block
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче