cete.dynamicpdf.text.kerningvalues
KerningValues
- Namespace: ceTe.DynamicPDF.Text
- Assemblies: DynamicPDF.CoreSuite.dll
Represents a kerning value collection.
public class KerningValues
Public Class KerningValues
Inheritance: Object → KerningValues
Examples
The following example will display text on the page.
Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements
Imports ceTe.DynamicPDF.Text
Module MyModule
Sub Main()
' Create a PDF Document
Dim MyDocument As Document = New Document
' Create a Page and add it to the document
Dim MyPage As Page = New Page
' Add page to the document
MyDocument.Pages.Add(MyPage)
' Assign some text to a string
Dim MyText As String = "To and WA are examples of when kerning would be used."
' Create a textarea
Dim MyTextArea As TextArea = New TextArea(MyText, 10, 10, 400, 700, ceTe.DynamicPDF.Font.TimesRoman)
' Must be enabled before kern values can be read
MyTextArea.KerningEnabled = true
' Create a KerningValues
Dim MyKernValues As KerningValues = MyTextArea.GetKerningValues()
' Assign positive value for making the space between chars closer and negative value for making the space further
For i As Integer = 0 To MyKernValues.Spacing.Length - 1
MyKernValues.Spacing(i) = Short.Parse((MyKernValues.Spacing(i) - 400).ToString)
Next
' Add the text to the page
MyPage.Elements.Add(MyTextArea)
' Save the PDF
MyDocument.Draw("C:\MyDocument.pdf")
End Sub
End Module
using System;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.Text;
using ceTe.DynamicPDF.PageElements;
public class Example
{
public static void CreatePDF(string outputPath)
{
// Create a PDF Document
Document document = new Document();
// Create a Page and add it to the document
Page page = new Page();
// Add page to the document
document.Pages.Add(page);
//Assign some text to a string
string text = "To and WA are examples of when kerning would be used.";
// Create a textarea
TextArea textArea = new TextArea(text, 10, 10, 400, 700, ceTe.DynamicPDF.Font.TimesRoman);
// Must be enabled before kern values can be read
textArea.KerningEnabled = true;
// Create a KerningValues
KerningValues kernValues = textArea.GetKerningValues();
// Assign positive value for making the space between chars closer and negative value for making the space further
for (int i = 0; i < kernValues.Spacing.Length; i++)
{
kernValues.Spacing[i] = (short)(kernValues.Spacing[i] - 400);
}
// Add the text area to the page
page.Elements.Add(textArea);
// Save the PDF
document.Draw(outputPath);
}
}
Properties
Spacing
Gets the spacing array corresponding to the text array.
public Int16[] Spacing { get; }
Public Property Spacing As Int16[]
Property Value
Text
Gets the character array of the text that is kerned.
public Char[] Text { get; }
Public Property Text As Char[]
Property Value
Methods
Equals(Object)
Determines whether the specified Object is equal to the current Object . (Inherited from Object)
public bool Equals(Object obj)
Function Equals(obj As Object) As Boolean
Parameters
- obj: Object
The Object to compare with the current Object .
Returns
true if the specified Object is equal to the current Object ; otherwise, false.
GetHashCode()
Serves as a hash function for a particular type. (Inherited from Object)
public int GetHashCode()
Function GetHashCode() As Integer
Returns
A hash code for the current Object .
GetType()
Gets the Type of the current instance. (Inherited from Object)
public Type GetType()
Function GetType() As Type
Returns
The Type instance that represents the exact runtime type of the current instance.
ToString()
Returns a String that represents the current Object . (Inherited from Object)
public string ToString()
Function ToString() As String
Returns
A String that represents the current Object .