Skip to content

Commit

Permalink
Draft: Fixed text orientation bug in SVG projections
Browse files Browse the repository at this point in the history
  • Loading branch information
yorikvanhavre committed Nov 18, 2016
1 parent ebe6e9a commit 9502071
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Mod/Draft/Draft.py
Expand Up @@ -2150,12 +2150,19 @@ def getText(color,fontsize,fontname,angle,base,text,linespacing=0.5,align="cente
#elif (tangle <= -math.pi/2) or (tangle > math.pi/2):
# tangle = tangle+math.pi
#tbase = tbase.add(DraftVecUtils.rotate(Vector(0,2/scale,0),tangle))
if rotation != 0:
#print "dim: tangle:",tangle," rot: ",rotation," text: ",prx.string
if abs(tangle+math.radians(rotation)) < 0.0001:
tangle += math.pi
tbase = tbase.add(DraftVecUtils.rotate(Vector(0,2/scale,0),tangle))
svg += 'd="M '+str(p1.x)+' '+str(p1.y)+' '
svg += 'L '+str(p2.x)+' '+str(p2.y)+' '
svg += 'L '+str(p3.x)+' '+str(p3.y)+' '
svg += 'L '+str(p4.x)+' '+str(p4.y)+'" '
else:
tangle = 0
if rotation != 0:
tangle = -math.radians(rotation)
tbase = tbase.add(Vector(0,-2.0/scale,0))
svg += 'd="M '+str(p1.x)+' '+str(p1.y)+' '
svg += 'L '+str(p2.x)+' '+str(p2.y)+' '
Expand Down Expand Up @@ -2303,7 +2310,7 @@ def getText(color,fontsize,fontname,angle,base,text,linespacing=0.5,align="cente
n = obj.ViewObject.FontName
a = 0
if rotation != 0:
a = -math.radians(rotation)
a = math.radians(rotation)
t1 = obj.ViewObject.Proxy.text1.string.getValues()
t2 = obj.ViewObject.Proxy.text2.string.getValues()
scale = obj.ViewObject.FirstLine.Value/obj.ViewObject.FontSize.Value
Expand Down

0 comments on commit 9502071

Please sign in to comment.