titler fixes, auto paste bug, resize popup hang, focus policy fix, chk lang
[goodguy/history.git] / cinelerra-5.1 / guicast / bcresources.C
index cd56baaf31158ad5913374206bba6e0253cb29c4..6e8e1ca7aaf70fa1f8ae419c8fbcf72316d0335c 100644 (file)
@@ -644,7 +644,7 @@ BC_Resources::BC_Resources()
        tooltip_delay = 1000;
        tooltip_bg_color = YELLOW;
        tooltips_enabled = 1;
-       textbox_focus_policy = LEAVE_DEACTIVATE;
+       textbox_focus_policy = 0;
 
        filebox_margin = 110;
        dirbox_margin = 90;
@@ -831,9 +831,21 @@ int BC_Resources::init_fontconfig(const char *search_path)
 } while(0)
 
        char find_command[BCTEXTLEN];
-       sprintf(find_command,
-               "find %s -name 'fonts.dir' -print -exec cat {} \\;",
-               search_path);
+       char *fp = find_command, *ep = fp+sizeof(find_command)-1;
+       fp += snprintf(fp, ep-fp, "find '%s'", search_path);
+       const char *bc_font_path = getenv("BC_FONT_PATH");
+       if( bc_font_path ) {
+               const char *path = bc_font_path;
+               for( int len=0; *path; path+=len ) {
+                       const char *cp = strchr(path,':');
+                       len = !cp ? strlen(path) : cp-path;
+                       char font_path[BCTEXTLEN];
+                       memcpy(font_path, path, len);  font_path[len] = 0;
+                       if( cp ) ++len;
+                       fp += snprintf(fp, ep-fp, " '%s'", font_path);
+               }
+        }
+       fp += snprintf(fp, ep-fp, " -name 'fonts.scale' -print -exec cat {} \\;");
        FILE *in = popen(find_command, "r");
 
        FT_Library freetype_library = 0;
@@ -864,7 +876,7 @@ int BC_Resources::init_fontconfig(const char *search_path)
                entry->path = cstrcat(2, current_dir, string);
 // Foundary
                skip_str(" -", in_ptr);
-               get_str(string, " -\n", in_ptr, 1);
+               get_str(string, "-\n", in_ptr, 1);
                if( !string[0] ) { delete entry;  continue; }
                entry->foundry = cstrdup(string);
                if(*in_ptr == '-') in_ptr++;
@@ -956,25 +968,25 @@ int BC_Resources::init_fontconfig(const char *search_path)
                }
 
                if(!strcasecmp(entry->swidth, "normal"))
-                       entry->style = FL_WIDTH_NORMAL;
+                       entry->style |= FL_WIDTH_NORMAL;
                else if(!strcasecmp(entry->swidth, "ultracondensed"))
-                       entry->style = FL_WIDTH_ULTRACONDENSED;
+                       entry->style |= FL_WIDTH_ULTRACONDENSED;
                else if(!strcasecmp(entry->swidth, "extracondensed"))
-                       entry->style = FL_WIDTH_EXTRACONDENSED;
+                       entry->style |= FL_WIDTH_EXTRACONDENSED;
                else if(!strcasecmp(entry->swidth, "condensed"))
-                       entry->style = FL_WIDTH_CONDENSED;
+                       entry->style |= FL_WIDTH_CONDENSED;
                else if(!strcasecmp(entry->swidth, "semicondensed"))
-                       entry->style = FL_WIDTH_SEMICONDENSED;
+                       entry->style |= FL_WIDTH_SEMICONDENSED;
                else if(!strcasecmp(entry->swidth, "semiexpanded"))
-                       entry->style = FL_WIDTH_SEMIEXPANDED;
+                       entry->style |= FL_WIDTH_SEMIEXPANDED;
                else if(!strcasecmp(entry->swidth, "expanded"))
-                       entry->style = FL_WIDTH_EXPANDED;
+                       entry->style |= FL_WIDTH_EXPANDED;
                else if(!strcasecmp(entry->swidth, "extraexpanded"))
-                       entry->style = FL_WIDTH_EXTRAEXPANDED;
+                       entry->style |= FL_WIDTH_EXTRAEXPANDED;
                else if(!strcasecmp(entry->swidth, "ultraexpanded"))
-                       entry->style = FL_WIDTH_ULTRAEXPANDED;
+                       entry->style |= FL_WIDTH_ULTRAEXPANDED;
                else
-                       entry->style = FL_WIDTH_NORMAL;
+                       entry->style |= FL_WIDTH_NORMAL;
 
                fontlist->append(entry);
 //             printf("TitleMain::build_fonts %s: success\n",  entry->path);