LoadFonts...again



  • @d-healey makes two of us.... doesnt inspire confidence...I must be doing something wrong.



  • Yeah, font loading is horrible - different OS use other names, sometimes only distinguished by a lowercase / uppercase difference and there is nothing I can do about that except for providing the Engine.getOS() function call 🙂

    Also, if the font is installed on your system, it looks OK, and there's no easy way of testing it on a bare system, except for, well using a clean system without the font installed.

    What you're experiencing sounds to me like you had the font installed, then somehow removed it from your system fonts and now you're relying on the "embedded font", which is using a wrong name / ID.

    Another thing that I'd recommend in order to make sure to use the correct file reference is using the double click feature in the HISE File browser:

    1. Click on a code editor (so that it has the green outline).
    2. Open the file browser. I have copied the fonts into a Font subdirectory of the images and I am not sure if this is necessary or if they can also be in the image root folder.
    3. Double click on the font file and it should paste a valid project folder reference into the code editor. This works with almost any file type and makes sure that you don't type anything wrong.


  • @Christoph-Hart Where have you been man, we missed you. I hope everything is right 😉



  • @Christoph-Hart So, if a font is not installed on a machine, but it present in the project folder and called upon within the project, is it supposed to display properly?
    I built my project on PC where the font is installed. I now opened it on Mac (without the font installed) and it is not displaying, despite the font being present within the project folder.
    Do I need to have it installed on the machine compiling the instrument plugin?



  • @gorangrooves said in LoadFonts...again:

    @Christoph-Hart So, if a font is not installed on a machine, but it present in the project folder and called upon within the project, is it supposed to display properly?
    I built my project on PC where the font is installed. I now opened it on Mac (without the font installed) and it is not displaying, despite the font being present within the project folder.
    Do I need to have it installed on the machine compiling the instrument plugin?

    Did you load it in your script using Engine.loadFontAs();



  • @d-healey Yes. This is what I have.

    Engine.loadFontAs("{PROJECT_FOLDER}Raleway-Regular.ttf", Releway-Regular);
    Engine.loadFontAs("{PROJECT_FOLDER}Raleway-Light.ttf", Releway-Light);
    Engine.loadFontAs("{PROJECT_FOLDER}Raleway-Bold.ttf", Releway-Bold);
    Engine.setGlobalFont(Releway-Regular);
    

    The fonts are placed inside Images directory, but if I specify it, I get an error.

    Engine.loadFontAs("{PROJECT_FOLDER}Images/Raleway-Regular.ttf", Releway-Regular);
    

    or

    Engine.loadFontAs("{PROJECT_FOLDER}/Images/Raleway-Regular.ttf", Releway-Regular);
    

    Produceses and error.



  • @gorangrooves Yes that's correct. When you use {PROJECT_FOLDER} with that function HISE automatically looks in the Images folder.



  • Put quotes around the font name.



  • @Christoph-Hart Still not working. I edited it into the following:

    Engine.loadFontAs("{PROJECT_FOLDER}Raleway-Regular.ttf", "Raleway-Regular");
    Engine.loadFontAs("{PROJECT_FOLDER}Raleway-Light.ttf", "Raleway-Light");
    Engine.loadFontAs("{PROJECT_FOLDER}Raleway-Bold.ttf", "Raleway-Bold");
    Engine.setGlobalFont("Raleway-Regular");
    

    Everthing compiled ok, but the font is not displaying.



  • I think I need to specify "default" as the font for each text item in order for them to display the font.



  • Ah yes, that might be true, it's been a while since I've implemented it, so I don't remember the exact details 🙂


Log in to reply
 

5
Online

446
Users

1.5k
Topics

11.1k
Posts