Skip to contentSkip to conversation

add dejavu-fonts to image

DISCUSSION idealsim 2 participants 8 messages Oct 11, 2016 – Oct 17, 2016

lore
Share & tools
lore

idealsim

author
#0 lore raw

Hi, i have build an image for an imx6 card (secoA62) based on this good layer https://github.com/graugans/meta-udoo (krogoth branch). All work fine but since the last version of qt 5.7, qtbase-font is not provided and now i have this error when i deploy an app :

/QFontDatabase: Cannot find font directory /usr/lib/fonts.//
//Note that Qt no longer ships fonts. Deploy some (from //http://dejavu-fonts.org//for example) or switch to fontconfig./

Apparently we need to provide fonts with yocto now. Can you advise me how i can add ttf-dejavu to the image. I have tried to add it to my local.conf like this :

IMAGE_INSTALL_append = "\

            ttf-dejavu \

"

but i have an error during the build of the image rootfs !

Can you help please ?

Mickaël LE STEPHAN

#1 lore raw

Hello,

In fact, the ttf-dejavu recipe doesn't provide a package with the same name. If you look at the PACKAGES variable, you'll find that it provides ${PN}-sans, ${PN}-sans-mono, ${PN}-sans-condensed, ${PN}-serif , ${PN}-serif-condensed & ${PN}-mathtexgyre.

So you have to explicitly choose the packages you want.

Michel

author
#2 lore raw

Hello, thanks a lot the build work now !
But i have another issue, i would like to install the font in /usr/lib/fonts, this is not the case for the moment (it 's for Qt5.7 use). How i can said to yocto to install font (.ttf) on this folder please ?

regards

Mickaël

Quoted 9 lines · Michel D'HOOGE

Hello,

In fact, the ttf-dejavu recipe doesn't provide a package with the same name. If you look at the PACKAGES variable, you'll find that it

Quoted 1 line

provides ${PN}-sans, ${PN}-sans-mono, ${PN}-sans-condensed, ${PN}-serif

, ${PN}-serif-condensed & ${PN}-mathtexgyre.

Quoted 3 lines

So you have to explicitly choose the packages you want.

Michel

Signature · 1 line
Utilisant le logiciel de courrier d'Opera : http://www.opera.com/mail/
#3 lore raw

Hello, thanks a lot the build work now !

I'm very proud: this is the 1st time I can help someone on Yocto! This means a lot to me ;-)

<blockquote>

But i have another issue, i would like to install the font in /usr/lib/fonts, this is not the case for the moment (it 's for Qt5.7 use). How i can said to yocto to install font (.ttf) on this folder please ? </blockquote>
I also need to use Qt5.7, but since I'm currently on other tasks, you discover the troubles a couple of hours before me. So let's try to debug this together…
<blockquote>

</blockquote>

1/ File ttf-dejavu_2.37.bb includes (requires) ttf.inc that is in the same folder. 2/ File ttf.inc has the following method:

do_install() {
install -d ${D}${datadir}/fonts/truetype/
find ./ -name '*.tt[cf]' -exec install -m 0644 {} ${D}${datadir}/fonts/truetype/ \; }

which is in turn appended by dejavu with:

do_install_append () {
install -d ${D}${sysconfdir}/fonts/conf.d/
install -m 0644 ${WORKDIR}/30-dejavu-aliases.conf ${D}${sysconfdir}/fonts/conf.d/ }

3/ The log of the install task of the recipe is /tmp/work/all-poky-linux/ttf-dejavu/2.37-r7/temp/run.do_install We have:

export datadir="/usr/share"

export sysconfdir="/etc"

I compared to my Debian system: the files are stored in the same folders. So it seems this is qt that doesn't search in the "correct" place.

4/ After some grepping in meta-qt5, I have:

classes/qmake5_paths.bbclass
OE_QMAKE_PATH_LIBS = "${libdir}"

classes/qmake5_paths.bbclass OE_QMAKE_PATH_QT_FONTS = "${OE_QMAKE_PATH_LIBS}/fonts"

5/ But I don't know what is the best solution now. We could change the OE_QMAKE_PATH_QT_FONTS variable. But this implies to recompile many pieces, I believe.

So I opt for changing the do_install function. The quick & dirty solution is to create a ttf-dejavu_2.37.bbappend file that totally redefine the do_install method.

do_install() {
install -d ${D}${datadir}/fonts/truetype/
find ./ -name '*.tt[cf]' -exec install -m 0644 {} ${D}${ libdir }/fonts/truetype/ \;

install -d ${D}${sysconfdir}/fonts/conf.d/
install -m 0644 ${WORKDIR}/30-dejavu-aliases.conf ${D}${sysconfdir}/fonts/conf.d/ }

I can't test it right now, but I hope this helps you.

Michel

author
#4 lore raw

Thanks for this. I will try and let you know the solution worked for me !

regards

Quoted 57 lines · Michel D'HOOGE
Quoted 1 line

Hello, thanks a lot the build work now !

I'm very proud: this is the 1st time I can help someone on Yocto! This means a lot to me ;-)

Quoted 1 line
Quoted 1 line

But i have another issue, i would like to install the font in /usr/lib/fonts, this is not the case for the moment (it 's >>for Qt5.7 use). How i can said to yocto to install font (.ttf) on this folder please ?

I also need to use Qt5.7, but since I'm currently on other tasks, you discover the troubles a couple of hours before >me. So let's try to debug this together…

Quoted 1 line

1/ File ttf-dejavu_2.37.bb includes (requires) ttf.inc that is in the same folder.

2/ File ttf.inc has the following method:

do_install() {
   install -d ${D}${datadir}/fonts/truetype/
   find ./ -name '*.tt[cf]' -exec install -m 0644 {}  

${D}${datadir}/fonts/>truetype/ \;
}

Quoted 1 line

which is in turn appended by dejavu with:

do_install_append () {
   install -d ${D}${sysconfdir}/fonts/conf.d/
   install -m 0644 ${WORKDIR}/30-dejavu-aliases.conf  

${D}${sysconfdir}/fonts/>conf.d/
}

Quoted 1 line

3/ The log of the install task of the recipe is /tmp/work/all-poky-linux/ttf-dejavu/2.37-r7/temp/run.do_install

We have:
export datadir="/usr/share"
export sysconfdir="/etc"

I compared to my Debian system: the files are stored in the same folders. So it seems this is qt that doesn't search >in the "correct" place.

4/ After some grepping in meta-qt5, I have:

classes/qmake5_paths.bbclass
OE_QMAKE_PATH_LIBS = "${libdir}"

classes/qmake5_paths.bbclass OE_QMAKE_PATH_QT_FONTS = "${OE_QMAKE_PATH_LIBS}/fonts"

5/ But I don't know what is the best solution now. We could change the OE_QMAKE_PATH_QT_FONTS variable. >But this implies to recompile many pieces, I believe.

So I opt for changing the do_install function. The quick & dirty solution is to create a ttf-dejavu_2.37.bbappend file >that totally redefine the do_install method.

do_install() {
   install -d ${D}${datadir}/fonts/truetype/
   find ./ -name '*.tt[cf]' -exec install -m 0644 {}  
${D}${libdir}/fonts/>truetype/ \;
   install -d ${D}${sysconfdir}/fonts/conf.d/
   install -m 0644 ${WORKDIR}/30-dejavu-aliases.conf  

${D}${sysconfdir}/fonts/>conf.d/
}

Quoted 1 line

I can't test it right now, but I hope this helps you.

Michel

Signature · 1 line
Utilisant le logiciel de courrier d'Opera : http://www.opera.com/mail/
#5 lore raw

After solving all the QA issues, this bbappend creates RPM packages with fonts in the expected folder. I didn't try to generate an image but I'm quite confident about the result. Michel

do_install() {
    install -d ${D}${libdir}/fonts/
    find ./ -name '*.tt[cf]' -exec install -m 0644 {} ${D}${libdir}/fonts/ \;
    install -d ${D}${sysconfdir}/fonts/conf.d/
    install -m 0644 ${WORKDIR}/30-dejavu-aliases.conf ${D}${sysconfdir}/fonts/conf.d/
}
FILES_${PN}-sans            = "${libdir}/fonts/DejaVuSans.ttf ${libdir}/fonts/DejaVuSans-*.ttf"
FILES_${PN}-sans-mono       = "${libdir}/fonts/DejaVuSansMono*.ttf"
FILES_${PN}-sans-condensed  = "${libdir}/fonts/DejaVuSansCondensed*.ttf"
FILES_${PN}-serif           = "${libdir}/fonts/DejaVuSerif.ttf ${libdir}/fonts/DejaVuSerif-*.ttf"

FILES_${PN}-serif-condensed = "${libdir}/fonts/DejaVuSerifCondensed*.ttf"
FILES_${PN}-mathtexgyre = "${libdir}/fonts/DejaVuMathTeXGyre.ttf"

author
#6 lore raw

Ok, i will test this week end and let you know !

Otherwise, if you build qt5.7 perhaps you can have the same issue like me with sdk, see here for more details :

https://github.com/graugans/meta-udoo/issues/20

regards

Quoted 17 lines · Michel D'HOOGE

After solving all the QA issues, this bbappend creates RPM packages with fonts in the expected folder. I didn't try to generate an image but I'm quite confident about the result. Michel

do_install() {
     install -d ${D}${libdir}/fonts/
     find ./ -name '*.tt[cf]' -exec install -m 0644 {} ${D}${libdir}/fonts/ \;
     install -d ${D}${sysconfdir}/fonts/conf.d/
     install -m 0644 ${WORKDIR}/30-dejavu-aliases.conf ${D}${sysconfdir}/fonts/conf.d/
}
FILES_${PN}-sans            = "${libdir}/fonts/DejaVuSans.ttf ${libdir}/fonts/DejaVuSans-*.ttf"
FILES_${PN}-sans-mono       = "${libdir}/fonts/DejaVuSansMono*.ttf"
FILES_${PN}-sans-condensed  = "${libdir}/fonts/DejaVuSansCondensed*.ttf"
FILES_${PN}-serif           = "${libdir}/fonts/DejaVuSerif.ttf ${libdir}/fonts/DejaVuSerif-*.ttf"

FILES_${PN}-serif-condensed = "${libdir}/fonts/DejaVuSerifCondensed*.ttf"
FILES_${PN}-mathtexgyre = "${libdir}/fonts/DejaVuMathTeXGyre.ttf"

author
#7 lore raw

Re: <DKIM> Re: add dejavu-fonts to image

Hi Michel, your solution work fine thanks a lot for that !

Quoted 30 lines · idealsim

Ok, i will test this week end and let you know !

Otherwise, if you build qt5.7 perhaps you can have the same issue like me with sdk, see here for more details :

https://github.com/graugans/meta-udoo/issues/20

regards

Quoted 19 lines · Michel D'HOOGE

After solving all the QA issues, this bbappend creates RPM packages with fonts in the expected folder. I didn't try to generate an image but I'm quite confident about the result. Michel

do_install() {
     install -d ${D}${libdir}/fonts/
     find ./ -name '*.tt[cf]' -exec install -m 0644 {}  
${D}${libdir}/fonts/ \;
     install -d ${D}${sysconfdir}/fonts/conf.d/
     install -m 0644 ${WORKDIR}/30-dejavu-aliases.conf  

${D}${sysconfdir}/fonts/conf.d/
}

FILES_${PN}-sans            = "${libdir}/fonts/DejaVuSans.ttf ${libdir}/fonts/DejaVuSans-*.ttf"
FILES_${PN}-sans-mono       = "${libdir}/fonts/DejaVuSansMono*.ttf"
FILES_${PN}-sans-condensed  = "${libdir}/fonts/DejaVuSansCondensed*.ttf"
FILES_${PN}-serif           = "${libdir}/fonts/DejaVuSerif.ttf ${libdir}/fonts/DejaVuSerif-*.ttf"

FILES_${PN}-serif-condensed = "${libdir}/fonts/DejaVuSerifCondensed*.ttf"
FILES_${PN}-mathtexgyre = "${libdir}/fonts/DejaVuMathTeXGyre.ttf"

Signature · 1 line
Utilisant le logiciel de courrier d'Opera : http://www.opera.com/mail/