Commit 2d5c0e4
Adjust glyph size in overview
Changed files (11)
modifiedgraphics/tools_and_buttons.svgmodifiedicons/export_fonts.pngmodifiedicons/generate_html_document.pngmodifiedicons/update_webview.pngmodifiedlibbirdfont/BackgroundTools.valamodifiedlibbirdfont/BirdFontPart.valamodifiedlibbirdfont/Glyph.valamodifiedlibbirdfont/OverView.valamodifiedlibbirdfont/OverViewItem.valamodifiedlibbirdfont/PenTool.valamodifiedlibbirdfont/Renderer/Text.vala
Diff
@@ -1523,9 +1523,9 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2"- inkscape:zoom="1.4142136"- inkscape:cx="339.37669"- inkscape:cy="151.28469"+ inkscape:zoom="8.0000002"+ inkscape:cx="297.89452"+ inkscape:cy="128.11798" inkscape:current-layer="layer1" inkscape:document-units="px" showgrid="false"@@ -3955,7 +3955,7 @@ inkscape:export-xdpi="320" inkscape:export-ydpi="320" /> <rect- style="opacity:0.98000004;color:#000000;fill:#33363b;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:20;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"+ style="opacity:1;color:#000000;fill:#33363b;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:20;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" id="rect4330" width="174.22142" height="37.342556"@@ -5667,5 +5667,103 @@ id="rect4999-4-5-4" style="fill:none;stroke:none;stroke-width:1.27577007000000009;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> </g>+ <g+ id="g4659"+ inkscape:export-filename="/home/johan/birdfont/icons/update_webview.png"+ inkscape:export-xdpi="319"+ inkscape:export-ydpi="319">+ <rect+ inkscape:export-ydpi="319"+ inkscape:export-xdpi="319"+ inkscape:export-filename="/home/johan/birdfont/icons/update_webview.png"+ y="620.18311"+ x="293.9325"+ height="14.306025"+ width="17.010134"+ id="rect4069-4"+ style="fill:none" />+ <path+ sodipodi:nodetypes="csssc"+ inkscape:connector-curvature="0"+ id="path3285-9"+ d="m 297.53094,624.76453 c -0.10371,-3.07049 2.4101,-3.2344 4.43523,-3.24588 2.47727,-0.014 4.86105,0.23803 4.89497,5.42429 0.0279,4.27128 -1.03283,6.09448 -4.44235,6.09448 -2.66799,0 -5.38239,-0.32164 -4.78479,-5.55719"+ style="fill:none;stroke:#666a73;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />+ <path+ sodipodi:nodetypes="ccc"+ inkscape:connector-curvature="0"+ id="path3289-3"+ d="m 295.16925,629.6155 2.33613,-2.69315 2.43223,2.7018"+ style="fill:none;stroke:#76787c;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />+ </g>+ <g+ id="g4154-3"+ style="stroke:#656a73;stroke-opacity:1;fill:#858585;fill-opacity:1"+ transform="translate(284.4266,209.91698)"+ inkscape:export-filename="/home/johan/birdfont/icons/export_fonts.png"+ inkscape:export-xdpi="319"+ inkscape:export-ydpi="319">+ <g+ transform="translate(-3.690616,1.451615)"+ id="g4145-2"+ style="stroke:#656a73;stroke-opacity:1;fill:#858585;fill-opacity:1">+ <path+ sodipodi:nodetypes="cc"+ style="fill:#858585;stroke:#656a73;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:1"+ d="m 51.12501,416.09675 12.128285,0"+ id="path4133-3"+ inkscape:connector-curvature="0" />+ <path+ style="fill:#858585;stroke:#656a73;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:1"+ d="m 60.897902,412.86775 2.992578,3.56045"+ id="path4139-1"+ inkscape:connector-curvature="0"+ sodipodi:nodetypes="cc" />+ <path+ style="fill:#858585;stroke:#656a73;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:1"+ d="m 63.958333,415.90522 -3.078034,3.64394"+ id="path4143-9"+ inkscape:connector-curvature="0"+ sodipodi:nodetypes="cc" />+ </g>+ </g>+ <path+ style="fill:none;stroke:#656a73;stroke-width:0.78642100000000004px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:1"+ d="m 373.40413,623.38407 0,10.85224 10.27016,0 0,-14.47262 -7.23789,0 z"+ id="path4194-4"+ inkscape:connector-curvature="0"+ sodipodi:nodetypes="cccccc"+ inkscape:export-filename="/home/johan/birdfont/icons/generate_html_document.png"+ inkscape:export-xdpi="320"+ inkscape:export-ydpi="320" />+ <path+ style="fill:none;stroke:#e6e6e6;stroke-width:1.10593903px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"+ d="m 373.79808,624.02072 3.85251,0"+ id="path4233-7"+ inkscape:connector-curvature="0"+ inkscape:export-filename="/home/johan/birdfont/icons/generate_html_document.png"+ inkscape:export-xdpi="320"+ inkscape:export-ydpi="320" />+ <g+ style="font-size:8.32909298000000042px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#656a73;fill-opacity:1;stroke:none;font-family:Big_Bottom_Cartoon_Hungarian;-inkscape-font-specification:Big_Bottom_Cartoon_Hungarian"+ id="text4226-5"+ transform="translate(284.36886,207.28179)"+ inkscape:export-filename="/home/johan/birdfont/icons/generate_html_document.png"+ inkscape:export-xdpi="320"+ inkscape:export-ydpi="320">+ <path+ d="m 92.262767,417.02452 0.821522,0 0,2.48897 2.985134,0 0,-2.48897 0.821522,0 0,6.07195 -0.821522,0 0,-2.8916 -2.985134,0 0,2.8916 -0.821522,0 0,-6.07195"+ style="fill:#656a73;fill-opacity:1;font-family:BetecknaBirdfont;-inkscape-font-specification:BetecknaBirdfont"+ id="path4231-6"+ inkscape:connector-curvature="0" />+ </g>+ <path+ style="fill:none;stroke:#e6e6e6;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"+ d="m 377.15393,623.71351 0.0134,-3.554"+ id="path4238-0"+ inkscape:connector-curvature="0"+ sodipodi:nodetypes="cc"+ inkscape:export-filename="/home/johan/birdfont/icons/generate_html_document.png"+ inkscape:export-xdpi="320"+ inkscape:export-ydpi="320" /> </g> </svg>Binary files a/icons/export_fonts.png and b/icons/export_fonts.png differBinary files a/icons/generate_html_document.png and b/icons/generate_html_document.png differBinary files a/icons/update_webview.png and b/icons/update_webview.png differ@@ -217,7 +217,6 @@ public class BackgroundTools : ToolCollection { // don't invalidate the toolbox iterator IdleSource idle = new IdleSource (); idle.set_callback (() => {- GlyphCollection g; BackgroundSelectionLabel bsl; Font f = BirdFont.get_current_font (); @@ -28,8 +28,6 @@ public class BirdFontPart : GLib.Object{ static string FILE_ATTRIBUTES = "standard::*"; - static bool running_git = false;- public BirdFontPart (Font font) { this.font = font; parts = new Gee.ArrayList<string> ();@@ -193,21 +193,23 @@ public class Glyph : FontDisplay { foreach (Path p in path_list) { p.update_region_boundaries ();- - if (p.xmin < x1) {- x1 = p.xmin;- }- - if (p.xmax > x2) {- x2 = p.xmax;- }- - if (p.ymin < y1) {- y1 = p.ymin;- }- - if (p.ymax > y2) {- y2 = p.ymax;+ + if (p.points.size > 0) {+ if (p.xmin < x1) {+ x1 = p.xmin;+ }+ + if (p.xmax > x2) {+ x2 = p.xmax;+ }+ + if (p.ymin < y1) {+ y1 = p.ymin;+ }+ + if (p.ymax > y2) {+ y2 = p.ymax;+ } } } }@@ -236,10 +236,11 @@ public class OverView : FontDisplay { GlyphCanvas.redraw (); } - public static void update_zoom_bar () {+ public void update_zoom_bar () { double z = OverViewItem.width / OverViewItem.DEFAULT_WIDTH - 0.5; Toolbox.overview_tools.zoom_bar.set_zoom (z); Toolbox.redraw_tool_box ();+ update_item_list (); } public void set_zoom (double zoom) {@@ -391,6 +392,8 @@ public class OverView : FontDisplay { } item = new OverViewItem (glyphs, character, x, y);+ item.adjust_scale ();+ x += OverViewItem.full_width (); if (x + OverViewItem.full_width () >= allocation.width) {@@ -113,6 +113,33 @@ public class OverViewItem : GLib.Object { draw_caption (cr); } + public void adjust_scale () {+ double x1, x2, y1, y2, glyph_width, glyph_height, scale, gx, gy;+ Glyph g;+ Font font;+ + 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 (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;+ + if (gx < 0) {+ glyph_scale = 1 + 2 * gx / width;+ }+ }+ }+ private void draw_thumbnail (Context cr, GlyphCollection? gl, double x, double y) { Glyph g; Font font;@@ -141,23 +168,12 @@ public class OverViewItem : GLib.Object { glyph_width = x2 - x1; glyph_height = y2 - y1;-- if (glyph_scale == 1) {- // caption height is 20- glyph_scale = (h - 20) / (font.top_limit - font.bottom_limit); - } - scale = glyph_scale;- - gx = ((w / scale) - glyph_width) / 2;- gy = (h / scale) - 25 / scale;- - if (gx < 0) {- glyph_scale = 1 + 2 * gx / width;- }+ gx = ((w / glyph_scale) - glyph_width) / 2;+ gy = (h / glyph_scale) - 25 / glyph_scale; c.save ();- c.scale (scale, scale); + c.scale (glyph_scale, glyph_scale); g.add_help_lines (); @@ -170,9 +186,9 @@ public class OverViewItem : GLib.Object { fallback = new Text (); c.set_source_rgba (219 / 255.0, 221 / 255.0, 233 / 255.0, 1); fallback.set_text ((!) character.to_string ());- font_size = height;+ font_size = height * 0.9; gx = (width - fallback.get_extent (font_size)) / 2.0;- gy = 30 - (height / 2.0) * (height / height);+ gy = height - 30; fallback.draw (c, gx, gy, font_size); c.restore (); }@@ -747,7 +747,6 @@ public class PenTool : Tool { public void press (int button, int x, int y, bool double_click) { Glyph? g = MainWindow.get_current_glyph (); Glyph glyph = (!) g;- Toolbox tb = MainWindow.get_toolbox (); return_if_fail (g != null); @@ -40,7 +40,6 @@ public class Text { Font? current_font; string text; GlyphSequence glyph_sequence;- double line_gap = 20; public delegate void Iterator (Glyph glyph, double kerning, bool last); public Text () {@@ -308,10 +307,6 @@ public class Text { double get_row_height () { return font.top_limit - font.bottom_limit; }- - internal static void test () {- MainWindow.get_tab_bar ().add_tab (new TextTab ());- } } }