FontConfigSubstitutionRule

FontConfigSubstitutionRule class

Schriftartkonfigurations-Ersetzungsregel.

Um mehr zu erfahren, besuchen Sie dieArbeiten mit Schriftarten Dokumentationsartikel.

public class FontConfigSubstitutionRule : FontSubstitutionRule

Eigenschaften

NameBeschreibung
override Enabled { set; }Gibt an, ob die Regel aktiviert ist oder nicht.

Methoden

NameBeschreibung
IsFontConfigAvailable()Überprüfen Sie, ob das Dienstprogramm „fontconfig“ verfügbar ist oder nicht.
ResetCache()Setzt den Cache der Ergebnisse des Fontconfig-Aufrufs zurück.

Bemerkungen

Diese Regel verwendet das Dienstprogramm „fontconfig“ auf Linux-Plattformen (und anderen Unix-ähnlichen Plattformen), um die Substitution abzurufen, wenn die Originalschrift nicht verfügbar ist.

Wenn das Dienstprogramm „fontconfig“ nicht verfügbar ist, wird diese Regel ignoriert.

Beispiele

Zeigt die betriebssystemabhängige Schriftartkonfigurationsersetzung an.

FontSettings fontSettings = new FontSettings();
FontConfigSubstitutionRule fontConfigSubstitution =
    fontSettings.SubstitutionSettings.FontConfigSubstitution;

bool isWindows = new[] {PlatformID.Win32NT, PlatformID.Win32S, PlatformID.Win32Windows, PlatformID.WinCE}
    .Any(p => Environment.OSVersion.Platform == p);

// Das FontConfigSubstitutionRule-Objekt funktioniert auf Windows-/Nicht-Windows-Plattformen unterschiedlich.
// Unter Windows ist es nicht verfügbar.
if (isWindows)
{
    Assert.False(fontConfigSubstitution.Enabled);
    Assert.False(fontConfigSubstitution.IsFontConfigAvailable());
}

bool isLinuxOrMac =
    new[] {PlatformID.Unix, PlatformID.MacOSX}.Any(p => Environment.OSVersion.Platform == p);

// Unter Linux/Mac haben wir Zugriff darauf und können Vorgänge ausführen.
if (isLinuxOrMac)
{
    Assert.True(fontConfigSubstitution.Enabled);
    Assert.True(fontConfigSubstitution.IsFontConfigAvailable());

    fontConfigSubstitution.ResetCache();
}

Siehe auch