FontCollection
Namespace:
System.Drawing.Common
We found 10 examples in language CSharp for this search.
You will see 46 fragments of code.
Other methods
Other methods
Project:https-github.com-dotnet-runtime
File:PrivateFontCollectionTests.cs
Examples:6
[ConditionalFact(Helpers.IsDrawingSupported)]
public void Ctor_Default()
{
using (var fontCollection = new PrivateFontCollection())
{
Assert.Empty(fontCollection.Families);
}
}
[ActiveIssue("https://github.com/dotnet/runtime/issues/22221", TestPlatforms.AnyUnix)]
[ConditionalFact(Helpers.IsDrawingSupported)]
public void AddFontFile_NullFileName_ThrowsArgumentNullException()
{
using (var fontCollection = new PrivateFontCollection())
{
AssertExtensions.Throws<ArgumentNullException>("filename", "path", () => fontCollection.AddFontFile(null));
}
}
[ConditionalFact(Helpers.IsDrawingSupported)]
public void AddFontFile_InvalidPath_ThrowsArgumentException()
{
using (var fontCollection = new PrivateFontCollection())
{
AssertExtensions.Throws<ArgumentException>("path", null, () => fontCollection.AddFontFile(string.Empty));
}
}
[ConditionalFact(Helpers.IsDrawingSupported)]
public void AddFontFile_NoSuchFilePath_ThrowsFileNotFoundException()
{
using (var fontCollection = new PrivateFontCollection())
{
Assert.Throws<FileNotFoundException>(() => fontCollection.AddFontFile("fileName"));
}
}
[ConditionalFact(Helpers.IsDrawingSupported)]
public void AddFontFile_Directory_ThrowsFileNotFoundException()
{
using (var fontCollection = new PrivateFontCollection())
{
AssertExtensions.Throws<FileNotFoundException, ExternalException>(() => fontCollection.AddFontFile(AppContext.BaseDirectory));
}
}
[ActiveIssue("https://github.com/dotnet/runtime/issues/22221", TestPlatforms.AnyUnix)]
[ConditionalFact(Helpers.IsDrawingSupported)]
public void AddFontFile_Disposed_ThrowsArgumentException()
{
var fontCollection = new PrivateFontCollection();
fontCollection.Dispose();
AssertExtensions.Throws<ArgumentException>(null, () => fontCollection.AddFontFile("fileName"));
}
Project:runtime-priv
File:PrivateFontCollectionTests.cs
Examples:6
[ConditionalFact(Helpers.IsDrawingSupported)]
public void Ctor_Default()
{
using (var fontCollection = new PrivateFontCollection())
{
Assert.Empty(fontCollection.Families);
}
}
[ActiveIssue(20884, TestPlatforms.AnyUnix)]
[ConditionalFact(Helpers.IsDrawingSupported)]
public void AddFontFile_NullFileName_ThrowsArgumentNullException()
{
using (var fontCollection = new PrivateFontCollection())
{
AssertExtensions.Throws<ArgumentNullException>("path", () => fontCollection.AddFontFile(null));
}
}
[ConditionalFact(Helpers.IsDrawingSupported)]
public void AddFontFile_InvalidPath_ThrowsArgumentException()
{
using (var fontCollection = new PrivateFontCollection())
{
AssertExtensions.Throws<ArgumentException>("path", null, () => fontCollection.AddFontFile(string.Empty));
}
}
[ConditionalFact(Helpers.IsDrawingSupported)]
public void AddFontFile_NoSuchFilePath_ThrowsFileNotFoundException()
{
using (var fontCollection = new PrivateFontCollection())
{
Assert.Throws<FileNotFoundException>(() => fontCollection.AddFontFile("fileName"));
}
}
[ConditionalFact(Helpers.IsDrawingSupported)]
public void AddFontFile_Directory_ThrowsFileNotFoundException()
{
using (var fontCollection = new PrivateFontCollection())
{
AssertExtensions.Throws<FileNotFoundException, ExternalException>(() => fontCollection.AddFontFile(AppContext.BaseDirectory));
}
}
[ActiveIssue(20884, TestPlatforms.AnyUnix)]
[ConditionalFact(Helpers.IsDrawingSupported)]
public void AddFontFile_Disposed_ThrowsArgumentException()
{
var fontCollection = new PrivateFontCollection();
fontCollection.Dispose();
AssertExtensions.Throws<ArgumentException>(null, () => fontCollection.AddFontFile("fileName"));
}
Project:https-github.com-dotnet-runtime
File:InstalledFontCollectionTests.cs
Examples:3
[ConditionalFact(Helpers.GdiPlusIsAvailableNotRedhat73)]
public void Ctor_Default()
{
using (var fontCollection = new InstalledFontCollection())
{
Assert.NotEmpty(fontCollection.Families);
}
}
[ConditionalFact(Helpers.GdiPlusIsAvailableNotRedhat73)]
public void Families_GetWhenDisposed_ReturnsNonEmpty()
{
var fontCollection = new InstalledFontCollection();
fontCollection.Dispose();
Assert.NotEmpty(fontCollection.Families);
}
[ConditionalFact(Helpers.IsDrawingSupported)]
public void Dispose_MultipleTimes_Nop()
{
var fontCollection = new InstalledFontCollection();
fontCollection.Dispose();
fontCollection.Dispose();
}
Project:iltrim
File:PrivateFontCollectionTests.cs
Examples:6
[ConditionalFact(Helpers.IsDrawingSupported)]
public void Ctor_Default()
{
using (var fontCollection = new PrivateFontCollection())
{
Assert.Empty(fontCollection.Families);
}
}
[ActiveIssue("https://github.com/dotnet/runtime/issues/22221", TestPlatforms.AnyUnix)]
[ConditionalFact(Helpers.IsDrawingSupported)]
public void AddFontFile_NullFileName_ThrowsArgumentNullException()
{
using (var fontCollection = new PrivateFontCollection())
{
AssertExtensions.Throws<ArgumentNullException>("filename", "path", () => fontCollection.AddFontFile(null));
}
}
[ConditionalFact(Helpers.IsDrawingSupported)]
public void AddFontFile_InvalidPath_ThrowsArgumentException()
{
using (var fontCollection = new PrivateFontCollection())
{
AssertExtensions.Throws<ArgumentException>("path", null, () => fontCollection.AddFontFile(string.Empty));
}
}
[ConditionalFact(Helpers.IsDrawingSupported)]
public void AddFontFile_NoSuchFilePath_ThrowsFileNotFoundException()
{
using (var fontCollection = new PrivateFontCollection())
{
Assert.Throws<FileNotFoundException>(() => fontCollection.AddFontFile("fileName"));
}
}
[ConditionalFact(Helpers.IsDrawingSupported)]
public void AddFontFile_Directory_ThrowsFileNotFoundException()
{
using (var fontCollection = new PrivateFontCollection())
{
AssertExtensions.Throws<FileNotFoundException, ExternalException>(() => fontCollection.AddFontFile(AppContext.BaseDirectory));
}
}
[ActiveIssue("https://github.com/dotnet/runtime/issues/22221", TestPlatforms.AnyUnix)]
[ConditionalFact(Helpers.IsDrawingSupported)]
public void AddFontFile_Disposed_ThrowsArgumentException()
{
var fontCollection = new PrivateFontCollection();
fontCollection.Dispose();
AssertExtensions.Throws<ArgumentException>(null, () => fontCollection.AddFontFile("fileName"));
}
Project:runtime-priv
File:InstalledFontCollectionTests.cs
Examples:3
[ConditionalFact(Helpers.GdiPlusIsAvailableNotRedhat73)]
public void Ctor_Default()
{
using (var fontCollection = new InstalledFontCollection())
{
Assert.NotEmpty(fontCollection.Families);
}
}
[ConditionalFact(Helpers.GdiPlusIsAvailableNotRedhat73)]
public void Families_GetWhenDisposed_ReturnsNonEmpty()
{
var fontCollection = new InstalledFontCollection();
fontCollection.Dispose();
Assert.NotEmpty(fontCollection.Families);
}
[ConditionalFact(Helpers.IsDrawingSupported)]
public void Dispose_MultipleTimes_Nop()
{
var fontCollection = new InstalledFontCollection();
fontCollection.Dispose();
fontCollection.Dispose();
}
Project:api-certificate-authority
File:PrivateFontCollectionTests.cs
Examples:6
[ConditionalFact(Helpers.IsDrawingSupported)]
public void Ctor_Default()
{
using (var fontCollection = new PrivateFontCollection())
{
Assert.Empty(fontCollection.Families);
}
}
[ActiveIssue(20884, TestPlatforms.AnyUnix)]
[ConditionalFact(Helpers.IsDrawingSupported)]
public void AddFontFile_NullFileName_ThrowsArgumentNullException()
{
using (var fontCollection = new PrivateFontCollection())
{
AssertExtensions.Throws<ArgumentNullException>("path", () => fontCollection.AddFontFile(null));
}
}
[ConditionalFact(Helpers.IsDrawingSupported)]
public void AddFontFile_InvalidPath_ThrowsArgumentException()
{
using (var fontCollection = new PrivateFontCollection())
{
AssertExtensions.Throws<ArgumentException>("path", null, () => fontCollection.AddFontFile(string.Empty));
}
}
[ConditionalFact(Helpers.IsDrawingSupported)]
public void AddFontFile_NoSuchFilePath_ThrowsFileNotFoundException()
{
using (var fontCollection = new PrivateFontCollection())
{
Assert.Throws<FileNotFoundException>(() => fontCollection.AddFontFile("fileName"));
}
}
[ConditionalFact(Helpers.IsDrawingSupported)]
public void AddFontFile_Directory_ThrowsFileNotFoundException()
{
using (var fontCollection = new PrivateFontCollection())
{
AssertExtensions.Throws<FileNotFoundException, ExternalException>(() => fontCollection.AddFontFile(AppContext.BaseDirectory));
}
}
[ActiveIssue(20884, TestPlatforms.AnyUnix)]
[ConditionalFact(Helpers.IsDrawingSupported)]
public void AddFontFile_Disposed_ThrowsArgumentException()
{
var fontCollection = new PrivateFontCollection();
fontCollection.Dispose();
AssertExtensions.Throws<ArgumentException>(null, () => fontCollection.AddFontFile("fileName"));
}
Project:cs-winforms
File:Report01.cs
Examples:1
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using DevExpress.XtraReports.UI;
using System.Drawing.Text;
namespace F5074.DevExpressWinforms.Report
{
public partial class Report01 : DevExpress.XtraReports.UI.XtraReport
{
public Report01()
{
InitializeComponent();
//customFontStyle.Font = new Font(FontCollection.Families[0], 20F, FontStyle.Regular, GraphicsUnit.Point);
//xrLabel1.Font = new Font(FontCollection.Families[0], 20F, FontStyle.Regular, GraphicsUnit.Point);
}
static PrivateFontCollection fontCollection;
public static FontCollection FontCollection
{
get
{
if (fontCollection == null)
{
fontCollection = new PrivateFontCollection();
//fontCollection.AddFontFile("free3of9.ttf");
}
return fontCollection;
}
}
}
}
Project:corefx
File:PrivateFontCollectionTests.cs
Examples:6
[ConditionalFact(Helpers.GdiplusIsAvailable)]
public void Ctor_Default()
{
using (var fontCollection = new PrivateFontCollection())
{
Assert.Empty(fontCollection.Families);
}
}
[ActiveIssue(20884, TestPlatforms.AnyUnix)]
[ConditionalFact(Helpers.GdiplusIsAvailable)]
public void AddFontFile_NullFileName_ThrowsArgumentNullException()
{
using (var fontCollection = new PrivateFontCollection())
{
AssertExtensions.Throws<ArgumentNullException>("path", () => fontCollection.AddFontFile(null));
}
}
[ConditionalFact(Helpers.GdiplusIsAvailable)]
public void AddFontFile_InvalidPath_ThrowsArgumentException()
{
using (var fontCollection = new PrivateFontCollection())
{
AssertExtensions.Throws<ArgumentException>("path", null, () => fontCollection.AddFontFile(string.Empty));
}
}
[ConditionalFact(Helpers.GdiplusIsAvailable)]
public void AddFontFile_NoSuchFilePath_ThrowsFileNotFoundException()
{
using (var fontCollection = new PrivateFontCollection())
{
Assert.Throws<FileNotFoundException>(() => fontCollection.AddFontFile("fileName"));
}
}
[ActiveIssue(20884, TestPlatforms.AnyUnix)]
[ConditionalFact(Helpers.GdiplusIsAvailable)]
public void AddFontFile_Disposed_ThrowsArgumentException()
{
var fontCollection = new PrivateFontCollection();
fontCollection.Dispose();
AssertExtensions.Throws<ArgumentException>(null, () => fontCollection.AddFontFile("fileName"));
}
[ConditionalFact(Helpers.GdiplusIsAvailable)]
public void AddMemoryFont_ZeroMemory_ThrowsArgumentException()
{
using (var fontCollection = new PrivateFontCollection())
{
AssertExtensions.Throws<ArgumentException>(null, () => fontCollection.AddMemoryFont(IntPtr.Zero, 100));
}
}
Project:runtime
File:PrivateFontCollectionTests.cs
Examples:6
[ConditionalFact(Helpers.IsDrawingSupported)]
public void Ctor_Default()
{
using (var fontCollection = new PrivateFontCollection())
{
Assert.Empty(fontCollection.Families);
}
}
[ActiveIssue(20884, TestPlatforms.AnyUnix)]
[ConditionalFact(Helpers.IsDrawingSupported)]
public void AddFontFile_NullFileName_ThrowsArgumentNullException()
{
using (var fontCollection = new PrivateFontCollection())
{
AssertExtensions.Throws<ArgumentNullException>("path", () => fontCollection.AddFontFile(null));
}
}
[ConditionalFact(Helpers.IsDrawingSupported)]
public void AddFontFile_InvalidPath_ThrowsArgumentException()
{
using (var fontCollection = new PrivateFontCollection())
{
AssertExtensions.Throws<ArgumentException>("path", null, () => fontCollection.AddFontFile(string.Empty));
}
}
[ConditionalFact(Helpers.IsDrawingSupported)]
public void AddFontFile_NoSuchFilePath_ThrowsFileNotFoundException()
{
using (var fontCollection = new PrivateFontCollection())
{
Assert.Throws<FileNotFoundException>(() => fontCollection.AddFontFile("fileName"));
}
}
[ConditionalFact(Helpers.IsDrawingSupported)]
public void AddFontFile_Directory_ThrowsFileNotFoundException()
{
using (var fontCollection = new PrivateFontCollection())
{
AssertExtensions.Throws<FileNotFoundException, ExternalException>(() => fontCollection.AddFontFile(AppContext.BaseDirectory));
}
}
[ActiveIssue(20884, TestPlatforms.AnyUnix)]
[ConditionalFact(Helpers.IsDrawingSupported)]
public void AddFontFile_Disposed_ThrowsArgumentException()
{
var fontCollection = new PrivateFontCollection();
fontCollection.Dispose();
AssertExtensions.Throws<ArgumentException>(null, () => fontCollection.AddFontFile("fileName"));
}
Project:iltrim
File:InstalledFontCollectionTests.cs
Examples:3
[ConditionalFact(Helpers.GdiPlusIsAvailableNotRedhat73)]
public void Ctor_Default()
{
using (var fontCollection = new InstalledFontCollection())
{
Assert.NotEmpty(fontCollection.Families);
}
}
[ConditionalFact(Helpers.GdiPlusIsAvailableNotRedhat73)]
public void Families_GetWhenDisposed_ReturnsNonEmpty()
{
var fontCollection = new InstalledFontCollection();
fontCollection.Dispose();
Assert.NotEmpty(fontCollection.Families);
}
[ConditionalFact(Helpers.IsDrawingSupported)]
public void Dispose_MultipleTimes_Nop()
{
var fontCollection = new InstalledFontCollection();
fontCollection.Dispose();
fontCollection.Dispose();
}
System.Drawing.Text.FontCollection : IDisposable
Methods :
public FontFamily[] get_Families()public Void Dispose()
public Type GetType()
public String ToString()
public Boolean Equals(Object obj = )
public Int32 GetHashCode()