IXpsFixedPageWriter.AddFont メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
現在のページに新しい XpsFont を追加します。
オーバーロード
AddFont() |
現在のページに新しい XpsFont を追加します。 |
AddFont(Boolean) |
隠蔽した新しい XpsFont を現在のページに追加します。 |
AddFont(Boolean, Boolean) |
隠蔽または制限された新しい XpsFont を現在のページに追加します。 |
注釈
AddFont 新しい XpsFont ドキュメント パッケージを追加し、現在 FixedPageのパッケージに関連付けます。
AddFont()
現在のページに新しい XpsFont を追加します。
public:
System::Windows::Xps::Packaging::XpsFont ^ AddFont();
public System.Windows.Xps.Packaging.XpsFont AddFont ();
abstract member AddFont : unit -> System.Windows.Xps.Packaging.XpsFont
Public Function AddFont () As XpsFont
戻り値
追加された新しいフォント リソース。
例外
Dispose() が呼び出されました。
例
次の例は、メソッドを使用 AddFont してページにフォント リソースを追加する方法を示しています。
// -------------------------- 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()
注釈
AddFont 新しい XpsFont ドキュメント パッケージを追加し、現在 FixedPageのパッケージに関連付けます。
こちらもご覧ください
- AddColorContext()
- AddImage
- AddResource(Type, Uri)
- AddResourceDictionary()
- AddThumbnail(XpsImageType)
適用対象
AddFont(Boolean)
隠蔽した新しい XpsFont を現在のページに追加します。
public:
System::Windows::Xps::Packaging::XpsFont ^ AddFont(bool obfuscate);
public System.Windows.Xps.Packaging.XpsFont AddFont (bool obfuscate);
abstract member AddFont : bool -> System.Windows.Xps.Packaging.XpsFont
Public Function AddFont (obfuscate As Boolean) As XpsFont
パラメーター
- obfuscate
- Boolean
フォントを分かりにくくするには true
。それ以外の場合は false
。
戻り値
追加された新しいフォント リソース。
例外
Dispose() が呼び出されました。
例
次の例は、ページにフォント リソースを AddFont 追加するためにメソッドを使用する方法を示しています。
// -------------------------- 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()
注釈
AddFont ドキュメント パッケージに省略可能な難読化を含む新しい XpsFont ファイルを追加し、それを現在 FixedPageのパッケージに関連付けます。
obfuscate
ライセンス付き専用フォントをtrue
難読化する法的義務がある場合にパラメーターを設定します。 難読化はフォントを暗号化しませんが、独自のフォントを解凍し、他の用途のために個別にインストールすることを禁止します。
フォント難読化の詳細については、 XML Paper Specification (XPS) のセクション 2.1.7.3「埋め込みフォント難読化」を参照してください。
こちらもご覧ください
適用対象
AddFont(Boolean, Boolean)
隠蔽または制限された新しい XpsFont を現在のページに追加します。
public:
System::Windows::Xps::Packaging::XpsFont ^ AddFont(bool obfuscate, bool addRestrictedRelationship);
public System.Windows.Xps.Packaging.XpsFont AddFont (bool obfuscate, bool addRestrictedRelationship);
abstract member AddFont : bool * bool -> System.Windows.Xps.Packaging.XpsFont
Public Function AddFont (obfuscate As Boolean, addRestrictedRelationship As Boolean) As XpsFont
パラメーター
- obfuscate
- Boolean
フォントを分かりにくくするには true
。それ以外の場合は false
。
- addRestrictedRelationship
- Boolean
このフォントを使用するテキストが変更されるのを防止する場合は true
。それ以外の場合は false
。
戻り値
追加された新しいフォント リソース。
例外
Dispose() が呼び出されました。
例
次の例は、メソッドを使用 AddFont してページにフォント リソースを追加する方法を示しています。
// -------------------------- 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()
注釈
AddFont ドキュメント パッケージに、省略可能な難読化または制限を含む新しい XpsFont ファイルを追加し、それを現在 FixedPageのパッケージに関連付けます。
obfuscate
ライセンス付き専用フォントをtrue
難読化する法的義務がある場合にパラメーターを設定します。 難読化はフォントを暗号化しませんが、独自のフォントを解凍し、他の用途のために個別にインストールすることを禁止します。
フォントの難読化と制限付きフォントの使用の詳細については、 XML Paper Specification (XPS) を参照してください。