My Eyes They Bleed, A Partial Fix

Below is a python script I used to generate a Mod to swap out the fonts with something less caustic. There is much room for improvement in font choice - this is the result of 45 minutes of coding, 5 minutes of testing, and 5 minutes of trying out different fonts. However, those 5 minutes did result in 0 crashes, unlike the other font mods I tried. I think they were probably just bit-rotted.

For the slightly technically minded:

Download python for windows (gogo google), paste the following into a text file, open it in python and run it using the Python GUI to create/update the mod, then enable it in the game as normal. Tweak MOD_FOLDER and BASE_FONT_FOLDER as required for your install. Once you have come up with your awesome font combos package it up as a proper mod and upload it for folks so they don't have to mess around with Python.

BASE_FONT_FOLDER = "C:\\Program Files\\Steam\\steamapps\\common\\sins of a solar empire trinity\\Font"
MOD_FOLDER = "C:\\Users\\Rob\\AppData\\Local\\Ironclad Games\\Sins of a Solar Empire\\Mods-Diplomacy v1.34"
MOD_NAME = "YourFont"

import os
MOD_DIR = os.path.sep.join([MOD_FOLDER,MOD_NAME])
FONT_DIR = os.path.sep.join([MOD_DIR,"Font"])

FONT_SUBS = {}

FONT_SUBS["SinsAgencyBold-14"] = ("Verdana","14")
FONT_SUBS["SinsAgencyBold-16"] = ("Verdana","16")
FONT_SUBS["SinsAgencyBold-18"] = ("Verdana","18")
FONT_SUBS["SinsAgencyBold-22"] = ("Verdana","22")
FONT_SUBS["SinsAgencyBold-24"] = ("Verdana","24")
FONT_SUBS["SinsAgencyBold-28"] = ("Verdana","28")
FONT_SUBS["SinsAgencyBold-30"] = ("Verdana","30")
FONT_SUBS["SinsAgencyBold-32"] = ("Verdana","32")
FONT_SUBS["SinsAgencyBold-42"] = ("Verdana","42")
FONT_SUBS["SinsAgencyBold-60"] = ("Verdana","60")

FONT_SUBS["SinsArialBold-11"] = ("Verdana","11")
FONT_SUBS["SinsArialBold-12"] = ("Verdana","12")

FONT_SUBS["SinsArialBlack-32"] = ("Verdana","32")

FONT_SUBS["Courier New-11"] = ("Verdana","11")

for fldr in [MOD_DIR,FONT_DIR]:
        if not os.path.exists(fldr):
                os.mkdir(fldr)
for x in os.listdir(BASE_FONT_FOLDER):
        if x.lower().endswith(".font"):
                src_filename = os.path.sep.join([BASE_FONT_FOLDER, x])
                dest_filename = os.path.sep.join([FONT_DIR, x])
                f = open(src_filename, "rb")
                g = open(dest_filename, "wb")
                b = ""
                o = ""
                fnt_size = False
                fnt_face = False
                wrote_info = False
                for x in f.read():
                        b += x
                        if x == "\n":
                                height_chk = b.find("Height ")
                                face_chk = b.find("TypeFaceName ")
                                if height_chk != -1:
                                        height_idx = height_chk+len("Height ")
                                        fnt_size = int(b[height_idx:].strip())
                                elif face_chk != -1:
                                        face_idx = face_chk+len("TypeFaceName ")
                                        fnt_face = b[face_idx:].replace('"','').strip()
                                else:
                                        o += b
                                b = ""
                        if not wrote_info and fnt_size and fnt_face:
                                fnt_idx = "%s-%s" % (fnt_face,fnt_size)
                                if FONT_SUBS.has_key(fnt_idx):
                                        fnt_face,fnt_size = FONT_SUBS[fnt_idx]
                                else:
                                        print "No substitution for %s found." % (fnt_idx)
                                o += "\t\tHeight "+str(fnt_size)+"\r\n"
                                o += "\t\tTypeFaceName \""+fnt_face+"\"\r\n"
                                wrote_info = True
                if not wrote_info and fnt_size and fnt_face:
                        fnt_idx = "%s-%s" % (fnt_face,fnt_size)
                        if FONT_SUBS.has_key(fnt_idx):
                                fnt_face, fnt_size = FONT_SUBS[fnt_idx]
                        else:
                                print "No substitution for %s found." % (fnt_idx)
                        o += "\t\tHeight "+str(fnt_size)+"\r\n"
                        o += "\t\tTypeFaceName "+fnt_face+"\r\n"
                        wrote_info = True
                o += b
                g.write(o)
                f.close()
                g.close()

13,473 views 4 replies +1 Loading…
Reply #1 Top

now mine are. 

Post a screenshot of what all that does.

Reply #2 Top

and I can see TWO errors in the first two lines

line 1 STEAM ONLY version of sins diplomacy 1.34 (will break if NOT steam diplomacy 1.34. get the path to the sins programs from the sins registry values)

line 2 only username of ROB will get the change and ALL other user names will NOT have anything done. (use the appdata system value)

the third error is that the 'code' looks like garbage. try to re-write it as a dos batch file OR vb OR c+ code

assigned marks 0

harpo

 

Reply #3 Top

assigned marks 0

oprah

Reply #4 Top

carbo, you will score 1/16(your maximum marks before is 44, so with the correction you can score a maximum of 2.75 marks) what you might otherwise, as the convertdata-entrenchment1.041.exe is FROM stardock/ironclad and I had only added the version number and only use it as a external task for the actual conversion between bin/text modes for the files.idenitfy the SOURCE of the files, not just the path. your corrected score is 0

harpo