Bagikan melalui


FlowDocument.FontFamily Properti

Definisi

Mendapatkan atau mengatur keluarga font tingkat atas pilihan untuk 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

Nilai Properti

Objek FontFamily yang menentukan keluarga font pilihan, atau keluarga font pilihan utama dengan satu atau beberapa keluarga font fallback. Defaultnya adalah font yang ditentukan oleh MessageFontFamily nilai .

Atribut

Contoh

Contoh berikut menunjukkan cara mengatur FontFamily atribut FlowDocument elemen.

<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>

Contoh berikut menunjukkan cara mengatur properti FontFamily secara terprogram.

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

Keterangan

Pengaturan apa pun FontFamily pada elemen turunan akan mengambil alih pengaturan tingkat atas ini.

Ketika beberapa keluarga ditentukan, keluarga font kedua dan berikutnya berfungsi sebagai keluarga fallback yang akan digunakan dalam kasus di mana keluarga font utama tidak tersedia atau tidak berlaku.

Properti ini hanya menentukan preferensi. Jika keluarga font yang ditentukan tidak tersedia, akan secara diam-diam FlowDocument jatuh kembali ke font yang ditentukan oleh SystemFonts.MessageFontFamily nilai .

Penggunaan Atribut XAML

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

Nilai XAML

fontFamilyName String yang menentukan nama keluarga font. Misalnya, "Arial" atau "Century Gothic".

fontFamilyNamesList String yang menentukan beberapa nama keluarga font, masing-masing dipisahkan oleh koma (spasi kosong setelah koma diabaikan). Keluarga font pertama yang ditentukan berfungsi sebagai keluarga font utama; keluarga font berikutnya berfungsi sebagai keluarga fallback yang akan digunakan dalam kasus di mana keluarga font utama tidak tersedia atau tidak berlaku. Misalnya, "Arial, Century Gothic" menentukan Arial sebagai keluarga font utama, dengan Century Gothic sebagai keluarga font fallback.

fontFamilyFolderReference String yang menentukan folder yang berisi font, bersama dengan nama keluarga font. Folder dan nama keluarga font dibatasi oleh karakter # . Referensi folder mungkin absolut, atau relatif. Contohnya, "Custom Fonts\#My Custom Font".

fontFamilyUriReference String yang menentukan pengidentifikasi sumber daya seragam (URI) untuk font, bersama dengan nama keluarga font. URI dan nama keluarga font dibatasi oleh karakter # . Contohnya, "http://MyFontServer/Fonts/#My Custom Font".

Informasi Properti Dependensi

Item Nilai
Bidang pengidentifikasi FontFamilyProperty
Properti metadata diatur ke true AffectsMeasure, , AffectsRenderInherits

Berlaku untuk