The name of the required system font to add for use in the PDF document.
Since version 14 this parameter is obsolete, that means the value you set here is no longer used.
Set this parameter to true if you want to add the font in the bold style, otherwise set it to false.
Set this parameter to true if you want to add the font in the italic style, otherwise set it to false.
Example





In This Topic
GdPicture14 Namespace / GdPicturePDF Class / AddTrueTypeFontU Method / AddTrueTypeFontU(String,FontCharSet,Boolean,Boolean) Method

AddTrueTypeFontU(String,FontCharSet,Boolean,Boolean) Method

In This Topic
Adds a TrueType or OpenType system font to the currently loaded PDF document according to a font name and other parameters you have specified. The displaying of Unicode characters is supported when using the font added by this method.

Be aware that the specified font is always subset using this method. You can disable font subsetting by using the overloaded method with the EnableSubset parameter.

Syntax
'Declaration
 
Public Overloads Function AddTrueTypeFontU( _
   ByVal FontName As String, _
   ByVal CharSet As FontCharSet, _
   ByVal Bold As Boolean, _
   ByVal Italic As Boolean _
) As String
public string AddTrueTypeFontU( 
   string FontName,
   FontCharSet CharSet,
   bool Bold,
   bool Italic
)
public function AddTrueTypeFontU( 
    FontName: String;
    CharSet: FontCharSet;
    Bold: Boolean;
    Italic: Boolean
): String; 
public function AddTrueTypeFontU( 
   FontName : String,
   CharSet : FontCharSet,
   Bold : boolean,
   Italic : boolean
) : String;
public: string* AddTrueTypeFontU( 
   string* FontName,
   FontCharSet CharSet,
   bool Bold,
   bool Italic
) 
public:
String^ AddTrueTypeFontU( 
   String^ FontName,
   FontCharSet CharSet,
   bool Bold,
   bool Italic
) 

Parameters

FontName
The name of the required system font to add for use in the PDF document.
CharSet
Since version 14 this parameter is obsolete, that means the value you set here is no longer used.
Bold
Set this parameter to true if you want to add the font in the bold style, otherwise set it to false.
Italic
Set this parameter to true if you want to add the font in the italic style, otherwise set it to false.

Return Value

Returns a resource name of the specified font required for the next usage within the PDF document. The GetStat method can be subsequently used to determine if this method has been successful.

This resource name you can subsequently pass, for example, to the DrawText method, as well as to all methods, which have a font resource name as a parameter.

Remarks
This method is only allowed for use with non-encrypted documents.

It is recommend to use the GetStat method to identify the specific reason for the method's failure, if any.

Example
How to add a True Type system font with Unicode support to the newly created PDF document. The font resource name is subsequently used to draw some unicode text on the newly created page.
Dim caption As String = "Example: AddTrueTypeFontU"
Dim gdpicturePDF As New GdPicturePDF()
Dim status As GdPictureStatus = gdpicturePDF.NewPDF()
If status = GdPictureStatus.OK Then
    gdpicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft)
    gdpicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitMillimeter)
    Dim fontResNameBold As String = gdpicturePDF.AddTrueTypeFontU("MingLiu", 0, False, False)
    status = gdpicturePDF.GetStat()
    If status = GdPictureStatus.OK Then
        If (gdpicturePDF.NewPage(PdfPageSizes.PdfPageSizeA4) = GdPictureStatus.OK) AndAlso
           (gdpicturePDF.SetFillColor(Color.Red) = GdPictureStatus.OK) AndAlso
           (gdpicturePDF.SetTextSize(30) = GdPictureStatus.OK) AndAlso
           (gdpicturePDF.DrawText(fontResNameBold, 10, 50, ChrW(20320)) = GdPictureStatus.OK) Then
            status = gdpicturePDF.SaveToFile("test_AddTrueTypeFontU.pdf")
            If status = GdPictureStatus.OK Then
                MessageBox.Show("The example HAS been followed successfully.", caption)
            End If
        Else
            status = gdpicturePDF.GetStat()
        End If
    Else
        MessageBox.Show("The AddTrueTypeFontU() method has failed with the status: " + status.ToString(), caption)
        status = GdPictureStatus.OK
    End If
End If
If status <> GdPictureStatus.OK Then
    MessageBox.Show("The example HAS NOT been followed successfully. The last error status is = " + status.ToString(), caption)
End If
gdpicturePDF.Dispose()
string caption = "Example: AddTrueTypeFontU";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
GdPictureStatus status = gdpicturePDF.NewPDF();
if (status == GdPictureStatus.OK)
{
    gdpicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft);
    gdpicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitMillimeter);
    string fontResName = gdpicturePDF.AddTrueTypeFontU("MingLiu", 0, false, false);
    status = gdpicturePDF.GetStat();
    if (status == GdPictureStatus.OK)
    {
        if ((gdpicturePDF.NewPage(PdfPageSizes.PdfPageSizeA4) == GdPictureStatus.OK) &&
            (gdpicturePDF.SetFillColor(Color.Red) == GdPictureStatus.OK) &&
            (gdpicturePDF.SetTextSize(30) == GdPictureStatus.OK) &&
            (gdpicturePDF.DrawText(fontResName, 10, 50, ((char)(20320)).ToString()) == GdPictureStatus.OK))
        {
            status = gdpicturePDF.SaveToFile("test_AddTrueTypeFontU.pdf");
            if (status == GdPictureStatus.OK)
                MessageBox.Show("The example HAS been followed successfully.", caption);
        }
        else
            status = gdpicturePDF.GetStat();
    }
    else
    {
        MessageBox.Show("The AddTrueTypeFontU() method has failed with the status: " + status.ToString(), caption);
        status = GdPictureStatus.OK;
    }
}
if (status != GdPictureStatus.OK)
    MessageBox.Show("The example HAS NOT been followed successfully. The last error status is = " + status.ToString(), caption);
gdpicturePDF.Dispose();
See Also