## CustomFontSource delegate

Función de proveedor de origen de fuentes personalizadas

```csharp
public delegate CustomFontData[] CustomFontSource(params object[] args);
```

| Parámetro | Escribe | Descripción |
| --- | --- | --- |
| args | Object[] | Los argumentos. |

### Valor_devuelto

La lista de fuentes específicas para renderizar la imagen.

### Ejemplos

Este ejemplo demuestra la fuente de fuente personalizada que proporciona el uso de fuentes específicas para la representación de imágenes. A diferencia de FontSettings.SetFontsFolders, el método funciona en el ámbito de la imagen y permite proporcionar las fuentes en escenarios multiusuario.

```csharp
[C#]

public void CustomFontSourceTest(string inputPath, string outputPath, string fileName, string fontPath)
{
    var loadOptions = new Aspose.Imaging.LoadOptions();
    loadOptions.AddCustomFontSource(GetFontSource, fontPath);
    using (var img = Image.Load(System.IO.Path.Combine(inputPath, fileName), loadOptions))
    {
        Aspose.Imaging.ImageOptions.VectorRasterizationOptions vectorRasterizationOptions =
            (Aspose.Imaging.ImageOptions.VectorRasterizationOptions)img.GetDefaultOptions(new object[] { Color.White, img.Width, img.Height });
        vectorRasterizationOptions.TextRenderingHint = Aspose.Imaging.TextRenderingHint.SingleBitPerPixel;
        vectorRasterizationOptions.SmoothingMode = Aspose.Imaging.SmoothingMode.None;

        img.Save(System.IO.Path.Combine(outputPath, fileName + ".png"), new Aspose.Imaging.ImageOptions.PngOptions
        {
            VectorRasterizationOptions = vectorRasterizationOptions
        });
    }
}

// El ejemplo del proveedor de fuentes personalizadas. 
private Aspose.Imaging.CustomFontHandler.CustomFontData[] GetFontSource(params object[] args)
{
    string fontsPath = string.Empty;
    if (args.Length > 0)
    {
        fontsPath = args[0].ToString();
    }

    var customFontData = new System.Collections.Generic.List<Aspose.Imaging.CustomFontHandler.CustomFontData>();
    foreach (var font in System.IO.Directory.GetFiles(fontsPath))
    {
        customFontData.Add(new Aspose.Imaging.CustomFontHandler.CustomFontData(Path.GetFileNameWithoutExtension(font), System.IO.File.ReadAllBytes(font)));
    }

    return customFontData.ToArray();
}
```

### Ver también

* class [CustomFontData](../../aspose.imaging.customfonthandler/customfontdata)
* espacio de nombres [Aspose.Imaging](../../aspose.imaging)
* asamblea [Aspose.Imaging](../../)

<!-- DO NOT EDIT: generated by xmldocmd for Aspose.Imaging.dll -->
