csharpc-sharpdotnetxamlavaloniauicross-platformcross-platform-xamlavaloniaguimulti-platformuser-interfacedotnetcore
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.1 KiB
40 lines
1.1 KiB
using System.Collections.Generic;
|
|
using System.Globalization;
|
|
using Avalonia.Media;
|
|
using Avalonia.Platform;
|
|
|
|
namespace Avalonia.UnitTests
|
|
{
|
|
public class MockFontManagerImpl : IFontManagerImpl
|
|
{
|
|
private readonly string _defaultFamilyName;
|
|
|
|
public MockFontManagerImpl(string defaultFamilyName = "Default")
|
|
{
|
|
_defaultFamilyName = defaultFamilyName;
|
|
}
|
|
|
|
public string GetDefaultFontFamilyName()
|
|
{
|
|
return _defaultFamilyName;
|
|
}
|
|
|
|
public IEnumerable<string> GetInstalledFontFamilyNames(bool checkForUpdates = false)
|
|
{
|
|
return new[] { _defaultFamilyName };
|
|
}
|
|
|
|
public bool TryMatchCharacter(int codepoint, FontStyle fontStyle, FontWeight fontWeight, FontFamily fontFamily,
|
|
CultureInfo culture, out Typeface fontKey)
|
|
{
|
|
fontKey = new Typeface(_defaultFamilyName);
|
|
|
|
return false;
|
|
}
|
|
|
|
public IGlyphTypefaceImpl CreateGlyphTypeface(Typeface typeface)
|
|
{
|
|
return new MockGlyphTypeface();
|
|
}
|
|
}
|
|
}
|
|
|