Skip to content

raise error when font is not found #1920

@louisabraham

Description

@louisabraham

I'm trying to draw some text with Workplane.text and change the font.

If I pass a font that is not found, eg "Roboto Mono" on my system, there will be no error and Arial will be used instead.

The code below is reproduced from the implementation of makeText and shows the font will default to Arial without raising error.

from OCP.Font import Font_FontMgr, Font_FA_Regular
from OCP.TCollection import TCollection_AsciiString

mgr = Font_FontMgr.GetInstance_s()
mgr.FindFont(TCollection_AsciiString("invalid font name"), Font_FA_Regular).FontName().Value()

I think it should raise an error or at least provide with some way of checking the actual font.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesttext renderingFeatures and issues related to text rendering

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions