From a988dc710897ffa60a709087d8a218ab67b0411c Mon Sep 17 00:00:00 2001 From: speedie Date: Wed, 8 Mar 2023 21:19:38 +0100 Subject: [PATCH] some minor changes allowing pango and xft to work together --- libs/argv.c | 6 +++++- libs/sl/draw-pango.c | 4 ++-- libs/sl/draw-pango.h | 2 +- options.h | 2 +- options.mk | 2 +- spmenu.c | 4 ---- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/libs/argv.c b/libs/argv.c index 9294444..bc063fe 100644 --- a/libs/argv.c +++ b/libs/argv.c @@ -163,7 +163,11 @@ readargs(int argc, char *argv[]) else if (!strcmp(argv[i], "-p")) /* adds prompt to left of input field */ prompt = argv[++i]; else if (!strcmp(argv[i], "-fn")) /* font or font set */ - strcpy(font, argv[++i]); /* font[0] = argv[++i]; */ + #if USEPANGO + strcpy(font, argv[++i]); + #else + strcpy(font[0], argv[++i]); + #endif else if (!strcmp(argv[i], "-nmt")) /* normal mode text */ strcpy(normtext, argv[++i]); else if (!strcmp(argv[i], "-imt")) { /* insert mode text */ diff --git a/libs/sl/draw-pango.c b/libs/sl/draw-pango.c index e77efc8..83e60c4 100644 --- a/libs/sl/draw-pango.c +++ b/libs/sl/draw-pango.c @@ -96,14 +96,14 @@ xfont_free(Fnt *font) } Fnt* -drw_font_create(Drw* drw, const char font[], size_t fontcount) +drw_font_create(Drw* drw, const char *font[], size_t fontcount) { Fnt *fnt = NULL; if (!drw || !font) return NULL; - fnt = xfont_create(drw, font); + fnt = xfont_create(drw, *font); return (drw->font = fnt); } diff --git a/libs/sl/draw-pango.h b/libs/sl/draw-pango.h index 51fc14a..21c16e3 100644 --- a/libs/sl/draw-pango.h +++ b/libs/sl/draw-pango.h @@ -33,7 +33,7 @@ void drw_resize(Drw *drw, unsigned int w, unsigned int h); void drw_free(Drw *drw); /* Fnt abstraction */ -Fnt *drw_font_create(Drw* drw, const char font[], size_t fontcount); +Fnt *drw_font_create(Drw* drw, const char *font[], size_t fontcount); void drw_font_free(Fnt* set); unsigned int drw_font_getwidth(Drw *drw, const char *text, Bool markup); void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h, Bool markup); diff --git a/options.h b/options.h index ace87dc..5910b75 100644 --- a/options.h +++ b/options.h @@ -34,7 +34,7 @@ static int borderwidth = 2; /* Width of the border */ static int bordercentered = 1; /* Draw border only when centered */ /* Font options */ -static char font[] = "Noto Sans Mono 8"; /* Font to draw text and Pango markup with. */ +static char *font[] = "Noto Sans Mono 8"; /* Font to draw text and Pango markup with. */ /* Symbol options */ static char *leftarrow = "<"; /* Left arrow, used to indicate you can move to the left */ diff --git a/options.mk b/options.mk index 9986fa7..d0083cd 100644 --- a/options.mk +++ b/options.mk @@ -2,7 +2,7 @@ # See LICENSE file for copyright details. # spmenu version -VERSION = 0.2.1 +VERSION = 0.2.2 # includes and libs INCS = -I$(X11INC) -I$(FREETYPEINC) $(BDINC) `pkg-config --cflags xft $(PANGO_CONF) $(PANGO_XFT_CONF)` diff --git a/spmenu.c b/spmenu.c index 300e79e..cf017b1 100644 --- a/spmenu.c +++ b/spmenu.c @@ -5,10 +5,6 @@ * If you're looking for functions used to draw images, see 'libs/img.c' * If you're looking for the .Xresources array, see 'libs/xresources.h' * - * To disable certain features, pass one or more of the following to the compiler: - * - * NOXINERAMA, NORTL, NOIMAGE - * * You don't need to edit spmenu.c if you aren't making big changes to the software. * * After making changes, run 'make clean install' to install and 'make' to attempt a compilation.