How to change fonts for each skin

I have had a hard time finding the right place to put font files and where to configure them in order to change the fonts on my Gameshell. I am currently using the most recent DEOT build, but using the legacy skin. I could not find a thread dedicated to this topic, so I apologize if this info is already out there.

If you have changed the fonts for the main menu, how did you do it and what files/directories did you have to change? How does this change when you create or edit a skin?

From what I managed to figure out, the fonts are hard coded in the launcher code.
The file names are as follows:

NotoSansCJK-Regular.ttf   
NotoSansMono-Regular.ttf
VarelaRound-Regular.ttf
VeraMono.ttf

The easiest way to change them would be to replace the files with some other ones after renaming them to the above.

Default skin location: /home/cpi/launcher/skin/default/truetype
This should also work for other skins: /home/cpi/skins/{skin-name}/truetype

Unfortunately I didn’t go as far as determining what font is used where, so I would too appreciate if someone was able to clear this bit up.

Okay that is good to know. I did find these files and the skin manager file that references them in my search. However, when I added my own font, I did not change its name to match. I, instead, tried to change the names in the skin manager file code. That ended up causing the GUI for the launcher to get stuck on reloading.

Also, I believe that the main font you would need to change is the Varela font, because in the code this file had the most references and size variations. Still don’t know where all the rest appear, but for anyone trying to change the launcher I would start with Varela.

I have done some digging, and from my limited python experience, I have found the source for the names of the fonts is in the skin_manager.py file in the launcher’s sys.py folder. I will struggle to try to explain how exactly this file works, but in an ideal situation I would change the SetFonts() function in this file to accept and parse a config file, like in the SetColors() function. This way you could keep track of the fonts you are using, and keep their names in the truetype folder. However, they would still be referenced around the user interface by their variable names like “varela%i” % fontweight.

Example of the color config.ini file parser in skin_manager.py:

    self._Config = CaseConfigParser()

    fname = config.SKIN+"/config.ini"

    try:
        self._Config.read(fname)
    except Exception, e:
        print("read skin config.cfg error %s" % str(e))
        return
    else:
        if "Colors" in self._Config.sections():
            colour_opts = self._Config.options("Colors")
            for i in SkinManager._Colors:
                if i in colour_opts:
                    try:
                        SkinManager._Colors[i] = self.ConvertToRGB(
                            self._Config.get("Colors", i))
                    except Exception, e:
                        print("error in ConvertToRGB %s" % str(e))
                        continue

When I tried to change it, and add a section to the config file, my launcher stopped loading and I had to reverse it. I will keep trying to adapt it, but I have very limited python knowledge.

I figured it out. No doubt it is messy code, but I have a new skin_manager.py code that checks for a Font_Path section in the config.ini file for every skin. Then it will take the font names in that file and find the path to them in the truetype folder. These paths are given variable names that match the original fonts in the launcher truetype folder.

How should I upload my code so that others can access it? I am unfamiliar with how to properly fork or contribute to a github repository.

1 Like

in github fork the clockwork repo using the “fork” button
git clone it locally to your computer

git clone your repo url

make your modifications, and made a commit about it

git commit -m “commit name reflecting your modification”

push your commit onto your fork

git push

back into github, into your repo and commit, search about a “pull request” button,
it will create a ticket about merging your commit into the main repo, with a discussion thread and all the needed test and tools

2 Likes

I believe I have updated it… I did it through the GitHub website?

3 Likes

well done :slight_smile:

2 Likes