Cargar y extraer datos | .NET
Contents
[
Hide
Show
]Cargar fuente Type1 desde el disco
Aspose.Font para .NET API le permite leer tipos de fuentes Type1 de archivos almacenados en su almacenamiento digital. Los archivos de fuentes Type1 almacenados en el disco se pueden cargar siguiendo los siguientes pasos.
- Construya la ruta completa a
Type1/courier.pfbconDataDiryPath.Combine(). - Cree una
FontFileDefinitionque describa el formato.pfby unFileSystemStreamSourcepara el archivo; después, úselos para crear unaFontDefinitionconFontType.Type1. - Abra la fuente con
Aspose.Font.Font.Open(fontDefinition), convierta el resultado aType1Fonty compruebe que la conversión se realizó correctamente.
1// Load a Type1 font from disk
2
3string fileName = Path.Combine(DataDir, "Type1", "courier.pfb");
4FontDefinition fontDefinition = new FontDefinition(
5 FontType.Type1,
6 new FontFileDefinition("pfb", new FileSystemStreamSource(fileName)));
7
8Type1Font? font = Aspose.Font.Font.Open(fontDefinition) as Type1Font;
9if (font == null)
10 throw new InvalidOperationException("Unable to load the Type1 font.");