Share via


FlowDocument.FontFamily 屬性

定義

取得或設定慣用的 FlowDocument 最上層字型家族。

public:
 property System::Windows::Media::FontFamily ^ FontFamily { System::Windows::Media::FontFamily ^ get(); void set(System::Windows::Media::FontFamily ^ value); };
[System.Windows.Localizability(System.Windows.LocalizationCategory.Font, Modifiability=System.Windows.Modifiability.Unmodifiable)]
public System.Windows.Media.FontFamily FontFamily { get; set; }
[<System.Windows.Localizability(System.Windows.LocalizationCategory.Font, Modifiability=System.Windows.Modifiability.Unmodifiable)>]
member this.FontFamily : System.Windows.Media.FontFamily with get, set
Public Property FontFamily As FontFamily

屬性值

FontFamily

FontFamily 物件,指定慣用的字型家族,或具有一個或多個後援字型家族的主要慣用字型家族。 預設為由 MessageFontFamily 值決定的字型。

屬性

範例

下列範例示範如何設定 FontFamily 專案的 屬性 FlowDocument

<FlowDocumentReader>
  <FlowDocument
    FontFamily="Century Gothic"
    FontSize="12"
    FontStretch="UltraExpanded"
    FontStyle="Italic"
    FontWeight="UltraBold"
  >
    <Paragraph>
      Any font settings on this paragraph would override the font settings
      for the FlowDocument.
    </Paragraph>
  </FlowDocument>
</FlowDocumentReader>

下列範例示範如何以程式設計方式設定 FontFamily 屬性。

FlowDocument flowDoc = new FlowDocument(new Paragraph(new Run("A bit of text content...")));
// Set the desired column gap to 10 device independend pixels.
flowDoc.FontFamily = new FontFamily("Century Gothic");
flowDoc.FontSize = 12.0;
flowDoc.FontStretch = FontStretches.UltraExpanded;
flowDoc.FontStyle = FontStyles.Italic;
flowDoc.FontWeight = FontWeights.UltraBold;
Dim flowDoc As New FlowDocument(New Paragraph(New Run("A bit of text content...")))
' Set the desired column gap to 10 device independend pixels.
flowDoc.FontFamily = New FontFamily("Century Gothic")
flowDoc.FontSize = 12.0
flowDoc.FontStretch = FontStretches.UltraExpanded
flowDoc.FontStyle = FontStyles.Italic
flowDoc.FontWeight = FontWeights.UltraBold

備註

子項目上的任何 FontFamily 設定都會覆寫此最上層設定。

指定多個系列時,第二個和後續字型系列會作為後援系列,以在主要字型系列無法使用或不適用的情況下使用。

此屬性只會指定喜好設定。 如果指定的字型系列無法使用,則會 FlowDocument 以無訊息方式回復為值所決定的 SystemFonts.MessageFontFamily 字型。

XAML Attribute Usage

<object FontFamily="fontFamilyName"/>  
- or -  
<object FontFamily="fontFamilyNamesList"/>  
- or -  
<object FontFamily="fontFamilyFolderReference"/>  
- or -  
<object FontFamily="fontFamilyUriReference"/>  

XAML 值

fontFamilyName
指定字型系列名稱的字串。 例如,"Arial""Century Gothic"

fontFamilyNamesList
指定多個字型系列名稱的字串,每一個都會以逗號分隔, (忽略逗號之後的任何空白字元) 。 指定的第一個字型系列做為主要字型系列;如果主要字型系列無法使用或不適用,後續字型系列會做為後援系列使用。 例如, "Arial, Century Gothic" 將 Arial 指定為主要字型系列,並將 Century Gothic 指定為後援字型系列。

fontFamilyFolderReference
指定包含字型的資料夾以及字型系列名稱的字串。 資料夾和字型系列名稱是以 # 字元分隔。 資料夾參考可以是絕對或相對的。 例如: "Custom Fonts\#My Custom Font"

fontFamilyUriReference
字串,指定字型的統一資源識別項 (URI) ,以及字型系列名稱。 URI 和字型系列名稱是以 # 字元分隔。 例如: "http://MyFontServer/Fonts/#My Custom Font"

相依性屬性資訊

識別碼欄位 FontFamilyProperty
中繼資料屬性設定為 true AffectsMeasureAffectsRenderInherits

適用於