Draft: minor bugfixes

This commit is contained in:
Yorik van Havre 2013-08-23 13:06:24 -03:00
parent 48f8d67b50
commit f272107826
2 changed files with 7 additions and 5 deletions

View File

@ -749,7 +749,9 @@ def makeText(stringslist,point=Vector(0,0,0),screen=False):
typecheck([(point,Vector)], "makeText")
if not isinstance(stringslist,list): stringslist = [stringslist]
textbuffer = []
for l in stringslist: textbuffer.append(l.decode("utf8").encode('latin1'))
for l in stringslist:
#textbuffer.append(l.decode("utf8").encode('latin1'))
textbuffer.append(str(l))
obj=FreeCAD.ActiveDocument.addObject("App::Annotation","Text")
obj.LabelText=textbuffer
obj.Position=point
@ -1528,7 +1530,6 @@ def getSVG(obj,scale=1,linewidth=0.35,fontsize=12,fillstyle="shape color",direct
svg += '</text>\n</g>\n'
elif getType(obj) == "Annotation":
LINESPACING = 1
"returns an svg representation of a document annotation"
p = getProj(obj.Position)
svg = '<text id="' + obj.Name + '" fill="'
@ -1555,7 +1556,7 @@ def getSVG(obj,scale=1,linewidth=0.35,fontsize=12,fillstyle="shape color",direct
if i == 0:
svg += '<tspan>'
else:
svg += '<tspan x="0" dy="'+str(fontsize+LINESPACING)+'">'
svg += '<tspan x="0" dy="'+str(obj.ViewObject.LineSpacing/2)+'">'
svg += obj.LabelText[i]+'</tspan>\n'
svg += '</text>\n'
print svg

View File

@ -95,11 +95,12 @@ def deformat(text):
sts = re.split("\\\\(U\+....)",t)
ns = u""
for ss in sts:
print ss, type(ss)
if ss.startswith("U+"):
ucode = "0x"+ss[2:]
ns += unichr(eval(ucode))
else:
ns += ss
ns += ss.decode("utf8")
t = ns
# replace degrees, diameters chars
t = re.sub('%%d','°',t)
@ -1145,7 +1146,7 @@ def processdxf(document,filename):
newob.ViewObject.FontSize = FreeCADGui.draftToolBar.fontsize
else:
st = rawValue(dim,3)
newob.ViewObject.FontSize = float(getdimheight(st))
newob.ViewObject.FontSize = float(getdimheight(st))*TEXTSCALING
else:
FreeCAD.Console.PrintMessage("skipping dimensions...\n")