]> git.mdlowis.com Git - projs/tide.git/commitdiff
Moved font cache size config option to edit.h with the other tunable items
authorMichael D. Lowis <mike.lowis@gentex.com>
Mon, 1 May 2017 14:21:01 +0000 (10:21 -0400)
committerMichael D. Lowis <mike.lowis@gentex.com>
Mon, 1 May 2017 14:21:01 +0000 (10:21 -0400)
TODO.md
inc/edit.h
lib/x11.c

diff --git a/TODO.md b/TODO.md
index a8a93d3e6a92b092720285e99ca7709415eae5f0..320bc0ea4f0c4bdbfe4ae0026ef738db1ceb2c8c 100644 (file)
--- a/TODO.md
+++ b/TODO.md
@@ -4,7 +4,7 @@ Up Next:
 
 * refactor x11.c and win.c
 * Add keyboard shortcut to highlight the thing under the cursor
-* Make Fn keys execute nth command in the tags buffer
+* Make Fn keys execute nth command in the tags buffers
 * Run commands in the background and don't block the main thread.
 * check for file changes on save
 * check for file changes when window regains focus
index 2a12642bd389eaadf0039804ee2132402249edad..5d0e9521ea493f62abb68c593f205475c7597c06 100644 (file)
@@ -205,11 +205,12 @@ enum ColorId {
 /* Configuration
  *****************************************************************************/
 enum {
-    Width       = 640,  /* default window width */
-    Height      = 480,  /* default window height */
-    TabWidth    = 4,    /* maximum number of spaces used to represent a tab */
-    ScrollLines = 4,    /* number of lines to scroll by for mouse wheel scrolling */
-    BufSize     = 8192, /* default buffer size */
+    Width         = 640,  /* default window width */
+    Height        = 480,  /* default window height */
+    TabWidth      = 4,    /* maximum number of spaces used to represent a tab */
+    ScrollLines   = 4,    /* number of lines to scroll by for mouse wheel scrolling */
+    BufSize       = 8192, /* default buffer size */
+    FontCacheSize = 16,   /* Maximum number of fonts allowed in the font cache */
 };
 
 /* choose the font to  use for xft */
index a4bc436c8b0b42e505c4662b7d0d03a85ddfc32f..c56ea63f41def04ad3cef67a177bc16c91ad70e1 100644 (file)
--- a/lib/x11.c
+++ b/lib/x11.c
@@ -31,7 +31,7 @@ struct XFont {
     struct {
         XftFont* font;
         uint32_t unicodep;
-    } cache[MAXFONTS];
+    } cache[FontCacheSize];
     int ncached;
 };
 
@@ -435,8 +435,8 @@ void x11_font_getglyph(XFont fnt, XGlyphSpec* spec, uint32_t rune) {
     FcDefaultSubstitute(fcpattern);
     FcPattern* fontmatch = FcFontSetMatch(0, fcsets, 1, fcpattern, &fcres);
     /* add the font to the cache and use it */
-    if (font->ncached >= MAXFONTS) {
-        font->ncached = MAXFONTS - 1;
+    if (font->ncached >= FontCacheSize) {
+        font->ncached = FontCacheSize - 1;
         XftFontClose(X.display, font->cache[font->ncached].font);
     }
     font->cache[font->ncached].font = XftFontOpenPattern(X.display, fontmatch);