Building and Packaging on XStreamOS misses fonts

• Feb 8, 2014 - 10:06
S5 - Suggestion


I'm excited to package MuseScore with our new XStreamOS Desktop based on illumos kernel.
What happens, is that fonts are not installed in the prototype area.
I used cmake and then gmake lrelease and gmake install DESTDIR="..."
I got the prototype area with usr/bin usr/lib user/share/* but fonts from sources are not there.
Application runs, but only in debug mode showing fonts are obviously not there.

What may be the reason?



During the build process the fonts are not installed but packaged in the mscore executable, so if you don't see the noteheads, clefs etc... it's probably because Qt doesn't do a good job of loading these fonts from the virtual filesystem on your OS. Did you build Qt yourself? Can you debug the font loading process?

here is mscore running in debug mode:

gbulfon@xstream:~$ mscore -d
global share: /usr/share/mscore-1.3/
configured localeName system
real localeName en_US
load translator /usr/share/mscore-1.3/locale/mscore_en_US
load translator qt_en_US from /usr/share/qt4/translations
load translator qt_en_US failed
Mscore: fatal error: cannot load internal font
Mscore: fatal error: cannot load internal font
Mscore: fatal error: cannot load internal font MuseJazz.ttf
init audio driver failed
sequencer init failed
printer DPI 96.000000(96) display PDPI 96.000000(96) DPMM 3.779528
LibraryPath: /usr/lib/qt4/plugins
LibraryPath: /usr/bin
Sym: character 0xe104(57604) note 1/2 are not in font MScore1
Sym: character 0xe105(57605) note 1/4 are not in font MScore1
Sym: character 0xe106(57606) note 1/8 are not in font MScore1
Sym: character 0xe107(57607) note 1/16 are not in font MScore1
Sym: character 0xe108(57608) note 1/32 are not in font MScore1
Sym: character 0xe109(57609) note 1/64 are not in font MScore1
Sym: character 0xe10b(57611) dot dot are not in font MScore1
Plugin Path /home/gbulfon/.local/share/data/MusE/MuseScore/plugins
Plugin Path /usr/share/mscore-1.3/plugins
Register Plugin /usr/share/mscore-1.3/plugins/colornotes.js
Error: Unable to import qt.core: no such extension
Error: Unable to import qt.gui: no such extension
Error: Unable to import qt.xml: no such extension
Error: Unable to import no such extension
Error: Unable to import qt.uitools: no such extension
enterState Normal
MuseScore::changeState: STATE_NORMAL
enterState Normal
Register Plugin /usr/share/mscore-1.3/plugins/chordchart.js
add Menu Plugins
add menu Lead Sheet
add action Create Chord Chart
Register Plugin /usr/share/mscore-1.3/plugins/
Register Plugin /usr/share/mscore-1.3/plugins/break/break.js
add action Break Every X Measures
Register Plugin /usr/share/mscore-1.3/plugins/removenotes.js
add action Remove Notes
Register Plugin /usr/share/mscore-1.3/plugins/abc_import/abc_import.js
Register Plugin /usr/share/mscore-1.3/plugins/notenames.js
add action Note Names
MuseScore::changeState: STATE_DISABLED
start event loop...

Yes I build qt-everywhere-opensource-src-4.8.4 myself.
Should I check if internal font-loading is supported?
How can I see if my binary is built with internal font correctly?
Maybe some difference in solaris-like environment while linking?

These 3 lines are denoting the problem of internal font loading

Mscore: fatal error: cannot load internal font
Mscore: fatal error: cannot load internal font
Mscore: fatal error: cannot load internal font MuseJazz.ttf

You may want to take a look around line 1919 in mscore/mscore.cpp. MuseScore calls QFontDatabase::addApplicationFont and this is failing.

Not sure how you can check if the font are correctly embedded in the binary. It's done during the build phase, the fonts are mentioned in mscore/mscore.qrc and should be picked when this file is processed. You should see a file qrc_mscore.cpp or something similar in your build directory.
To learn more about the resource system of Qt you can check

I'm curious to see a screenshot of MuseScore on your system :)

Thanks for the guidelines, these should be enough tips to find the problem ;)

I'll get back to you as soon as I've solved the font problems, and attach a screenshot here
with some of my Sibelius scores imported and running inside MuseScore on XStreamOS Desktop :)

I checked the running mscore with "truss" to see system calls.
I see that just before the error on loading the font, there are calls to open/stat(":/fontfile").
These are file system calls, so in some way qt is not looking at the embedded file, but tries to find it
in the file system.

So, my question is: are all the button icons still embedded resources?
If yes, then qt is ok, because it loads icons correctly.
So maybe the problem is just around font, and addApplicationFont?
Don't you know of any similar problem on solaris like env?

I found a temporary solution:
- patched mscore.cpp to load fonts from "/usr/share/fonts/mscore/..."
- packaged with delivery of /usr/share/fonts/mscore/*.ttf

And now I have a very nice score layout in front of me! :)
Still some bits to resolve....some scripts are not loaded....will get back later...
Later also for a screenshot ;)

Ok. That's great! Only the musical fonts are loaded from the embedded filesystem. Most of the icons are svg/png I think. Your patch is good but it will be slower to load the font. The best way would be to investigate why QFontDatabase::addApplicationFont doesn't work well on your system and then patching Qt since it would benefit other apps on your system.

The non loaded scripts are most likely due to the plugin framework. It's kind of optional so Musescore should be working now.

Here you go with a couple of snapshots!
Just exported from Sibelius two scores I edited a while ago, into xml format.
Loaded, and here they are, almost perfect!

And I must congratulate with you guys, I never tried musescore before, and I waited to have it
built on XStreamOS for my first experience with it.
I have to tell you, the editing is very comfortable, sometimes even faster than Sibelius.

I used to work at a project of my own in the past, called JComposer, same idea, in Java+Swing and Java2D.
Then I stopped, not enough time!

I hope I can help this project, I may help coding here and there ;)
What I find a bit retro, is the qt4 interface. Do they have plans to modernize it?

I'm using mscore-1.3 sources, and they like my qt4:

-- Found Qt4: /usr/bin/qmake (found suitable version "4.8.4", required is "4.6")

Should I step up to a newer mscore + newer qt?

Cool! Yes, you will need at least Qt 5.1 and preferably the last one Qt 5.2 to compile and run MuseScore git master. The interface should be different and the same on all the OSes.
There is a lot more new things in MuseScore git master that should become MuseScore 2.0 "soon"...

I'll give it a try ;)
having qt5 latest is a good thing for our distro, so I will start with this.
is it backward compatible with qt4? I mean, should I deliver both or just have the latest one?

Then, I'll check out the git code and let you know.
Thanks! Cool stuff!

Now I'm trying to get it to play something.
XStreamOS, as a Solaris derivative, has OSS engine.
I have packaged alsa-lib plus plugins to have alsa work over OSS.
Using alsa utils (aplay) it just works fine.

mscore always come out with this (ran with -d):

Alsa_driver: can't set period size to 1024: Invalid argument
init ALSA audio driver failed
init ALSA driver failed
init audio driver failed

We deliver a special conf file for alsa lib to work with oss, /etc/asound.conf:

pcm.oss {
type oss
device /dev/dsp

pcm.!default {
type oss
device /dev/dsp

ctl.oss {
type oss
device /dev/mixer

ctl.!default {
type oss
device /dev/mixer

This works with alsa play.
Do you have any idea what's happening?

Can you attach a screenshot of your Preferences -> I/O in MuseScore? Do you use ALSA directly there or did you build support of Portaudio? Portaudio could possibly talk directly to OSS.

Update about audio playback.

It now works!

I had to package and install portaudio, then rebuild musescore with portaudio, but at first it didn't work.
The I/O panel didn't let me choose any device for portaudio.
So looking at the build log, I could see it had both taken alsa and portaudio, but portaudio was including
alsa as a layer.
So I patched CMakeLists.txt to default with:

set (USE_ALSA 0)
set (HAS_MIDI 1)

on my build, as it does with APPLE.

This allows portaudio to work perfectly on OSS.

I could not make an "if" section, but just patched to just set as I needed.
I don't know what system cmake will detect on my OS, as it does with APPLE and MINGW.
Do you know how to check this?

You could try to add this two lines

# the complete system name, e.g. "Linux-2.4.22", "FreeBSD-5.4-RELEASE" or "Windows 5.1"

# the short system name, e.g. "Linux", "FreeBSD" or "Windows"

Status (old) needs info closed
Status needs info closed

No new for 4 years. I guess MuseScore is available for XStreamOS or there is no need anymore. I close this issue. Please reopen if needed.