[Qgis-developer] Font for tests
Larry Shaffer
larrys at dakotacarto.com
Fri Jan 10 10:45:20 PST 2014
Hi Matthias,
On Fri, Jan 10, 2014 at 10:29 AM, Matthias Kuhn <matthias.kuhn at gmx.ch>wrote:
> Hi,
>
> I was looking at some of the tests, and realized, that the composerhtml
> test fails because of some slight font differences.
>
> Firebug tells me that the following fonts are used (defined by
> bootstrap.css):
>
> "Helvetica Neue",Helvetica,Arial,sans-serif
>
> I don't have any of these Helvetica fonts installed and I am not sure
> about their licensing, but it seems that no package includes them just like
> that. Does anybody know a font which is just available out of the box on
> all plattforms to get around such issues? Arial maybe?
>
> This option seems much better to me than fixing things with a tolerance
> param.
>
About a year ago, I added a custom built, very lightweight font,
FreeSansQGIS, just for tests [0], based off of FreeSans. Usage info is
explained in its README [1], notably that the font not be installed on the
system. It is intended to be loaded on-the-fly via Qt's font-handling
routines, and is already available in the utilities.py module via
loadTestFont() [2].
I have also added it to the startup functionality of the QGIS app and
server [3], which loads the font if the testdata directory is available,
e.g. when running ctest from build directory. Feel free to fix anything
wrong with my implementation.
Regardless, I have still seen differences in how the same font is drawn by
the different systems' window server, so some amount of tolerance (or a set
of anomalies) is probably always going to be needed. Though, hopefully
that's not a moving target because of the standardized test font.
Recently I came across another test font used by the MapServer project,
which we might also consider using because it also has bold face [4]. Not
sure how it compares to the 'normal' Vera font. However, I think if it is
used it should still be renamed to FreeSansQGIS to avoid conflict with
installed fonts, and make it easily searchable in the QFontDatabase.
[0] https://github.com/qgis/QGIS/tree/master/tests/testdata/font
[1]
https://github.com/qgis/QGIS/blob/master/tests/testdata/font/FreeSansQGIS-README.txt
[2]
https://github.com/qgis/QGIS/blob/master/tests/src/python/utilities.py#L218-L228
[3] https://github.com/qgis/QGIS/blob/master/src/app/main.cpp#L739-L746
https://github.com/qgis/QGIS/blob/master/src/mapserver/qgis_map_serv.cpp#L244-L253
[4] https://github.com/mapserver/mapserver/tree/master/tests/vera
Regards,
Larry
> Have a nice weekend,
> Matthias
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20140110/de469f87/attachment.html>
More information about the Qgis-developer
mailing list