Come lavorare con i font EOT in Python
EOT (Embedded OpenType) è un formato di font compatto usato principalmente per la compatibilità con le versioni legacy di Internet Explorer. Aspose.Font FOSS per Python può caricare i font EOT tramite FontLoader.open() e convertirli in formati moderni come TTF o WOFF2.
Guida passo-passo
Passo 1: Installa il pacchetto
git clone https://github.com/aspose-font-foss/Aspose.Font-FOSS-for-Python.git
cd Aspose.Font-FOSS-for-Python
pip install -e .Passo 2: Importa le classi necessarie
from aspose_font import FontLoader
from aspose_font.converter import FontConverter # internal API — may change between releases
from aspose_font import FontTypePasso 3: Carica un font EOT
font = FontLoader.open("MyFont.eot")
print(font.font_name)
print(font.num_glyphs)Passo 4: Converti EOT in WOFF2
from aspose_font import FontLoader
from aspose_font.converter import FontConverter # internal API — may change between releases
from aspose_font import FontType
font = FontLoader.open("MyFont.eot")
woff2 = FontConverter.convert(font, FontType.WOFF2)Problemi comuni e soluzioni
FontType non riconosciuto — Importa FontType dal pacchetto di livello superiore: from aspose_font import FontType.
Il file EOT non riesce a caricarsi — Assicurati che il file abbia un’intestazione EOT valida. I file EOT corrotti o troncati generano un FontLoadException.
Domande frequenti
Posso convertire EOT in OTF?
Converti EOT in TTF prima con FontConverter.convert(font, FontType.TTF), quindi rinomina il file di output con un’estensione .otf se necessario — OTF e TTF condividono lo stesso contenitore binario.
La libreria scrive file EOT?
FontConverter.convert() non produce output EOT. EOT è di sola lettura in Aspose.Font FOSS.