[gtksourceview] sourceview: add some documentation regarding changing fonts



commit 0ae462ebc8eceb810f176a21792a63de4efe597b
Author: Christian Hergert <chergert redhat com>
Date:   Fri Mar 1 16:12:15 2019 -0800

    sourceview: add some documentation regarding changing fonts
    
    This gives some additional insight on how to properly change the font for
    a GtkSourceView in a manner that allows fonts to be scaled relative to
    the base font.
    
    Related #41

 gtksourceview/gtksourceview.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
---
diff --git a/gtksourceview/gtksourceview.c b/gtksourceview/gtksourceview.c
index 4e086464..328fbb20 100644
--- a/gtksourceview/gtksourceview.c
+++ b/gtksourceview/gtksourceview.c
@@ -90,6 +90,29 @@
  *   </child>
  * </object>
  * ]|
+ *
+ * # Changing the Font
+ *
+ * Gtk CSS provides the best way to change the font for a #GtkSourceView in a
+ * manner that allows for components like #GtkSourceMap to scale the desired
+ * font.
+ *
+ * |[
+ *   GtkCssProvider *provider = gtk_css_provider_new ();
+ *   gtk_css_provider_load_from_data (provider,
+ *                                    "textview { font-family: Monospace; font-size: 8pt; }",
+ *                                    -1,
+ *                                    NULL);
+ *   gtk_style_context_add_provider (gtk_widget_get_style_context (view),
+ *                                   GTK_STYLE_PROVIDER (provider),
+ *                                   GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ *   g_object_unref (provider);
+ * ]|
+ *
+ * If you need to adjust the font or size of font within a portion of the
+ * document only, you should use a #GtkTextTag with the #GtkTextTag:family or
+ * #GtkTextTag:scale set so that the font size may be scaled relative to
+ * the default font set in CSS.
  */
 
 /*


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]