XpsFont クラス

定義

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示しています。

// -------------------------- 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 パブリック コンストラクターがありません。

メソッドを AddFont 使用してフォントを追加し、新しいドキュメントでフォントへの参照を取得します。

メソッドを GetFont 使用して、既存の文書のフォント参照を取得します。

や などの FontSubsetterCommitPolicies および の設定に基づいて、クラスの メソッドのXpsFontCommitフラッシュ操作が、全体XpsDocumentが閉じられるまで遅延する場合があります。XpsSerializationManagerXpsPackagingPolicyPackageInterleavingOrder

プロパティ

IsObfuscated

フォントが隠蔽されているかどうかを示す値を取得します。

IsRestricted

このフォントを使用するテキストを変更できるかどうかを示す値を取得または設定します。

Uri

パーツの Uniform Resource Identifier (URI) を取得または設定します。

(継承元 XpsPartBase)

メソッド

Commit()

すべての変更をコミットして、ドキュメント パッケージにリソースをフラッシュします。

(継承元 XpsResource)
Equals(Object)

指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetStream()

派生クラスでオーバーライドされると、リソースの読み取りまたは書き込みを行う I/O ストリームを返します。

(継承元 XpsResource)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
ObfuscateFontData(Byte[], Guid)

フォント タイプフェイス データを隠蔽します。

RelativeUri(Uri)

指定した絶対 URI を基にした、リソースの相対 URI を返します。

(継承元 XpsResource)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

明示的なインターフェイスの実装

IDisposable.Dispose()

このメンバーは、Windows Presentation Foundation インフラストラクチャをサポートしますが、独自に作成したコードから直接使用するためのものではありません。

(継承元 XpsResource)

適用対象

こちらもご覧ください