Muokkaa

Jaa


TrueTypeFontMode Enum

Definition

Specifies how a printer handles text that is formatted with a TrueType font.

public enum class TrueTypeFontMode
public enum TrueTypeFontMode
type TrueTypeFontMode = 
Public Enum TrueTypeFontMode
Inheritance
TrueTypeFontMode

Fields

Name Value Description
Unknown 0

The feature (whose options are represented by this enumeration) is set to an option not defined. in the Print Schema.

Automatic 1

The printer driver decides the best method for handling TrueType fonts.

DownloadAsOutlineFont 2

The printer driver downloads the TrueType font as an outline font.

DownloadAsRasterFont 3

The printer driver creates a raster font for each size of the TrueType font that it needs and downloads them all.

DownloadAsNativeTrueTypeFont 4

The printer driver downloads the TrueType font.

RenderAsBitmap 5

The printer driver downloads each area of text as a graphic.

Examples

The following example shows how to test a printer's capabilities and configure the print job to take advantage of them.

// ---------------------- GetPrintTicketFromPrinter -----------------------
/// <summary>
///   Returns a PrintTicket based on the current default printer.</summary>
/// <returns>
///   A PrintTicket for the current local default printer.</returns>
PrintTicket^ GetPrintTicketFromPrinter ()
{
   PrintQueue^ printQueue = nullptr;

   LocalPrintServer^ localPrintServer = gcnew LocalPrintServer();

   // Retrieving collection of local printer on user machine
   PrintQueueCollection^ localPrinterCollection = localPrintServer->GetPrintQueues();

   System::Collections::IEnumerator^ localPrinterEnumerator = localPrinterCollection->GetEnumerator();

   if (localPrinterEnumerator->MoveNext())
   {
      // Get PrintQueue from first available printer
      printQueue = ((PrintQueue^)localPrinterEnumerator->Current);
   } else
   {
      return nullptr;
   }
   // Get default PrintTicket from printer
   PrintTicket^ printTicket = printQueue->DefaultPrintTicket;

   PrintCapabilities^ printCapabilities = printQueue->GetPrintCapabilities();

   // Modify PrintTicket
   if (printCapabilities->CollationCapability->Contains(Collation::Collated))
   {
      printTicket->Collation = Collation::Collated;
   }
   if (printCapabilities->DuplexingCapability->Contains(Duplexing::TwoSidedLongEdge))
   {
      printTicket->Duplexing = Duplexing::TwoSidedLongEdge;
   }
   if (printCapabilities->StaplingCapability->Contains(Stapling::StapleDualLeft))
   {
      printTicket->Stapling = Stapling::StapleDualLeft;
   }
   return printTicket;
};// end:GetPrintTicketFromPrinter()
// ---------------------- GetPrintTicketFromPrinter -----------------------
/// <summary>
///   Returns a PrintTicket based on the current default printer.</summary>
/// <returns>
///   A PrintTicket for the current local default printer.</returns>
private PrintTicket GetPrintTicketFromPrinter()
{
    PrintQueue printQueue = null;

    LocalPrintServer localPrintServer = new LocalPrintServer();

    // Retrieving collection of local printer on user machine
    PrintQueueCollection localPrinterCollection =
        localPrintServer.GetPrintQueues();

    System.Collections.IEnumerator localPrinterEnumerator =
        localPrinterCollection.GetEnumerator();

    if (localPrinterEnumerator.MoveNext())
    {
        // Get PrintQueue from first available printer
        printQueue = (PrintQueue)localPrinterEnumerator.Current;
    }
    else
    {
        // No printer exist, return null PrintTicket
        return null;
    }

    // Get default PrintTicket from printer
    PrintTicket printTicket = printQueue.DefaultPrintTicket;

    PrintCapabilities printCapabilities = printQueue.GetPrintCapabilities();

    // Modify PrintTicket
    if (printCapabilities.CollationCapability.Contains(Collation.Collated))
    {
        printTicket.Collation = Collation.Collated;
    }

    if ( printCapabilities.DuplexingCapability.Contains(
            Duplexing.TwoSidedLongEdge) )
    {
        printTicket.Duplexing = Duplexing.TwoSidedLongEdge;
    }

    if (printCapabilities.StaplingCapability.Contains(Stapling.StapleDualLeft))
    {
        printTicket.Stapling = Stapling.StapleDualLeft;
    }

    return printTicket;
}// end:GetPrintTicketFromPrinter()
' ---------------------- GetPrintTicketFromPrinter -----------------------
''' <summary>
'''   Returns a PrintTicket based on the current default printer.</summary>
''' <returns>
'''   A PrintTicket for the current local default printer.</returns>
Private Function GetPrintTicketFromPrinter() As PrintTicket
    Dim printQueue As PrintQueue = Nothing

    Dim localPrintServer As New LocalPrintServer()

    ' Retrieving collection of local printer on user machine
    Dim localPrinterCollection As PrintQueueCollection = localPrintServer.GetPrintQueues()

    Dim localPrinterEnumerator As System.Collections.IEnumerator = localPrinterCollection.GetEnumerator()

    If localPrinterEnumerator.MoveNext() Then
        ' Get PrintQueue from first available printer
        printQueue = CType(localPrinterEnumerator.Current, PrintQueue)
    Else
        ' No printer exist, return null PrintTicket
        Return Nothing
    End If

    ' Get default PrintTicket from printer
    Dim printTicket As PrintTicket = printQueue.DefaultPrintTicket

    Dim printCapabilities As PrintCapabilities = printQueue.GetPrintCapabilities()

    ' Modify PrintTicket
    If printCapabilities.CollationCapability.Contains(Collation.Collated) Then
        printTicket.Collation = Collation.Collated
    End If

    If printCapabilities.DuplexingCapability.Contains(Duplexing.TwoSidedLongEdge) Then
        printTicket.Duplexing = Duplexing.TwoSidedLongEdge
    End If

    If printCapabilities.StaplingCapability.Contains(Stapling.StapleDualLeft) Then
        printTicket.Stapling = Stapling.StapleDualLeft
    End If

    Return printTicket
End Function ' end:GetPrintTicketFromPrinter()

Remarks

TrueType fonts are vector fonts, which instruct printer drivers and screen drivers how to draw the shapes of the letters and fill them in. Vector fonts contrast with raster fonts, which are simply lists. A raster font has a list for each letter of each available font size, and the lists determine, for every pixel in the letter, whether it prints.

You can enlarge or reduce vector fonts to almost any point size; however, vector fonts can slow printing because they occupy a large amount of printer memory. Also, some printers do not support TrueType fonts.

Newer printers often avoid these problems by doing the following.

  • Converting a TrueType font into an outline font, which is a generic vector font. Many printers that do not support TrueType fonts, do support outline fonts.

  • Creating a temporary raster font that looks just like a TrueType font. The printer must create a separate temporary raster font for each font size that the document uses. For that reason, if a print job uses many font sizes, the total memory that the printer uses might be greater than what a TrueType font would use.

  • Treating each text area in the document as a graphic. If a device needs to print a document that contains very little text, downloading text as a graphic can use less printer memory than downloading a font.

Use the values of this type for these purposes:

  • As members of the TrueTypeFontModeCapability collection, which is a property of PrintCapabilities, these values indicate which of the preceding techniques is available for a particular printer. Many printers support more than one of these techniques.

  • As the value of the TrueTypeFontMode property of a PrintTicket, the value instructs the printer to handle TrueType fonts in a particular way.

The Unknown value is never used in properties of PrintCapabilities objects.

You should never set a PrintTicket property to Unknown. If some other PrintTicket producing application has created a PrintTicket document that sets the TrueType font handling feature to an unrecognized option (that is, an option that is not defined in the Print Schema, then a PrintTicket object in your application that is constructed with that document will have Unknown as the value of the TrueTypeFontMode property.

Although the PrintTicket and PrintCapabilities classes cannot be inherited, you can extend the Print Schema to recognize print device features that are not accounted for in the PrintTicket or PrintCapabilities classes. For more information see How to: Extend the Print Schema and Create New Print System Classes.

Applies to

See also