The Birdfont Source Code


All Repositories / birdfont.git / blobdiff – RSS feed

Merge ../birdfont-2.x

Changes made to libbirdfont/Preview.vala

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
--- libbirdfont/Preview.vala +++ libbirdfont/Preview.vala @@ -28,7 +28,7 @@ } public override void selected_canvas () { - MainWindow.set_scrollbar_size (0); + MainWindow.set_scrollbar_size (0); } public static string get_html_path () { @@ -113,11 +113,26 @@ try { dis = new DataInputStream (get_file ().read ()); - preview_directory = BirdFont.get_preview_directory (); + string? d = font.get_export_directory (); + + if (d == null) { + warning ("Export dir is not set."); + ExportTool.set_output_directory (); + d = font.get_export_directory (); + } + + preview_directory = File.new_for_path ((!) d); + + warning (@"previwdir $((!) d)"); + + if (ExportTool.get_export_dir () == null) { + ExportTool.set_output_directory (); + } - f_ttf = get_child (ExportTool.get_export_dir (), @"$(ExportSettings.get_file_name (font)).ttf"); - f_eot = get_child (ExportTool.get_export_dir (), @"$(ExportSettings.get_file_name (font)).eot"); - f_svg = get_child (ExportTool.get_export_dir (), @"$(ExportSettings.get_file_name (font)).svg"); + File dir = File.new_for_path ((!) d); + f_ttf = get_child (dir, @"$(ExportSettings.get_file_name (font)).ttf"); + f_eot = get_child (dir, @"$(ExportSettings.get_file_name (font)).eot"); + f_svg = get_child (dir, @"$(ExportSettings.get_file_name (font)).svg"); if (!f_ttf.query_exists ()) { warning ("TTF file does not exist."); @@ -127,10 +142,14 @@ warning ("SVG file does not exist."); } + string name = ExportSettings.get_file_name_mac (font); + while ((line = dis.read_line (null)) != null) { - line = ((!) line).replace (@"$(ExportSettings.get_file_name (font)).ttf", @"$(TabContent.path_to_uri ((!) f_ttf.get_path ()))?$rid"); - line = ((!) line).replace (@"$(ExportSettings.get_file_name (font)).eot", @"$(TabContent.path_to_uri ((!) f_eot.get_path ()))?$rid"); - line = ((!) line).replace (@"$(ExportSettings.get_file_name (font)).svg", @"$(TabContent.path_to_uri ((!) f_svg.get_path ()))?$rid"); + warning (@"PRE $line name $name rep $(TabContent.path_to_uri ((!) f_ttf.get_path ()))"); + line = ((!) line).replace (@"$name.ttf", @"$(TabContent.path_to_uri ((!) f_ttf.get_path ()))?$rid"); + line = ((!) line).replace (@"$name.eot", @"$(TabContent.path_to_uri ((!) f_eot.get_path ()))?$rid"); + line = ((!) line).replace (@"$name.svg", @"$(TabContent.path_to_uri ((!) f_svg.get_path ()))?$rid"); + warning (@"POST $line"); sb.append ((!) line); }