From 551ff7b669d196028ef6d336f772a975ce176c0c Mon Sep 17 00:00:00 2001 From: Kim Woelders Date: Sat, 17 Jul 2021 15:32:51 +0200 Subject: [PATCH] edox: Unifdef USE_XFONT Disabled since 2007. --- dox/dox.h | 5 +- dox/format.c | 11 +---- dox/text.c | 126 +-------------------------------------------------- 3 files changed, 3 insertions(+), 139 deletions(-) diff --git a/dox/dox.h b/dox/dox.h index ac748c17..fe25d5cd 100644 --- a/dox/dox.h +++ b/dox/dox.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors - * Copyright (C) 2007-2020 Kim Woelders + * Copyright (C) 2007-2021 Kim Woelders * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -51,9 +51,6 @@ typedef struct _textstate { XColor bg_col; int effect; Efont *efont; -#if USE_XFONT - XFontStruct *xfont; -#endif XFontSet xfontset; int xfontset_ascent; int height; diff --git a/dox/format.c b/dox/format.c index 68cdb63a..6677d7b2 100644 --- a/dox/format.c +++ b/dox/format.c @@ -1,6 +1,6 @@ /* * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors - * Copyright (C) 2007-2020 Kim Woelders + * Copyright (C) 2007-2021 Kim Woelders * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -688,11 +688,6 @@ RenderPage(Window win, int page_num, int w, int h) if (ts.efont) Efont_free(ts.efont); ts.efont = NULL; -#if USE_XFONT - if (ts.xfont) - XFreeFont(disp, ts.xfont); - ts.xfont = NULL; -#endif if (ts.xfontset) XFreeFontSet(disp, ts.xfontset); ts.xfontset = NULL; @@ -973,10 +968,6 @@ RenderPage(Window win, int page_num, int w, int h) if (ts.efont) Efont_free(ts.efont); -#if USE_XFONT - if (ts.xfont) - XFreeFont(disp, ts.xfont); -#endif if (ts.xfontset) XFreeFontSet(disp, ts.xfontset); diff --git a/dox/text.c b/dox/text.c index dca29531..e5100bdd 100644 --- a/dox/text.c +++ b/dox/text.c @@ -1,6 +1,6 @@ /* * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors - * Copyright (C) 2007-2020 Kim Woelders + * Copyright (C) 2007-2021 Kim Woelders * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -61,11 +61,7 @@ TextGetLines(const char *text, int *count) void TextStateLoadFont(TextState * ts) { -#if USE_XFONT - if ((ts->efont) || (ts->xfont) || (ts->xfontset)) -#else if ((ts->efont) || (ts->xfontset)) -#endif return; if (!ts->fontname) @@ -99,19 +95,6 @@ TextStateLoadFont(TextState * ts) return; } -#if USE_XFONT - if ((!ts->xfont) && (!strchr(ts->fontname, ','))) - { - ts->xfont = XLoadQueryFont(disp, ts->fontname); - if (ts->xfont) - { - ts->xfontset_ascent = ts->xfont->ascent; - ts->height = ts->xfont->ascent + ts->xfont->descent; - return; - } - } -#endif - if (!ts->xfontset) { int i, missing_cnt, font_cnt; @@ -183,34 +166,6 @@ TextSize(TextState * ts, const char *text, int *width, int *height) *width = ret2.width; } } -#if USE_XFONT - else if ((ts->xfont) && (ts->xfont->min_byte1 == 0) && - (ts->xfont->max_byte1 == 0)) - { - for (i = 0; i < num_lines; i++) - { - int wid; - - wid = XTextWidth(ts->xfont, lines[i], strlen(lines[i])); - *height += ts->xfont->ascent + ts->xfont->descent; - if (wid > *width) - *width = wid; - } - } - else if ((ts->xfont)) - { - for (i = 0; i < num_lines; i++) - { - int wid; - - wid = XTextWidth16(ts->xfont, (XChar2b *) lines[i], - strlen(lines[i]) / 2); - *height += ts->xfont->ascent + ts->xfont->descent; - if (wid > *width) - *width = wid; - } - } -#endif /* USE_XFONT */ freestrlist(lines, num_lines); } @@ -313,84 +268,5 @@ TextDraw(TextState * ts, Window win, char *text, yy += ret2.height; } } -#if USE_XFONT - else if ((ts->xfont) && (ts->xfont->min_byte1 == 0) && - (ts->xfont->max_byte1 == 0)) - { - XSetFont(disp, gc, ts->xfont->fid); - for (i = 0; i < num_lines; i++) - { - int wid; - - wid = XTextWidth(ts->xfont, lines[i], strlen(lines[i])); - if (i == 0) - yy += ts->xfont->ascent; - xx = x + (((w - wid) * justification) >> 10); - if (ts->effect == 1) - { - EAllocColor(&ts->bg_col); - XSetForeground(disp, gc, ts->bg_col.pixel); - XDrawString(disp, win, gc, xx + 1, yy + 1, - lines[i], strlen(lines[i])); - } - else if (ts->effect == 2) - { - EAllocColor(&ts->bg_col); - XSetForeground(disp, gc, ts->bg_col.pixel); - XDrawString(disp, win, gc, xx - 1, yy, - lines[i], strlen(lines[i])); - XDrawString(disp, win, gc, xx + 1, yy, - lines[i], strlen(lines[i])); - XDrawString(disp, win, gc, xx, yy - 1, - lines[i], strlen(lines[i])); - XDrawString(disp, win, gc, xx, yy + 1, - lines[i], strlen(lines[i])); - } - EAllocColor(&ts->fg_col); - XSetForeground(disp, gc, ts->fg_col.pixel); - XDrawString(disp, win, gc, xx, yy, lines[i], strlen(lines[i])); - yy += ts->xfont->ascent + ts->xfont->descent; - } - } - else if ((ts->xfont)) - { - XSetFont(disp, gc, ts->xfont->fid); - for (i = 0; i < num_lines; i++) - { - int wid; - - wid = XTextWidth16(ts->xfont, (XChar2b *) lines[i], - strlen(lines[i]) / 2); - if (i == 0) - yy += ts->xfont->ascent; - xx = x + (((w - wid) * justification) >> 10); - if (ts->effect == 1) - { - EAllocColor(&ts->bg_col); - XSetForeground(disp, gc, ts->bg_col.pixel); - XDrawString16(disp, win, gc, xx + 1, yy + 1, - (XChar2b *) lines[i], strlen(lines[i]) / 2); - } - else if (ts->effect == 2) - { - EAllocColor(&ts->bg_col); - XSetForeground(disp, gc, ts->bg_col.pixel); - XDrawString16(disp, win, gc, xx - 1, yy, - (XChar2b *) lines[i], strlen(lines[i]) / 2); - XDrawString16(disp, win, gc, xx + 1, yy, - (XChar2b *) lines[i], strlen(lines[i]) / 2); - XDrawString16(disp, win, gc, xx, yy - 1, - (XChar2b *) lines[i], strlen(lines[i]) / 2); - XDrawString16(disp, win, gc, xx, yy + 1, - (XChar2b *) lines[i], strlen(lines[i]) / 2); - } - EAllocColor(&ts->fg_col); - XSetForeground(disp, gc, ts->fg_col.pixel); - XDrawString16(disp, win, gc, xx, yy, - (XChar2b *) lines[i], strlen(lines[i]) / 2); - yy += ts->xfont->ascent + ts->xfont->descent; - } - } -#endif /* USE_XFONT */ freestrlist(lines, num_lines); }