gwaldron / osgearth

A 3D Mapping Engine & SDK for OpenSceneGraph.
https://www.pelicanmapping.com/home-1/opensource
Other
1.47k stars 774 forks source link

Don't hardcode proprietary fonts #32

Closed volter closed 12 years ago

volter commented 12 years ago

Various files use arial and arialbd fonts.

src/osgEarthFeatures/BuildTextOperator.cpp: std::string font = "fonts/arial.ttf"; src/applications/osgearth_measure/osgearth_measure.cpp: label->setFont( osgText::readFontFile( "arialbd.ttf" ) ); src/applications/osgearth_controls/osgearth_controls.cpp: label->setFont( osgText::readFontFile( "arialbd.ttf" ) ); src/applications/osgearth_elevation/osgearth_elevation.cpp: text->setFont( osgText::readFontFile("arial.ttf") ); src/applications/osgearth_symbology/osgearth_symbology.cpp: symbol->font() = "arial.ttf"; src/osgEarthUtil/Graticule.cpp: t->setFont( "fonts/arial.ttf" ); src/osgEarthUtil/Controls.cpp: setFont( osgText::readFontFile( "arial.ttf" ) ); // TODO: cache this? src/osgEarthUtil/Controls.cpp: setFont( osgText::readFontFile( "arial.ttf" ) ); // TODO: cache this? src/osgEarthUtil/SpatialData.cpp: s_font = osgText::readFontFile( "arialbd.ttf" ); src/osgEarthDrivers/worldwind/ReaderWriterWorldWind.cpp:* Contact: MattFranklin1 at gmail.com src/osgEarthDrivers/debug/DebugTileSource.cpp: _font = osgText::readFontFile( "arial.ttf" ); tests/feature_labels.earth: text-font: arial.ttf;

It'd probably be best not to hardcode at all, and if necessary, don't use proprietary fonts.

gwaldron commented 12 years ago

Can you suggest a default font to use on non-Windows systems?

volter commented 12 years ago

I'm afraid, I can't suggest a font that is available on any system.

I'm not much of a programmer, but I can think of two approaches to this:

volter commented 12 years ago

I didn't mean to close that.

gwaldron commented 12 years ago

Right; if you don't set a font (on Windows) you end up with a non-proportional, very ugly font. So we do need some sort of reasonable default. What is the result on your platform? Does it just fall back on a system font?

gwaldron commented 12 years ago

Believe this is addressed; there's a default font setting in osgEarth::Registry now