Clone in a terminal:
Commit ce99078
Johan Mattsson - 2015-12-22T19:22:19+00:00
ce9907813c3e303a219a4c56b68f999eb1b42fc9johan.mattsson.m@gmail.com

Draw menu over glyph and set size of glyph in overiview

Changed files (3)

Diff

diff --git a/libbirdfont/MenuTab.vala b/libbirdfont/MenuTab.valaindex 0e7345a..1db06d6 100644--- a/libbirdfont/MenuTab.vala+++ b/libbirdfont/MenuTab.vala@@ -326,6 +326,7 @@ public class MenuTab : FontDisplay { 		MainWindow.get_toolbox ().update_expanders (); 		MainWindow.get_toolbox ().update_all_expanders (); 		Toolbox.redraw_tool_box ();+		OverViewItem.glyph_scale = 1; 	} 	 	// FIXME: background threaddiff --git a/libbirdfont/OverView.vala b/libbirdfont/OverView.valaindex 490314e..c1d8cb2 100644--- a/libbirdfont/OverView.vala+++ b/libbirdfont/OverView.vala@@ -387,7 +387,6 @@ public class OverView : FontDisplay { 		KeyBindings.set_require_modifier (true); 		update_scrollbar (); 		update_zoom_bar ();-		OverViewItem.glyph_scale = 1; 		update_item_list (); 		selected_item = get_selected_item (); 		GlyphCanvas.redraw ();@@ -1319,7 +1318,7 @@ public class OverView : FontDisplay { 			} 			index++; 		}-	+ 		if (update) { 			update_item_list (); 		}diff --git a/libbirdfont/OverViewItem.vala b/libbirdfont/OverViewItem.valaindex b48b8b0..15e318d 100644--- a/libbirdfont/OverViewItem.vala+++ b/libbirdfont/OverViewItem.vala@@ -292,11 +292,10 @@ public class OverViewItem : GLib.Object { 		cr.set_line_width (1); 		cr.stroke (); 		cr.restore ();-		+	+		draw_thumbnail (cr, x, y + height);	 		draw_caption (cr); 		draw_menu (cr);-		-		draw_thumbnail (cr, x, y + height); 	}  	public void adjust_scale () {@@ -307,21 +306,22 @@ public class OverViewItem : GLib.Object { 		if (glyphs != null) { 			font = BirdFont.get_current_font (); 			g = ((!) glyphs).get_current ();-			g.boundaries (out x1, out y1, out x2, out y2);-		-			glyph_width = x2 - x1;-			glyph_height = y2 - y1;+			+			if (g.boundaries (out x1, out y1, out x2, out y2)) {+				glyph_width = x2 - x1;+				glyph_height = y2 - y1; -			if (glyph_scale == 1) {-				// caption height is 20-				glyph_scale = (height - 20) / (font.top_limit - font.bottom_limit);	-			}+				if (glyph_scale == 1) {+					// caption height is 20+					glyph_scale = (height - 20) / (font.top_limit - font.bottom_limit);	+				}+				+				scale = glyph_scale;			+				gx = ((width / scale) - glyph_width) / 2; 			-			scale = glyph_scale;			-			gx = ((width / scale) - glyph_width) / 2;-		-			if (gx < 0) {-				glyph_scale = 1 + 2 * gx / width;+				if (gx < 0) {+					glyph_scale = 1 + 2 * gx / width;+				} 			} 		} 	}@@ -490,7 +490,7 @@ public class OverViewItem : GLib.Object { 	} 	 	private void draw_menu (Context cr) {-		if (likely (glyphs == null || !version_menu.menu_visible)) {+		if (glyphs == null || !version_menu.menu_visible) { 			return; 		} 		

Contact

Email: johan.mattsson.m@gmail.com
Mastodon: typo.social/@birdfont
GitHub: johanmattssonm
LinkedIn: johan-mattsson-2ab324112