QML font fallback search - qt

I am developing a chat application with QML that will run on Windows (from 7 to 10). I want to be able to display messages in any languages (Japanese for instance). Does QML fallback to any font installed system-wide until it find a font with the asked glyph? To put it another way, if I make sure my system has at least a font for any language would it be displayed correctly in QML without doing anything special?

Related

Qt Widgets scaling for multiple platforms and languages

I have a Qt project localized to two languages. Moreover it has to work on 3 platforms: Windows, Mac and Linux. I have some issues with scaling of text: one language may be longer that another and Linux native look (Fusion) is 'wider' too. Unfortunately, I can't even check how it looks on Mac (I have to ask other people to compile this project and prepare release).
I'm afraid that I have to switch style of this project to Fusion because it looks the same on all platforms: than I'll have to handle only localization scaling (If I set the same font and its size for all platforms too). Are there other solutions how to handle scaling of text and widgets for 3 platforms and 2 languages?
In case of switching to Fusion, I can set Fusion as default style for preview (STRL+SHIFT+R in Qt Creator) but I do not know how to set Fusion as default style for designer? Is there a way to do it?
I appreciate any help.

Getting all font families in React JS

I am new to ReactJS. I am trying to display all the font families in a dropdown, so that if i select one of the font family the text (displayed in a SVG) font-family will change.
I know in .net we can use System.Drawing.FontFamily.Families to get all the font familes. Like wise in react is there anything? Or else is there any other way to do this?
Thanks in advance...
You want to get all the available fonts on current machine, right?
I think there is no way to do that.
But with some trick we still can list almost available fonts on the current machine with:
1. A list of fonts
Windows fonts
Mac fonts
Some common fonts
2. JavaScript font detector
http://web.mit.edu/jmorzins/www/fonts.html
You got the idea, right? Now we just need to check what fonts are available in our font list and display them in the dropdown.
If you are building a web application using React, then it is impossible. For that matter, it is impossible with any library or framework. There is no JS API exposed by browsers that allow you get a list of all the fonts installed in the system (It can be a security issue).
However, if you are using React to build a Desktop application using electron.js or node-webkit.js, then you can export a binding for system API call to JavaScript and get this list. But it is a very cumbersome process. (I thought of this because you are comparing .net API with Web API.)
In general, as #Jared suggested, that is what most of the online(web applications) tools do when they want to provide font-selection dropdown for users.

How to use Windows raster (.fon) fonts in JavaFX?

For backwards compatibility with the look and feel of existing applications I am looking for support in JavaFX for displaying Windows fonts of type *.fon. Is this possible in JavaFX? I have already tried to use CSS to apply the font named "System" which is defined in 8514sys.fon but it skips that and goes instead to Segoe.

How to use the current phone theme colors and images in QML for Symbian?

I’m developing a Symbian app in QML, my root element is PageStackWindow.
I want it to get the current theme’s “app background image”, instead of the default Nokia theme one.
Also, when I press on a ListItem, I want it to take the current theme “on list item pressed” image.
I have searched a lot but couldn’t figure out how to do this.. but I’m guessing that platformStyle and privateStyle are related to this somehow, unfortunately I didn’t find any docs about them.
Thanks in advance.
It sounds like you are working with the QtQuick Components with the SYmbian theme. platformStyle and privateStyle are both defined internally by the components pack to replicate the Symbian theme, not by the Symbian OS itself. You most likely need to find some sort of system call you can make in C++ to get the background image. The components have no ties or calls into the OS itself. This is so they can be used on any platform.

Incorrect font rendering in Qt (Symbian)

I've been trying to get custom font rendering working in a Symbian Qt app (4.6) for some time. For most fonts and most glyphs, it all works just fine using a method similar to this.
However, for the majority of fonts many glyphs are rendered incorrectly - essentially, the wrong glyph is rendered. I've tried a Symbian C++ app using the same loading method, and that does render correctly. So, this does seem like a Qt bug, and in fact all the gory details are here.
Can anyone suggest a workaround to get full TTF font rendering working on Symbian^3 devices in Qt 4.6?
Although I have no experience with Symbian Qt Apps, I was working last year for several months in a dual environment Qt application (Win32 & Mac OS X) which has to do mainly with font rendering.
QFont rendering -in Win32/Mac OS X- in general runs smoothly, but if you have advanced font rendering requirements you may encounter several and severe problems:
a) It's not possible to find if a specific unicode character is really present in a specific font (i.e. it's not possible to totally disable the character-substitution mechanism - you can only provide substitution hints)
b) If you try to load some specific (bad?) TTF/OTF fonts for exclusive use of your application (i.e. to load not-installed fonts to use them in you application) the application crashes and the crash is inside the Qt Libraries code (it's trying to double-free some buffers).
This is a very rare bug to encounter: It was happened to me for just 5-10 fonts out of 90.000 fonts I tested, but it's still annoying if the main task of your application has to do with font-rendering.
My workaround was to use the FreeType2 (open source) library:
-> It never crashes (it just returns an error on bad fonts)
-> It's about 4-5 times faster than QFont rendering
FreeType2 is not a direct replacement for QFont and it for sure requires to spend some extra time to understand some basic (low-level) concepts before using it, but if you really need a fast and reliable library to render any TTF/OTF (+other) font into a gray or bw image, I highly recommend it as the ultimate choice.
The ultimate answer is that this is a QT bug, but happily it is fixed in QT 4.7.2. Now, just have to wait until the Ovi Store accepts Nokia QT 4.7.2 apps....

Resources