XpsFont XpsFont XpsFont XpsFont Class

정의

XpsDocument의 글꼴을 나타냅니다.Represents a font in an XpsDocument.

public ref class XpsFont : System::Windows::Xps::Packaging::XpsResource
public class XpsFont : System.Windows.Xps.Packaging.XpsResource
type XpsFont = class
    inherit XpsResource
Public Class XpsFont
Inherits XpsResource
상속

예제

다음 예제에서는 글꼴을 추가 하는 방법을 보여 줍니다는 XpsDocument합니다.The following example shows how to add fonts to an XpsDocument.

// -------------------------- AddPageResources ----------------------------
Dictionary<System::String^,List<XpsResource^>^>^ AddPageResources (IXpsFixedPageWriter^ fixedPageWriter) 
{
   // Collection of all resources for this page.
   //   Key: "XpsImage", "XpsFont"
   //   Value: List of XpsImage or XpsFont
   Dictionary<System::String^,List<XpsResource^>^>^ resources = gcnew Dictionary<System::String^,List<XpsResource^>^>();

   // Collections of images and fonts used in the current page.
   List<XpsResource^>^ xpsImages = gcnew List<XpsResource^>();
   List<XpsResource^>^ xpsFonts = gcnew List<XpsResource^>();

   try
   {
      XpsImage^ xpsImage;
      XpsFont^ xpsFont;

      // Add, Write, and Commit image1 to the current page.
      xpsImage = fixedPageWriter->AddImage(XpsImageType::JpegImageType);
      WriteToStream(xpsImage->GetStream(), image1);
      xpsImage->Commit();
      xpsImages->Add(xpsImage);    // Add image1 as a required resource.

      // Add, Write, and Commit font 1 to the current page.
      xpsFont = fixedPageWriter->AddFont();
      WriteObfuscatedStream(xpsFont->Uri->ToString(), xpsFont->GetStream(), font1);
      xpsFont->Commit();
      xpsFonts->Add(xpsFont);      // Add font1 as a required resource.

      // Add, Write, and Commit image2 to the current page.
      xpsImage = fixedPageWriter->AddImage(XpsImageType::TiffImageType);
      WriteToStream(xpsImage->GetStream(), image2);
      xpsImage->Commit();
      xpsImages->Add(xpsImage);    // Add image2 as a required resource.

      // Add, Write, and Commit font2 to the current page.
      xpsFont = fixedPageWriter->AddFont(false);
      WriteToStream(xpsFont->GetStream(), font2);
      xpsFont->Commit();
      xpsFonts->Add(xpsFont);      // Add font2 as a required resource.

      // Return the image and font resources in a combined collection.
      resources->Add("XpsImage", xpsImages);
      resources->Add("XpsFont", xpsFonts);
      return resources;
   } catch (XpsPackagingException^ xpsException)
   {
      throw xpsException;

   } 
};// end:AddPageResources()
// -------------------------- AddPageResources ----------------------------
private Dictionary<string, List<XpsResource>>
        AddPageResources(IXpsFixedPageWriter fixedPageWriter)
{
    // Collection of all resources for this page.
    //   Key: "XpsImage", "XpsFont"
    //   Value: List of XpsImage or XpsFont
    Dictionary<string, List<XpsResource>> resources =
        new Dictionary<string, List<XpsResource>>();

    // Collections of images and fonts used in the current page.
    List<XpsResource> xpsImages = new List<XpsResource>();
    List<XpsResource> xpsFonts  = new List<XpsResource>();

    try
    {
        XpsImage xpsImage;
        XpsFont  xpsFont;

        // Add, Write, and Commit image1 to the current page.
        xpsImage = fixedPageWriter.AddImage(XpsImageType.JpegImageType);
        WriteToStream(xpsImage.GetStream(), image1);
        xpsImage.Commit();
        xpsImages.Add(xpsImage);    // Add image1 as a required resource.

        // Add, Write, and Commit font 1 to the current page.
        xpsFont = fixedPageWriter.AddFont();
        WriteObfuscatedStream(
            xpsFont.Uri.ToString(), xpsFont.GetStream(), font1);
        xpsFont.Commit();
        xpsFonts.Add(xpsFont);      // Add font1 as a required resource.

        // Add, Write, and Commit image2 to the current page.
        xpsImage = fixedPageWriter.AddImage(XpsImageType.TiffImageType);
        WriteToStream(xpsImage.GetStream(), image2);
        xpsImage.Commit();
        xpsImages.Add(xpsImage);    // Add image2 as a required resource.

        // Add, Write, and Commit font2 to the current page.
        xpsFont = fixedPageWriter.AddFont(false);
        WriteToStream(xpsFont.GetStream(), font2);
        xpsFont.Commit();
        xpsFonts.Add(xpsFont);      // Add font2 as a required resource.

        // Return the image and font resources in a combined collection.
        resources.Add("XpsImage", xpsImages);
        resources.Add("XpsFont", xpsFonts);
        return resources;
    }
    catch (XpsPackagingException xpsException)
    {
        throw xpsException;
    }
}// end:AddPageResources()
' -------------------------- AddPageResources ----------------------------
Private Function AddPageResources(ByVal fixedPageWriter As IXpsFixedPageWriter) As Dictionary(Of String, List(Of XpsResource))
    ' Collection of all resources for this page.
    '   Key: "XpsImage", "XpsFont"
    '   Value: List of XpsImage or XpsFont
    Dim resources As New Dictionary(Of String, List(Of XpsResource))()

    ' Collections of images and fonts used in the current page.
    Dim xpsImages As New List(Of XpsResource)()
    Dim xpsFonts As New List(Of XpsResource)()

    Try
        Dim xpsImage As XpsImage
        Dim xpsFont As XpsFont

        ' Add, Write, and Commit image1 to the current page.
        xpsImage = fixedPageWriter.AddImage(XpsImageType.JpegImageType)
        WriteToStream(xpsImage.GetStream(), image1)
        xpsImage.Commit()
        xpsImages.Add(xpsImage) ' Add image1 as a required resource.

        ' Add, Write, and Commit font 1 to the current page.
        xpsFont = fixedPageWriter.AddFont()
        WriteObfuscatedStream(xpsFont.Uri.ToString(), xpsFont.GetStream(), font1)
        xpsFont.Commit()
        xpsFonts.Add(xpsFont) ' Add font1 as a required resource.

        ' Add, Write, and Commit image2 to the current page.
        xpsImage = fixedPageWriter.AddImage(XpsImageType.TiffImageType)
        WriteToStream(xpsImage.GetStream(), image2)
        xpsImage.Commit()
        xpsImages.Add(xpsImage) ' Add image2 as a required resource.

        ' Add, Write, and Commit font2 to the current page.
        xpsFont = fixedPageWriter.AddFont(False)
        WriteToStream(xpsFont.GetStream(), font2)
        xpsFont.Commit()
        xpsFonts.Add(xpsFont) ' Add font2 as a required resource.

        ' Return the image and font resources in a combined collection.
        resources.Add("XpsImage", xpsImages)
        resources.Add("XpsFont", xpsFonts)
        Return resources
    Catch xpsException As XpsPackagingException
        Throw xpsException
    End Try
End Function ' end:AddPageResources()

설명

XpsFont 클래스에 public 생성자가 없습니다.The XpsFont class has no public constructor.

사용 하 여는 AddFont 메서드 글꼴을 추가 하 고 새 문서에 대 한 참조를 가져옵니다.Use the AddFont method to add a font and obtain a reference to it in a new document.

사용 된 GetFont 메서드를 기존 문서에서 글꼴 참조를 가져옵니다.Use the GetFont method to obtain a font reference in an existing document.

설정에 따라 XpsSerializationManagerXpsPackagingPolicy와 같은 FontSubsetterCommitPoliciesPackageInterleavingOrder, 플러시 작업을 합니다 Commit 메서드를 XpsFont 클래스 전체 될 때까지 지연 될 수 있습니다 XpsDocument 닫혀.Based on settings of XpsSerializationManager and XpsPackagingPolicy, such as FontSubsetterCommitPolicies and PackageInterleavingOrder, the flush operation of the Commit method of the XpsFont class may be delayed until the whole XpsDocument is closed.

속성

IsObfuscated IsObfuscated IsObfuscated IsObfuscated

글꼴을 난독 처리할지 여부를 나타내는 값을 가져오거나 설정합니다.Gets a value that indicates whether the font is obfuscated.

IsRestricted IsRestricted IsRestricted IsRestricted

이 글꼴을 사용하는 텍스트를 수정할 수 있는지 여부를 나타내는 값을 가져오거나 설정합니다.Gets or sets a value that indicates whether text that uses this font can be modified.

Uri Uri Uri Uri

파트의 URI(Uniform Resource Identifier)uniform resource identifier (URI)를 가져오거나 설정합니다.Gets or sets the URI(Uniform Resource Identifier)uniform resource identifier (URI) of the part.

(Inherited from XpsPartBase)

메서드

Commit() Commit() Commit() Commit()

모든 변경 내용을 커밋하고 문서 패키지에 리소스를 플러시합니다.Commits all changes and flushes the resource to the document package.

(Inherited from XpsResource)
Equals(Object) Equals(Object) Equals(Object) Equals(Object)

지정한 개체와 현재 개체가 같은지 여부를 확인합니다.Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

기본 해시 함수로 작동합니다.Serves as the default hash function.

(Inherited from Object)
GetStream() GetStream() GetStream() GetStream()

파생 클래스에서 재정의되는 경우 리소스 읽기 또는 쓰기를 위한 I/O 스트림을 반환합니다.When overridden in a derived class, returns the I/O stream for reading or writing the resource.

(Inherited from XpsResource)
GetType() GetType() GetType() GetType()

현재 인스턴스의 Type을 가져옵니다.Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.Creates a shallow copy of the current Object.

(Inherited from Object)
ObfuscateFontData(Byte[], Guid) ObfuscateFontData(Byte[], Guid) ObfuscateFontData(Byte[], Guid) ObfuscateFontData(Byte[], Guid)

글꼴 서체 데이터를 난독 처리합니다.Obfuscates the font typeface data.

RelativeUri(Uri) RelativeUri(Uri) RelativeUri(Uri) RelativeUri(Uri)

지정된 절대 URIURI를 기준으로 하는 리소스의 URIURI를 반환합니다.Returns the URIURI of the resource that is relative to a specified absolute URIURI.

(Inherited from XpsResource)
ToString() ToString() ToString() ToString()

현재 개체를 나타내는 문자열을 반환합니다.Returns a string that represents the current object.

(Inherited from Object)

명시적 인터페이스 구현

IDisposable.Dispose() IDisposable.Dispose() IDisposable.Dispose() IDisposable.Dispose()

이 멤버는 Windows Presentation Foundation 인프라를 지원하며 사용자 코드에서 직접 사용할 수 없습니다.This member supports the Windows Presentation Foundation infrastructure and is not intended to be used directly from your code.

(Inherited from XpsResource)

적용 대상

추가 정보