Skip to content

Commit b607e42

Browse files
committed
Fix fonts that are too small.
1 parent 74e2c7d commit b607e42

2 files changed

Lines changed: 23 additions & 1 deletion

File tree

src/ui/edit_view/edit_view.vala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,7 @@ public class Folio.EditView : Gtk.Box {
405405
if (!font_desc.get_size_is_absolute ()) {
406406
font_size = font_size / Pango.SCALE;
407407
}
408+
if (font_size < 4) { font_size = 10; }
408409
note_font_provider.load_from_data (@"textview{font-family:'$font_family';font-weight:$font_weight;font-size:$font_size$font_units;}".data);
409410
markdown_view.get_style_context ().add_provider (note_font_provider, -1);
410411
}

src/ui/widgets/markdown/markdown_view.vala

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ public class GtkMarkdown.View : GtkSource.View {
55

66
public bool dark { get; set; default = false; }
77
public Gdk.RGBA theme_color { get; set; }
8-
public string font_monospace { get; set; default = "Monospace"; }
8+
public string font_monospace { get; set; default = "Monospace 10"; }
99

1010
public Gdk.RGBA h6_color {
1111
get {
@@ -429,6 +429,17 @@ public class GtkMarkdown.View : GtkSource.View {
429429
notify["dark"].connect ((s, p) => update_color_scheme ());
430430
notify["theme-color"].connect ((s, p) => update_color_scheme ());
431431
notify["font-monospace"].connect ((s, p) => update_font ());
432+
433+
var font_desc = Pango.FontDescription.from_string (font_monospace);
434+
var font_size = font_desc.get_size ();
435+
if (!font_desc.get_size_is_absolute ()) {
436+
font_size = font_size / Pango.SCALE;
437+
}
438+
if (font_size < 3) {
439+
font_desc.set_size (10 * Pango.SCALE);
440+
font_monospace = font_desc.to_string ();
441+
}
442+
432443
update_color_scheme ();
433444
update_font ();
434445

@@ -584,6 +595,16 @@ public class GtkMarkdown.View : GtkSource.View {
584595
}
585596

586597
private void update_font () {
598+
var font_desc = Pango.FontDescription.from_string (font_monospace);
599+
var font_size = font_desc.get_size ();
600+
if (!font_desc.get_size_is_absolute ()) {
601+
font_size = font_size / Pango.SCALE;
602+
}
603+
if (font_size < 3) {
604+
font_desc.set_size (10 * Pango.SCALE);
605+
font_monospace = font_desc.to_string ();
606+
}
607+
587608
text_tag_around = get_or_create_tag ("markdown-code-block-around");
588609
text_tag_around.font = font_monospace;
589610

0 commit comments

Comments
 (0)