from_file method

from_file(, file_name)

Load FontFile from file name

Returns

FontFile instance


@staticmethod
def from_file(file_name):
    ...
ParameterTypeDescription
file_namestrPath to the font file

Exceptions

ExceptionDescription
IOExceptionThrown when failed to read from file.

Example

The following code shows how to create a 3D mesh from text using specified font file.

from aspose.threed import Scene
from aspose.threed.entities import LinearExtrusion
from aspose.threed.profiles import FontFile, Text

font = FontFile.from_file(r"CascadiaCode-Regular.otf")
text = Text()
text.font = font
text.content = "ABC"
text.font_size = 10.0
linear = LinearExtrusion(text, 10).to_mesh()
scene = Scene(linear)
scene.save(r"test.stl")

See Also