Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FontConfig] [osg] [OsgEarth] Fontconfig error: Cannot load default config file: No such file: (null) #25776

Closed
coderc264 opened this issue Jul 14, 2022 · 4 comments
Assignees
Labels
category:question This issue is a question

Comments

@coderc264
Copy link

Describe the bug
i am trying to get a small test program to work. but at run time i get this error:
Fontconfig error: Cannot load default config file: No such file: (null)
i'm tried to put the "/installed\x64-windows\etc\fonts" in the path varable but doesn't work

Environment

  • OS: Windows 11
  • Compiler:Microsoft Visual Studio Community 2022 (64 bit) - Current Version 17.2.3

To Reproduce
Steps to reproduce the behavior:

  1. ./vcpkg install osg:x64-windows osgearth:x64-windows
  2. See error
    Repro code when

Expected behavior
Fontconfig error: Cannot load default config file: No such file: (null)
Error reading file C:/WINDOWS/fonts\CascadiaCode.ttf: file not handled
Error reading file ..\tests\openstreetmap_flat.earth: file not handled
[osgEarth]* [MapNodeHelper] No valid earth file loaded - aborting
[osgEarth]

Code
`//#include <osgEarth/ImGui/ImGui>
#include <osgEarth/EarthManipulator>
#include <osgEarth/ExampleResources>
#include <osgEarth/Metrics>
#include <osgViewer/Viewer>

#define LC "[imgui] "

using namespace osgEarth;
using namespace osgEarth::Util;

int
usage(const char* name)
{
OE_NOTICE
<< "\nUsage: " << name << " file.earth" << std::endl
<< MapNodeHelper().usage() << std::endl;
return 0;
}

int
main(int argc, char** argv)
{
osgEarth::initialize();

osg::ArgumentParser arguments(&argc, argv);
if (arguments.read("--help"))
    return usage(argv[0]);

osgViewer::Viewer viewer(arguments);
viewer.setThreadingModel(viewer.SingleThreaded);
viewer.setCameraManipulator(new EarthManipulator(arguments));

// Call this to enable ImGui rendering.
// If you use the MapNodeHelper, call this first.
//viewer.setRealizeOperation(new GUI::ApplicationGUI::RealizeOperation);

osg::ref_ptr<osg::Node> node = MapNodeHelper().loadWithoutControls(arguments, &viewer);
if (node.valid())
{
    // Call this to add the GUI. 
    // Passing "true" tells it to install all the built-in osgEarth GUI tools.
    // Put it on the front of the list so events don't filter
    // through to other handlers.
  //  viewer.getEventHandlers().push_front(new GUI::ApplicationGUI(arguments, true));
    viewer.setSceneData(node);
    return Metrics::run(viewer);
}
else
{
    return usage(argv[0]);
}

}`

@Adela0814 Adela0814 added requires:more-information This Issue requires more information to solve labels Jul 15, 2022
@Adela0814
Copy link
Contributor

Please provide the full failure logs.

@coderc264
Copy link
Author

I solved it by setting the system variabile FONTCONFIG_FILE to "\installed\x64-windows\etc\fonts\fonts.conf"

@Adela0814 Adela0814 added category:question This issue is a question and removed requires:more-information This Issue requires more information to solve labels Jul 18, 2022
@DaXiaWei
Copy link

DaXiaWei commented Jun 8, 2023

@coderc264 How to configure this file after porting the program, without using environment variables? I tried to put it in the program root directory, but it didn't work

@tomwillow
Copy link

@coderc264 How to configure this file after porting the program, without using environment variables? I tried to put it in the program root directory, but it didn't work

I put the fonts folder at exe's directory, it works. No need environment variables.

like this:

my app path: D:\project\build_osgearth_demo\Debug\myApp.exe
fonts path: D:\lib\vcpkg\installed\x64-windows\etc\fonts -> D:\project\build_osgearth_demo\Debug\fonts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:question This issue is a question
Projects
None yet
Development

No branches or pull requests

4 participants