diff --git a/cadquery/occ_impl/shapes.py b/cadquery/occ_impl/shapes.py index 726e11ae1..24600ac8c 100644 --- a/cadquery/occ_impl/shapes.py +++ b/cadquery/occ_impl/shapes.py @@ -85,16 +85,19 @@ from OCP.LocOpe import LocOpe_DPrism from OCP.BRepCheck import BRepCheck_Analyzer -''' -from OCP.Addons import (text_to_brep, - Font_FA_Regular, - Font_FA_Italic, - Font_FA_Bold) -''' + +from OCP.Font import (Font_FontMgr, + Font_BRepTextBuilder, + Font_FA_Regular, + Font_FA_Italic, + Font_FA_Bold) + from OCP.BRepFeat import BRepFeat_MakeDPrism from OCP.BRepClass3d import BRepClass3d_SolidClassifier +from OCP.TCollection import TCollection_HAsciiString + from math import pi, sqrt from functools import reduce @@ -1520,8 +1523,18 @@ def makeText(cls, text, size, height, font="Arial", kind='regular', font_kind = {'regular' : Font_FA_Regular, 'bold' : Font_FA_Bold, 'italic' : Font_FA_Italic}[kind] - - text_flat = Shape(text_to_brep(text, font, font_kind, size, False)) + + mgr = Font_FontMgr.GetInstance_s() + font = mgr.FindFont(TCollection_HAsciiString(font), + font_kind, + 10) + + builder = Font_BRepTextBuilder() + text_flat = Shape(builder.Perform(font.FontPath().ToCString(), + size, + font_kind, + text)) + bb = text_flat.BoundingBox() t = Vector()