Skip to content

Commit

Permalink
Draft: use latin1 in texts if coin < 4 - issue #1404
Browse files Browse the repository at this point in the history
  • Loading branch information
yorikvanhavre committed May 3, 2014
1 parent e0e6f9b commit 32d7839
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/Mod/Draft/Draft.py
Expand Up @@ -342,6 +342,7 @@ def removeHidden(objectslist):
for o in objectslist:
if o.ViewObject:
if not o.ViewObject.isVisible():

newlist.remove(o)
return newlist

Expand Down Expand Up @@ -877,8 +878,11 @@ def makeText(stringslist,point=Vector(0,0,0),screen=False):
textbuffer = []
for l in stringslist:
try:
# only available in Coin3D >= 4.0
textbuffer.append(str(l))
from pivy import coin
if coin.COIN_MAJOR_VERSION >= 4:
textbuffer.append(str(l))
else:
textbuffer.append(l.decode("utf8").encode('latin1'))
except:
textbuffer.append(l.decode("utf8").encode('latin1'))
obj=FreeCAD.ActiveDocument.addObject("App::Annotation","Text")
Expand Down Expand Up @@ -1753,7 +1757,6 @@ def getText(color,fontsize,fontname,angle,base,text,linespacing=0.5,align="cente
svg += text[i].decode("utf8")
svg += '</tspan>\n'
svg += '</text>\n'
print svg
return svg


Expand Down Expand Up @@ -3204,8 +3207,11 @@ def updateData(self, obj, prop):
if hasattr(obj.ViewObject,"Override"):
if obj.ViewObject.Override:
try:
# only available in Coin3D >= 4.0
self.string = obj.ViewObject.Override.encode("utf8").replace("$dim",self.string)
from pivy import coin
if coin.COIN_MAJOR_VERSION >= 4:
self.string = obj.ViewObject.Override.encode("utf8").replace("$dim",self.string)
else:
self.string = obj.ViewObject.Override.encode("utf8").replace("$dim",self.string).decode("latin1")
except:
self.string = obj.ViewObject.Override.encode("utf8").replace("$dim",self.string).decode("latin1")
self.text.string = self.text3d.string = self.string
Expand Down

0 comments on commit 32d7839

Please sign in to comment.