[]
Represents a run of vertical text in a C1PrintDocument.
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).
public class RenderVerticalText : RenderText, IStyleOwner, IDocumentLocation
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.
The code below prints "CASINO ROYAL" and digits "12345" vertically:
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;
}
Name | Description |
---|---|
RenderVerticalText() | Initializes a new instance of the RenderVerticalText class. |
Name | Description |
---|---|
GetDefaultHeight() | For internal use only. |
GetDefaultSplitHorzBehavior() | For internal use only. |
GetDefaultSplitVertBehavior() | For internal use only. |
GetDefaultWidth() | For internal use only. |