def getTextSize(self, obj, txt, fontData): _mutex.acquire() try: pixelContainer = _pixelContainer[obj.Name] size = pixelContainer.getTextSize(txt, fontData) answ = Proto.DisplayGetTextSizeAnswer(w=size[0], h=size[1]) return answ finally: _mutex.release()
def display_getTextSize(self, request, context): try: obj = FreeCAD.ActiveDocument.getObjectsByLabel(request.objLabel)[0] return obj.Proxy.getTextSize(obj, request.text, request.fontData ) except IndexError: FreeCAD.Console.PrintError( "Object not found with label " + request.objLabel + "\n") answ = Proto.DisplayGetTextSizeAnswer(w = 0, h = 0) return answ