diff options
author | Harley Acheson <harley.acheson@gmail.com> | 2019-05-19 02:40:33 +0300 |
---|---|---|
committer | Harley Acheson <harley.acheson@gmail.com> | 2019-05-19 02:40:33 +0300 |
commit | 5f2578f32fdd3cf49d5299f0553dc756e4f670cf (patch) | |
tree | 65fd9d8faff4c327f94194fa609c382bfec52c1c | |
parent | 1fce0460d5222604e7007518bc246c97286312f3 (diff) |
UI: Default Directory for Windows Fonts
This patch gives new Windows users a better default preference for fonts folder
Differential Revision: https://developer.blender.org/D4725
Reviewed by Campbell Barton and Brecht Van Lommel
m--------- | release/scripts/addons | 0 | ||||
m--------- | release/scripts/addons_contrib | 0 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_appdir.h | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/appdir.c | 14 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_defaults.c | 3 |
5 files changed, 20 insertions, 0 deletions
diff --git a/release/scripts/addons b/release/scripts/addons -Subproject 20f59bfd2bc12cc67d045c11f47b6925e3b2a0a +Subproject 2ce7a5d85cfb21b5832a533af551bfb01502b16 diff --git a/release/scripts/addons_contrib b/release/scripts/addons_contrib -Subproject 2e2931867a5ccb455e16e0ccf19d77530fb5e69 +Subproject 0409b81f45445c2934ad223e430ca7d8970ae5f diff --git a/source/blender/blenkernel/BKE_appdir.h b/source/blender/blenkernel/BKE_appdir.h index e956aeb769a..7d7a16f6702 100644 --- a/source/blender/blenkernel/BKE_appdir.h +++ b/source/blender/blenkernel/BKE_appdir.h @@ -45,6 +45,9 @@ void BKE_appdir_program_path_init(const char *argv0); const char *BKE_appdir_program_path(void); const char *BKE_appdir_program_dir(void); +/* return OS fonts directory */ +bool BKE_appdir_fonts_folder_default(char *dir); + /* find python executable */ bool BKE_appdir_program_python_search(char *fullpath, const size_t fullpath_len, diff --git a/source/blender/blenkernel/intern/appdir.c b/source/blender/blenkernel/intern/appdir.c index c1ea57c5fcc..5c4c7066d64 100644 --- a/source/blender/blenkernel/intern/appdir.c +++ b/source/blender/blenkernel/intern/appdir.c @@ -30,6 +30,7 @@ #include "BLI_listbase.h" #include "BLI_path_util.h" #include "BLI_string.h" +#include "BLI_string_utf8.h" #include "BKE_blender_version.h" #include "BKE_appdir.h" /* own include */ @@ -1024,3 +1025,16 @@ void BKE_tempdir_session_purge(void) BLI_delete(btempdir_session, true, true); } } + +/* Gets a good default directory for fonts */ +bool BKE_appdir_fonts_folder_default(char *dir) +{ + bool success = false; +#ifdef WIN32 + wchar_t wpath[FILE_MAXDIR]; + success = SHGetSpecialFolderPathW(0, wpath, CSIDL_FONTS, 0); + BLI_strncpy_wchar_as_utf8(dir, wpath, FILE_MAXDIR); +#endif + /* TODO: Values for other OSs */ + return success; +} diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c index d13f976a759..604974e5075 100644 --- a/source/blender/blenloader/intern/versioning_defaults.c +++ b/source/blender/blenloader/intern/versioning_defaults.c @@ -94,6 +94,9 @@ void BLO_update_defaults_userpref_blend(void) /* Leave temp directory empty, will then get appropriate value per OS. */ U.tempdir[0] = '\0'; + /* System-specific fonts directory */ + BKE_appdir_fonts_folder_default(U.fontdir); + /* Only enable tooltips translation by default, * without actually enabling translation itself, for now. */ U.transopts = USER_TR_TOOLTIPS; |