The Birdfont Source Code


All Repositories / birdfont.git / commit – RSS feed

Use .birdfont as default file extension instead of .bf

These changes was commited to the Birdfont repository Fri, 10 Aug 2018 15:23:09 +0000.

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
author Johan Mattsson <johan.mattsson.m@gmail.com>
Fri, 10 Aug 2018 15:23:09 +0000 (17:23 +0200)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Fri, 10 Aug 2018 15:23:09 +0000 (17:23 +0200)
commit 6aaa19b5b3756d7543033c35517f97e5b634d960
tree 0cfd0cf8eed78c319d6a852211cd362e0e9abdd8
parent 75d412c520205cca9e8f684398c66c11d0e609d9
Use .birdfont as default file extension instead of .bf

libbirdfont/BirdFontFile.vala
libbirdfont/Font.vala
libbirdfont/FontSettings.vala
libbirdfont/ImportUtils.vala
libbirdfont/RecentFiles.vala
libbirdfont/SaveCallback.vala
--- a/libbirdfont/BirdFontFile.vala +++ b/libbirdfont/BirdFontFile.vala @@ -81,7 +81,7 @@ bool ok; XmlParser parser; - font.font_file = "typeface.bf"; + font.font_file = "typeface.birdfont"; parser = new XmlParser (xml_data); ok = load_xml (parser);
--- a/libbirdfont/Font.vala +++ b/libbirdfont/Font.vala @@ -342,14 +342,14 @@ StringBuilder sb = new StringBuilder (); sb.append (Environment.get_home_dir ()); - sb.append (@"/$(get_name ()).bf"); + sb.append (@"/$(get_name ()).birdfont"); f = File.new_for_path (sb.str); while (f.query_exists ()) { sb.erase (); sb.append (Environment.get_home_dir ()); - sb.append (@"/$(get_name ())$(++i).bf"); + sb.append (@"/$(get_name ())$(++i).birdfont"); f = File.new_for_path (sb.str); } @@ -730,7 +730,7 @@ File file; string backup_file; - new_file = get_child (dir, @"$(name).bf"); + new_file = get_child (dir, @"$(name).birdfont"); backup_file = (!) ((!) new_file).get_path (); try { @@ -751,7 +751,7 @@ string backup_file; BirdFontFile birdfont_file = new BirdFontFile (this); - temp_file = get_child (dir, @"$(name).bf"); + temp_file = get_child (dir, @"$(name).birdfont"); backup_file = (!) ((!) temp_file).get_path (); backup_file = backup_file.replace (" ", "_"); @@ -817,8 +817,8 @@ return; } - if (!path.has_suffix (".bf")) { - warning ("Expecting .bf format."); + if (!path.has_suffix (".bf") && !path.has_suffix (".birdfont")) { + warning ("Expecting .bf or .birdfont format."); return; } @@ -886,7 +886,11 @@ format = FontFormat.FFI; } - if (path.has_suffix (".bf") || path.has_suffix (".BF")) { + if (path.has_suffix (".bf") + || path.has_suffix (".BF") + || path.has_suffix (".BIRDFONT") + || path.has_suffix (".birdfont")) { + loaded = parse_bf_file (path); format = FontFormat.BIRDFONT; }
--- a/libbirdfont/FontSettings.vala +++ b/libbirdfont/FontSettings.vala @@ -42,7 +42,9 @@ File get_settings_file () { File config_directory = BirdFont.get_settings_directory (); - return get_child (config_directory, font_name.replace (".bf", ".config")); + string settings_file = font_name.replace (".bf", ".config"); + settings_file = settings_file.replace (".birdfont", ".config"); + return get_child (config_directory, settings_file); } public void save (string font_file_name) {
--- a/libbirdfont/ImportUtils.vala +++ b/libbirdfont/ImportUtils.vala @@ -67,7 +67,7 @@ if (!font.load ()) { warning (@"Failed to load font $bf_file.\n"); - if (!bf_file.has_suffix (".bf")) { + if (!bf_file.has_suffix (".bf") && !bf_file.has_suffix (".birdfont")) { warning (@"Is it a .bf file?\n"); }
--- a/libbirdfont/RecentFiles.vala +++ b/libbirdfont/RecentFiles.vala @@ -161,11 +161,6 @@ // ignore old backup files if (file_name.has_prefix ("current_font_")) { - continue; - } - - // ignore backup of the current font - if (file_name == @"$(font.get_name ()).bf") { continue; }
--- a/libbirdfont/SaveCallback.vala +++ b/libbirdfont/SaveCallback.vala @@ -49,8 +49,8 @@ font_file_path = f; save (); #else - if (!f.has_suffix (".bf")) { - f = @"$f.bf"; + if (!f.has_suffix (".bf") && !f.has_suffix (".birdfont")) { + f = @"$f.birdfont"; } file_name = @"$(f)"; @@ -95,7 +95,9 @@ f.delete_backup (); fn = f.get_path (); - if (f.font_file != null && fn.has_suffix (".bf")) { + if (f.font_file != null + && (fn.has_suffix (".bf") || fn.has_suffix (".birdfont"))) { + f.set_font_file (fn); MainWindow.native_window.save (); } else {