C1.C1Preview Namespace : RenderVerticalText Class |
Designed primarily for rendering of Asian (e.g. Japanese) text in the traditional manner, vertically from right to left.
Text is drawn using a single style (see RenderVerticalParagraph for multi-style text).
'Declaration Public Class RenderVerticalText Inherits RenderText Implements IDocumentLocation, IStyleOwner
public class RenderVerticalText : RenderText, IDocumentLocation, IStyleOwner
The default height and width of RenderVerticalText is auto
. In particular, that means that text without line breaks will by default stretch downwards indefinitely. To make text wrap at the bottom, the height of the RenderVerticalText object must be explicitly set.
Note that while the main use of this class is to output text in Asian languages, you can also print English text in this manner. To do so, add hex code 0xFEE0 to each English letter.
private static string ToVertical(string s) { StringBuilder sb = new StringBuilder(s.Length); for (int i = 0; i < s.Length; i++) if (s[i] == ' ') sb.Append(s[i]); else sb.Append((char)((int)s[i] + (0xFF10 - (int)'0'))); return sb.ToString(); } private C1PrintDocument CreateDocument() { C1PrintDocument doc = new C1PrintDocument(); doc.FontHandling = FontHandling.EmbedActualFonts; RenderVerticalText rt; rt = new RenderVerticalText(); rt.Style.Borders.All = LineDef.Default; rt.Style.Font = new Font("Arial", 18); rt.Text = ToVertical("CASINO ROYAL"); doc.Body.Children.Add(rt); rt = new RenderVerticalText(); rt.Style.Borders.All = LineDef.Default; rt.Style.Font = new Font("Arial", 18); rt.Text = ToVertical("Digits: (12345)"); doc.Body.Children.Add(rt); return doc; }
System.Object
C1.C1Preview.RenderObject
C1.C1Preview.RenderTextBase
C1.C1Preview.RenderText
C1.C1Preview.RenderVerticalText
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2