I am writing an application for which a client has provided its own font. The font comes in four separate otf files, one for regular, bold, italics, and bold. If I want to use only one of these four fonts in my class, I create a FontLoader as follows:
FontLoader { id: clientFontRegular; source: "qrc:/client/fonts/Font-Regular.otf" }
and then I can use it for any control on my page, for example:
font.family: clientFontRegular.name
My problem is that I have several controls on my page and I want to use regular expressions for some, bold for some, italics for some others, etc. For this, I added FontLoader objects for other fonts as well, like this:
FontLoader { id: clientFontBold; source: "qrc:/client/fonts/Font-Bold.otf" } FontLoader { id: clientFontItalic; source: "qrc:/client/fonts/Font-Italic.otf" } FontLoader { id: clientFontBoldItalic; source: "qrc:/client/fonts/Font-BoldItalic.otf" }
But this does not work correctly. All four identifiers (clientFontRegular, clientFontBold, clientFontItalic and clientFontBoldItalic) can be used anywhere on the page (i.e., without crashes or ending with the use of the system font), but the font used regardless of what is in bold.
I know that all four of my otf files otf valid, because if I comment on everything except FontLoader for one file and use only one, the custom font is displayed correctly. There seems to be a problem with trying to define multiple FontLoaders in the same class (none of the FontLoader samples I've seen on the Internet use one special font).
Does anyone know how to do this?