Skip to content

Commit

Permalink
A few fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
helios2000 committed Mar 10, 2017
1 parent 447538b commit bd0346e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
6 changes: 3 additions & 3 deletions engine/python/fife/extensions/pychan/fonts.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __init__(self, name, get):
self.font = None
self.name = name
self.typename = get("type")
self.source = get("source")
self.source = str(get("source"))
self.row_spacing = int(get("row_spacing",0))
self.glyph_spacing = int(get("glyph_spacing",0))

Expand All @@ -45,7 +45,7 @@ def __init__(self, name, get):
self.underline = bool(get("underline",False))
self.recoloring = bool(get("recoloring",False))
self.color = map(int,get("color", "255,255,255").split(','))
self.font = get_manager().createFont(self.source, self.size, "")
self.font = get_manager().createFont(self.source, self.size)

if self.font is None:
raise InitializationError("Could not load font %s" % name)
Expand All @@ -72,7 +72,7 @@ def loadFromFile(filename):
@return A new Font object
"""
extension = os.path.splitext(filename)[1]
if extension is ".fontdef":
if extension == ".fontdef":
raise DeprecatedException(str(filename)+" is not a xml file. Fontdef files are deprecated.")
fontXMLFile = FontFileParser()
fontXMLFile.parse(filename, fontXMLFile)
Expand Down
8 changes: 0 additions & 8 deletions engine/python/fife/extensions/serializers/simplexml.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,14 +280,6 @@ def set(self, module, name, value, extra_attrs={}):
elm = ET.SubElement(moduleTree, "Setting", attrs)
elm.text = value

<<<<<<< HEAD
def getModuleName(self):
"""
@return A list of the names of the modules in the XML file as strings.
"""

# Make sure the file has been loaded, if not load it.
=======
def remove(self, module, name):
"""
Removes a variable
Expand Down
14 changes: 10 additions & 4 deletions tools/fontdefupgrader.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,18 @@ def get(section, part, default=""):
xmldef += '\t<font name=\"' + section[5:] + '"'
xmldef += ' type="' + get(section, "type") + '"'
xmldef += ' source="' + get(section, "source") + '"'
xmldef += ' row_spacing="' + get(section, "row_spacing", "0") + '"'
xmldef += ' glyph_spacing="' + get(section, "glyph_spacing", "0") + '"'
if get(section, "row_spacing"):
xmldef += ' row_spacing="' + get(section, "row_spacing") + '"'
if get(section, "glyph_spacing"):
xmldef += ' glyph_spacing="' + get(section, "glyph_spacing") + '"'
if get(section, "type") == "truetype":
xmldef += ' size="' + get(section, "size") + '"'
xmldef += ' antialias="' + get(section, "antialias", "1") + '"'
xmldef += ' color="' + get(section, "color", "255,255,255") + '"'
if get(section, "antialias"):
xmldef += ' antialias="' + get(section, "antialias") + '"'
if get(section, "color"):
xmldef += ' color="' + get(section, "color") + '"'
if get(section, "recoloring"):
xmldef += ' recoloring="' + get(section, "recoloring") + '"'
xmldef += "/>\n"

xmldef += "</fonts>\n"
Expand Down

0 comments on commit bd0346e

Please sign in to comment.