Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenfont/intern/blf_dir.c')
-rw-r--r--source/blender/blenfont/intern/blf_dir.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/source/blender/blenfont/intern/blf_dir.c b/source/blender/blenfont/intern/blf_dir.c
index d87262522d8..92dfe8457b0 100644
--- a/source/blender/blenfont/intern/blf_dir.c
+++ b/source/blender/blenfont/intern/blf_dir.c
@@ -173,3 +173,37 @@ int blf_dir_split(const char *str, char *file, int *size)
}
return(0);
}
+
+/* Some font have additional file with metrics information,
+ * in general, the extension of the file is: .afm or .pfm
+ */
+char *blf_dir_metrics_search(char *filename)
+{
+ char *mfile;
+ char *s;
+
+ mfile= BLI_strdup(filename);
+ s= strrchr(mfile, '.');
+ if (s) {
+ if (strlen(s) < 4) {
+ MEM_freeN(mfile);
+ return(NULL);
+ }
+ s++;
+ s[0]= 'a';
+ s[1]= 'f';
+ s[2]= 'm';
+
+ /* first check .afm */
+ if (BLI_exist(s))
+ return(s);
+
+ /* and now check .pfm */
+ s[0]= 'p';
+
+ if (BLI_exist(s))
+ return(s);
+ }
+ MEM_freeN(mfile);
+ return(NULL);
+}