2017-02-24 17:56:57 -03:00
|
|
|
// Aseprite
|
2018-02-21 10:39:30 -03:00
|
|
|
// Copyright (C) 2017-2018 David Capello
|
2017-02-24 17:56:57 -03:00
|
|
|
//
|
|
|
|
// This program is distributed under the terms of
|
|
|
|
// the End-User License Agreement for Aseprite.
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "app/font_path.h"
|
|
|
|
|
|
|
|
#include "base/fs.h"
|
|
|
|
|
|
|
|
namespace app {
|
|
|
|
|
2017-10-09 11:55:20 -03:00
|
|
|
std::string find_font(const std::string& firstDir,
|
|
|
|
const std::string& filename)
|
2017-02-24 17:56:57 -03:00
|
|
|
{
|
2017-10-09 11:55:20 -03:00
|
|
|
std::string fn = base::join_path(firstDir, filename);
|
|
|
|
if (base::is_file(fn))
|
|
|
|
return fn;
|
|
|
|
|
2018-02-21 10:39:30 -03:00
|
|
|
base::paths fontDirs;
|
2017-02-24 17:56:57 -03:00
|
|
|
get_font_dirs(fontDirs);
|
|
|
|
|
|
|
|
for (const std::string& dir : fontDirs) {
|
|
|
|
fn = base::join_path(dir, filename);
|
|
|
|
if (base::is_file(fn))
|
|
|
|
return fn;
|
|
|
|
}
|
|
|
|
|
|
|
|
return std::string();
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace app
|