ImageSharp/SixLabors.Fonts/IFontCollection.cs
2026-08-03 22:31:27 +02:00

150 lines
6.8 KiB
C#

// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
using System;
using System.Globalization;
using System.IO;
namespace SixLabors.Fonts {
/// <summary>
/// A readable and writable collection of fonts.
/// </summary>
/// <seealso cref="IReadOnlyFontCollection" />
public interface IFontCollection : IReadOnlyFontCollection
{
/// <summary>
/// Adds a font to the collection.
/// </summary>
/// <param name="path">The filesystem path to the font file.</param>
/// <returns>The new <see cref="FontFamily"/>.</returns>
public FontFamily Add(string path);
/// <summary>
/// Adds a font to the collection.
/// </summary>
/// <param name="path">The filesystem path to the font file.</param>
/// <param name="description">The description of the added font.</param>
/// <returns>The new <see cref="FontFamily"/>.</returns>
public FontFamily Add(string path, out FontDescription description);
/// <summary>
/// Adds a font to the collection.
/// </summary>
/// <param name="stream">The font stream.</param>
/// <returns>The new <see cref="FontFamily"/>.</returns>
public FontFamily Add(Stream stream);
/// <summary>
/// Adds a font to the collection.
/// </summary>
/// <param name="stream">The font stream.</param>
/// <param name="description">The description of the added font.</param>
/// <returns>The new <see cref="FontFamily"/>.</returns>
public FontFamily Add(Stream stream, out FontDescription description);
/// <summary>
/// Adds a true type font collection (.ttc).
/// </summary>
/// <param name="path">The font collection path.</param>
/// <returns>A read-only memory region containing the new <see cref="FontFamily"/> values.</returns>
public ReadOnlyMemory<FontFamily> AddCollection(string path);
/// <summary>
/// Adds a true type font collection (.ttc).
/// </summary>
/// <param name="path">The font collection path.</param>
/// <param name="descriptions">The descriptions of the added fonts.</param>
/// <returns>A read-only memory region containing the new <see cref="FontFamily"/> values.</returns>
public ReadOnlyMemory<FontFamily> AddCollection(string path, out ReadOnlyMemory<FontDescription> descriptions);
/// <summary>
/// Adds a true type font collection (.ttc).
/// </summary>
/// <param name="stream">The font stream.</param>
/// <returns>A read-only memory region containing the new <see cref="FontFamily"/> values.</returns>
public ReadOnlyMemory<FontFamily> AddCollection(Stream stream);
/// <summary>
/// Adds a true type font collection (.ttc).
/// </summary>
/// <param name="stream">The font stream.</param>
/// <param name="descriptions">The descriptions of the added fonts.</param>
/// <returns>A read-only memory region containing the new <see cref="FontFamily"/> values.</returns>
public ReadOnlyMemory<FontFamily> AddCollection(Stream stream, out ReadOnlyMemory<FontDescription> descriptions);
/// <summary>
/// Adds a font to the collection.
/// </summary>
/// <param name="path">The filesystem path to the font file.</param>
/// <param name="culture">The culture of the font to add.</param>
/// <returns>The new <see cref="FontFamily"/>.</returns>
public FontFamily AddWithCulture(string path, CultureInfo culture);
/// <summary>
/// Adds a font to the collection.
/// </summary>
/// <param name="path">The filesystem path to the font file.</param>
/// <param name="culture">The culture of the font to add.</param>
/// <param name="description">The description of the added font.</param>
/// <returns>The new <see cref="FontFamily"/>.</returns>
public FontFamily AddWithCulture(string path, CultureInfo culture, out FontDescription description);
/// <summary>
/// Adds a font to the collection.
/// </summary>
/// <param name="stream">The font stream.</param>
/// <param name="culture">The culture of the font to add.</param>
/// <returns>The new <see cref="FontFamily"/>.</returns>
public FontFamily AddWithCulture(Stream stream, CultureInfo culture);
/// <summary>
/// Adds a font to the collection.
/// </summary>
/// <param name="stream">The font stream.</param>
/// <param name="culture">The culture of the font to add.</param>
/// <param name="description">The description of the added font.</param>
/// <returns>The new <see cref="FontFamily"/>.</returns>
public FontFamily AddWithCulture(Stream stream, CultureInfo culture, out FontDescription description);
/// <summary>
/// Adds a true type font collection (.ttc).
/// </summary>
/// <param name="path">The font collection path.</param>
/// <param name="culture">The culture of the fonts to add.</param>
/// <returns>A read-only memory region containing the new <see cref="FontFamily"/> values.</returns>
public ReadOnlyMemory<FontFamily> AddCollection(string path, CultureInfo culture);
/// <summary>
/// Adds a true type font collection (.ttc).
/// </summary>
/// <param name="path">The font collection path.</param>
/// <param name="culture">The culture of the fonts to add.</param>
/// <param name="descriptions">The descriptions of the added fonts.</param>
/// <returns>A read-only memory region containing the new <see cref="FontFamily"/> values.</returns>
public ReadOnlyMemory<FontFamily> AddCollection(
string path,
CultureInfo culture,
out ReadOnlyMemory<FontDescription> descriptions);
/// <summary>
/// Adds a true type font collection (.ttc).
/// </summary>
/// <param name="stream">The font stream.</param>
/// <param name="culture">The culture of the fonts to add.</param>
/// <returns>A read-only memory region containing the new <see cref="FontFamily"/> values.</returns>
public ReadOnlyMemory<FontFamily> AddCollection(Stream stream, CultureInfo culture);
/// <summary>
/// Adds a true type font collection (.ttc).
/// </summary>
/// <param name="stream">The font stream.</param>
/// <param name="culture">The culture of the fonts to add.</param>
/// <param name="descriptions">The descriptions of the added fonts.</param>
/// <returns>A read-only memory region containing the new <see cref="FontFamily"/> values.</returns>
public ReadOnlyMemory<FontFamily> AddCollection(
Stream stream,
CultureInfo culture,
out ReadOnlyMemory<FontDescription> descriptions);
}
}