@@ -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