LoadFonts...again
-
I cant get loadFontAs to work at all...
I've put a ttf font in the images folder of my project its file name is NETTOOFFC.TTF
windows tells me its real name is "Netto Offc"
Engine.loadFontAs("NETTOOFFC.TTF", "Netto");
fails to find the font
Engine.loadFontAs("Netto Offc.TTF", "Netto");
fails to find the font
Engine.loadFontAs("{PROJECT FOLDER}NETTOOFFC.TTF", "Netto");
fails to find the font.
Engine.loadFontAs("{PROJECT FOLDER}Netto Offc.ttf", "Netto");
fails to find the font.
I cant think what else I could do, and clues anyone?
-
@Lindon You're missing an underscore:
{PROJECT_FOLDER}
-
@d-healey Oh what a doofus --- again. Thanks Dave.
-
This is sooooo frustrating - now its lost the font again heres my code:
Engine.loadFontAs("{PROJECT_FOLDER}NETTOOFFC.TTF", "Netto");
(yeah I remembered the underscore this time...)
and this file is in the Fonts fiodler in this instrument.
-
@Lindon You don't have the Fonts folder in your path ;)
-
@d-healey .....aaaaaaand now its found them again.....
so its working with no change to the code... what's going on?
-
@Lindon No idea :p
-
@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:
- Click on a code editor (so that it has the green outline).
- 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. - 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 :)