Multilingual UI and Fonts?
-
Currently, I'm using specific open-source fonts for UI elements to make the app cross-platform e.g. Open Sans.
If I use Qt Linguist to create translation files, then how would Qt choose which font to use when the language is switched from English to Arabic, Japanese etc which aren't supported by Open Sans?
-
Currently, I'm using specific open-source fonts for UI elements to make the app cross-platform e.g. Open Sans.
If I use Qt Linguist to create translation files, then how would Qt choose which font to use when the language is switched from English to Arabic, Japanese etc which aren't supported by Open Sans?
It does not - linguist only translates texts. If you hard-copde your font in your app and the characters are not available for this font then nothing is drawn. So hard-coding is maybe not the best idea unless you make sure the selected font fits to your language.
-
It does not - linguist only translates texts. If you hard-copde your font in your app and the characters are not available for this font then nothing is drawn. So hard-coding is maybe not the best idea unless you make sure the selected font fits to your language.
@Christian-Ehrlicher What's Qt's strategy for choosing a font? When I open a form in Qt Designer on Windows. It shows "Segoe UI" as the font for every control, but this font isn't isn't available on Mac and can't be distributed either.
Are default font names specified for each platform in framework? so if I don't set one in Qt Designer then it'll use one of the hardcoded ones depending on the platform?
If I decide to go with hardcoded fonts and I have multiple fonts e.g. different fonts for buttons and labels etc. Is there an easy way to substitute fonts across all UIs when language is switched e.g. switch OpenSans with font A, Roboto with font B? without having to do it for each individual widget?
-
@Christian-Ehrlicher What's Qt's strategy for choosing a font? When I open a form in Qt Designer on Windows. It shows "Segoe UI" as the font for every control, but this font isn't isn't available on Mac and can't be distributed either.
Are default font names specified for each platform in framework? so if I don't set one in Qt Designer then it'll use one of the hardcoded ones depending on the platform?
If I decide to go with hardcoded fonts and I have multiple fonts e.g. different fonts for buttons and labels etc. Is there an easy way to substitute fonts across all UIs when language is switched e.g. switch OpenSans with font A, Roboto with font B? without having to do it for each individual widget?
@Taytoo said in Multilingual UI and Fonts?:
Are default font names specified for each platform in framework?so if I don't set one in Qt Designer then it'll use one of the hardcoded ones depending on the platform?
It's using the font from the OS.
-
@Christian-Ehrlicher What's Qt's strategy for choosing a font? When I open a form in Qt Designer on Windows. It shows "Segoe UI" as the font for every control, but this font isn't isn't available on Mac and can't be distributed either.
Are default font names specified for each platform in framework? so if I don't set one in Qt Designer then it'll use one of the hardcoded ones depending on the platform?
If I decide to go with hardcoded fonts and I have multiple fonts e.g. different fonts for buttons and labels etc. Is there an easy way to substitute fonts across all UIs when language is switched e.g. switch OpenSans with font A, Roboto with font B? without having to do it for each individual widget?
If I decide to go with hardcoded fonts and I have multiple fonts e.g. different fonts for buttons and labels etc. Is there an easy way to substitute fonts across all UI widgets/application when language is switched e.g. switch OpenSans with font A, Roboto with font B etc without having to do it for each individual widget?
-
If I decide to go with hardcoded fonts and I have multiple fonts e.g. different fonts for buttons and labels etc. Is there an easy way to substitute fonts across all UI widgets/application when language is switched e.g. switch OpenSans with font A, Roboto with font B etc without having to do it for each individual widget?
-
If I decide to go with hardcoded fonts and I have multiple fonts e.g. different fonts for buttons and labels etc. Is there an easy way to substitute fonts across all UI widgets/application when language is switched e.g. switch OpenSans with font A, Roboto with font B etc without having to do it for each individual widget?
Hi,
QApplication::setFont should do the job. That said, take into account the warning about mixing that method and style sheet.
-
@Taytoo
So far as I know, if a widget has an explicit font set on it you would have to change that at runtime, on each widget. Could you use stylesheets for all your font rules instead, it would be easier to change that once at runtime?@JonB said in Multilingual UI and Fonts?:
@Taytoo
So far as I know, if a widget has an explicit font set on it you would have to change that at runtime, on each widget. Could you use stylesheets for all your font rules instead, it would be easier to change that once at runtime?Think this might be a better option, and easy to manage as well.
@SGaist said in Multilingual UI and Fonts?:
Hi,
QApplication::setFont should do the job. That said, take into account the warning about mixing that method and style sheet.
Wouldn't that just set specified font for all widgets? I'like to substitute different fonts. I use three font styles so need to substitute them accordingly e.g. Font A -> B, Font X -> Y, Font J -> K
-
@JonB said in Multilingual UI and Fonts?:
@Taytoo
So far as I know, if a widget has an explicit font set on it you would have to change that at runtime, on each widget. Could you use stylesheets for all your font rules instead, it would be easier to change that once at runtime?Think this might be a better option, and easy to manage as well.
@SGaist said in Multilingual UI and Fonts?:
Hi,
QApplication::setFont should do the job. That said, take into account the warning about mixing that method and style sheet.
Wouldn't that just set specified font for all widgets? I'like to substitute different fonts. I use three font styles so need to substitute them accordingly e.g. Font A -> B, Font X -> Y, Font J -> K
@Taytoo said in [Multilingual UI and Fonts?]:
Wouldn't that just set specified font for all widgets? I'like to substitute different fonts. I use three font styles so need to substitute them accordingly e.g. Font A -> B, Font X -> Y, Font J -> K
Indeed, my bad, I misunderstood the scope of your issue.