Skip to content

Commit

Permalink
Fixed makeText
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-urbanczyk committed Jan 12, 2020
1 parent 8046947 commit 4ce8fe0
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions cadquery/occ_impl/shapes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 4ce8fe0

Please sign in to comment.