I need to install a font along with my app and was wondering where the system fonts are on a nokia device and if that directory changes for the various nokia devices.
Kind regards
I need to install a font along with my app and was wondering where the system fonts are on a nokia device and if that directory changes for the various nokia devices.
Kind regards
The default system fonts (ROM, read-only) are in Z:\resource\Fonts.
You can also put fonts in the same corresponding location in phone memory (the C-drive, which is writable NAND Flash).
You need to be careful with installing/overriding system fonts, as it might (depending on the case) also affect not just your own application.
I also once saved an interesting discussion thread on the old Symbian Ltd developer forums by hamishw. As they're no longer around (not sure if there's an archive online), I'll reproduce the text here, in case it is useful:
When requesting a font you supply a requested font spec (which can include name, size, and other attributes including style). When returning a font it will fill in the actual font spec that it is returning (they won't always match exactly). A custom font that is loaded as part of an app is currently then available to everybody as a normal font.
The font matcher does a number of things. First it checks the existing font cache for an exact match to everything in the requested font spec (name, size, attributes etc) - if we have already got this font, by name, either as a bitmap font or as a rasterized (TrueType) font, in the correct size and style, then it returns immediately with this font.
If that didn't work then uses the full-strength font matcher. This gets "best match" to the requested spec from the font stores, based on a number of criteria:
1. Font name (and failing that it will fall back through font family name)
2. Best match on size of font
3. how well all the other attributes match
A correct match to the font name scores very highly, and will practically guarantee the return of that font. Size matching has the next greatest affect - such that a name-size match would almost guarantee a return of the font. This is where Sander is wrong - font name matters a lot. Attributes such as serif, poportional, bold etc. also count but much less so.
There are two other relevant features of the font selection process. Note that the APIs to define these are partner-only:
1. Default font.
This allows the licencee to define, at any given point in (run)time, the name of a default font. If a font spec is requested that does not specify the font name then the default font name will be inserted before starting to look for a font.
2. Font aliases.
One or more aliases can be provided for a real font name - if one of these font aliases is uses then it will still match to the real font. The use case for this is to write applications specifying a standard font name then declare that font name on the device as an alias of the actual font you want used.
Nokia built in apps often use the default font mechanism - i.e. they do not supply a desired font name. What you are seeing could occur if the device "default font" does not map to a real font on the device. In this case the weighting will be done purely on size and attributes (perhaps with some order of evaluation or of font discovery or alpha name order playing a part as well) and the results are a lot more pot luck.
The same thing could happen if system aliases are mapped to real fonts which do not exist on the device.
Its also possible there is another problem here. It may be that the order of evaluation means that if you specify an alias for font A that is the same as the real name of font B then the alias takes precedence - so you can mask a real font with an alias.
The upshot of that discussion is that this is probably a Nokia defect, and as a developer you have limited scope to fix this.
One approach may be to play around with the internal name of the custom font - alphabetic order of font names may affect things. A similar idea might be to play around with the name of the .GDR font file containing the custom font - alphabetic order might affect the order it is loaded versus the default device font files - which might affect the storage order of the fonts and thus their evaluation order.
Sorry another quick question i have been using / for my paths in the app but you have stated this Z:\resource\Fonts.
does symbian recognise
Z:\resource\Fonts
and
Z:/resource/Fonts
Both probably work. Use a forward slash (some old Windows-ism reared its ugly head when I wrote my reply, even if I use a Mac ;-)
Hi again
I am trying to install the font when the app gets installed but it doesnt seem to be working. I have even tried to install the font to every possible location so that it may get picked up by my app.
Code:font1.sources1 += fancy.ttf font1.path1 += E:/Resource/Fonts DEPLOYMENT += font1 font2.sources += fancy.ttf font2.path += C:/Resource/Fonts DEPLOYMENT += font2 font3.sources += fancy.ttf font3.path += Z:/Resource/Fonts DEPLOYMENT += font3
Hi, application specific fonts are not supported in Qt at the moment. See http://bugreports.qt.nokia.com/browse/QTBUG-6611
Hi Jakoskin
Thanks for your reply. I am actually using font in my css stylesheets.
It worked in the Nokia N8 simulators, I just copied the font i wanted to use into the simulator directory below:Code:#MainWindow { } QListWidget { border: 3px solid rgb(77, 77, 70); border-radius: 8px; background: white; color: gray; } QLineEdit { border: 3px solid rgb(77, 77, 70); border-radius: 8px; font: 8pt "FancyFont"; background: white; color: gray; }
I was hoping the principle would be the same on a real device?Code:C:\NokiaQtSDK\Simulator\Application\fonts
Right....i manually copied the ttf font into E:/Resource/Fonts and restarted device and it worked....i must have forgot to restart the device earlier in my attempts and caused myself a right headache. Thanks to everyone who replied.
I am having issue now that i cannot resolve and could really do with some help. When i manually created the directory E:/resource/Fonts and put my ttf font in there after restarting the device the font was picked up by my app without any issues.
I wouldnt expect a user to install an app and then have to start creating directories, copying font files and then restarting the device, personally i would expect the installation process to do all this.
At present i am trying to copy the font to the correct location using the .pro file below:
This doesnt work at all. Does anyone know how i can create the directory path "E:/resource/Fonts" and then copy a font file to that location. Even better if someone also knows how to restart the device after installation of the sis file.Code:font.sources += fancy.ttf font.path += E:/resource/Fonts DEPLOYMENT += font
Any help would really be appriciated.
Thanks
Last edited by ginda1; 2010-12-14 at 10:30.
Keywords are sources and path not sources1 and path1.
Sorry jakoskin that was a typo, i have updated the below.