WebOpenFont

Represents an web open font.

public class WebOpenFont : Font, IDisposable, IFontSubsettable
Public Class WebOpenFont
    Inherits Font
    Implements IDisposable, IFontSubsettable

Inheritance: ObjectResourceFontWebOpenFont

Implements: IDisposable, IFontSubsettable

Licensing Info

This class is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

Examples

This example shows how to use the web open font.
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
        MyDocument.Pages.Add(MyPage)
     
        ' Create a web open font
        Dim  MyWebOpenfont As WebOpenFont = New WebOpenFont("Path of .woff file")
     
        ' Create a label
        Dim MyLabel As ceTe.DynamicPDF.PageElements.Label  = New ceTe.DynamicPDF.PageElements.Label("This text uses web open font ", 0, 0, 300, 300)
     
        ' Assign web open font to label
        MyLabel.Font = MyWebOpenfont
     
        ' Add label to the page
        MyPage.Elements.Add(MyLabel)
     
        ' Save the PDF document
        MyDocument.Draw("C:\MyDocument.pdf")
     
    End Sub
End Module
using System;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements;
using ceTe.DynamicPDF.Text;

public class Example
{
    public static void CreatePDF(string outputPath, string fontPath)
    {
        // Create a PDF Document
        Document document = new Document();

        // Create a Page and add it to the document
        Page page = new Page();
        document.Pages.Add(page);

        // Create a web open font
        WebOpenFont webOpenfont = new WebOpenFont(fontPath);

        //Create a label
        Label label = new Label("This text uses web opent font ", 0, 0, 300, 300);

        // Assign web open font to label
        label.Font = webOpenfont;

        // Add label to the page
        page.Elements.Add(label);

        // Save the PDF document
        document.Draw(outputPath);
    }
}

Constructors

WebOpenFont(Stream)Initializes a new instance of WebOpenFont class.
WebOpenFont(String)Initializes a new instance of WebOpenFont class.

Properties

AscenderGets the ascender for the font.
DescenderGets the descender for the font.
EmbedGets or sets a value indicating whether the font need to be embedded in to the pdf.
EncoderGets the encoder for the font.
(Inherited from Font)
FormFontNameGets the four character name of the font.
(Inherited from Font)
LineBreakerGets the instance of LineBreaker used for the font.
LineGapGets the line gap for the font.
NameGets the font name for the file given.
OutLineTypeGets the OutLineType of the web open font.
RequiredPdfObjectsGets the required pdf objects.
ResourceTypeGets the value of ResourceType .
SubsetGets or sets a value indicating whether the font need to subset while embedding.
UidGets the unique ID of the resource.
(Inherited from Resource)

Methods

Dispose()Releases all resources used by the WebOpenFont object.
Draw(DocumentWriter)Draw the opentype font data to the DocumentWriter .
Equals(Object)Determines whether the specified Object is equal to the current Object .
(Inherited from Object)
GetAscender(Single)Returns the ascender of the font in points for the given font size.
(Inherited from Font)
GetBaseLine(Single, Single)Returns the baseline of the font in points for the given leading and font size.
(Inherited from Font)
GetDefaultLeading(Single)Returns the default leading of the font in points for the given font size.
(Inherited from Font)
GetDescender(Single)Returns the descender of the font in points for the given font size.
(Inherited from Font)
GetFontSubsetter()eturns a font subsetter for the opentype font.
GetGlyphWidth(Char)Returns the mwidth of the given char.
GetHashCode()Serves as a hash function for a particular type.
(Inherited from Object)
GetKernValue(Char, Char)Returns the kern value correspoding to the given glyph combination.
GetLineGap(Single)Returns the line gap of the font in points for the given font size.
(Inherited from Font)
GetTextLines(Char[], Single, Single)Returns a TextLineList for the given character array.
(Inherited from Font)
GetTextLines(Char[], Single, Single, Single)Returns a TextLineList for the given character array.
(Inherited from Font)
GetTextWidth(Char[], Single)Returns the width of the given text.
(Inherited from Font)
GetTextWidth(String, Single)Returns the width of the given text.
(Inherited from Font)
GetType()Gets the Type of the current instance.
(Inherited from Object)
HasKerning()Returns whether the font has inbuilt kerning pairs.
ToString()Returns a String that represents the current Object .
(Inherited from Object)

See Also

ceTe.DynamicPDF.Text

In this topic