From 0445dd5c18a7dcbef8df5b01af2fe2bcdc96bce5 Mon Sep 17 00:00:00 2001 From: kojima Date: Sat, 21 Aug 2004 21:29:44 +0000 Subject: [PATCH] changed encoding of (c) thing in about panel to utf-8 changed techdraw style size display to use X core fonts --- src/dialog.c | 4 ++-- src/moveres.c | 40 ++++++++-------------------------------- src/screen.c | 6 +----- src/screen.h | 5 ++++- 4 files changed, 15 insertions(+), 40 deletions(-) diff --git a/src/dialog.c b/src/dialog.c index 804ec381..01db80d0 100644 --- a/src/dialog.c +++ b/src/dialog.c @@ -859,8 +859,8 @@ typedef struct { #define COPYRIGHT_TEXT \ - "Copyright \xa9 1997-2003 Alfredo K. Kojima \n"\ - "Copyright \xa9 1998-2003 Dan Pascu " + "Copyright © 1997-2004 Alfredo K. Kojima \n"\ + "Copyright © 1998-2004 Dan Pascu " diff --git a/src/moveres.c b/src/moveres.c index de83c3b3..5dd0d8ae 100644 --- a/src/moveres.c +++ b/src/moveres.c @@ -255,13 +255,11 @@ showGeometry(WWindow *wwin, int x1, int y1, int x2, int y2, int direction) { WScreen *scr = wwin->screen_ptr; Window root = scr->root_win; - GC gc = scr->line_gc, saveGC; + GC gc = scr->line_gc; int ty, by, my, x, y, mx, s; char num[16]; XSegment segment[4]; int fw, fh; - WMColor *color; - WMPixel pixel; /* This seems necessary for some odd reason (too lazy to write x1-1 and * x2-1 everywhere below in the code). But why only for x? */ @@ -278,8 +276,8 @@ showGeometry(WWindow *wwin, int x1, int y1, int x2, int y2, int direction) by = y2 - wwin->frame->bottom_width; if (wPreferences.size_display == WDIS_NEW) { - fw = WMWidthOfString(scr->tech_draw_font, "8888", 4); - fh = WMFontHeight(scr->tech_draw_font); + fw = XTextWidth(scr->tech_draw_font, "8888", 4); + fh = scr->tech_draw_font->ascent+scr->tech_draw_font->descent; XSetForeground(dpy, gc, scr->line_pixel); @@ -329,25 +327,12 @@ showGeometry(WWindow *wwin, int x1, int y1, int x2, int y2, int direction) snprintf(num, sizeof(num), "%i", (by - ty - wwin->normal_hints->base_height) / wwin->normal_hints->height_inc); - fw = WMWidthOfString(scr->tech_draw_font, num, strlen(num)); - - /* XSetForeground(dpy, gc, WMColorPixel(scr->window_title_color[WS_UNFOCUSED])); */ - - color = WMBlackColor(scr->wmscreen); - saveGC = scr->wmscreen->drawStringGC; - pixel = color->color.pixel; + fw = XTextWidth(scr->tech_draw_font, num, strlen(num)); /* Display the height. */ + XSetFont(dpy, gc, scr->tech_draw_font->fid); + XDrawString(dpy, root, gc, x - s + 3 - fw/2, my + scr->tech_draw_font->ascent - fh/2 + 1, num, strlen(num)); - /* // ugly hack */ - color->color.pixel = scr->line_pixel; - scr->wmscreen->drawStringGC = gc; - WMDrawString(scr->wmscreen, root, color, scr->tech_draw_font, - x - s + 3 - fw/2, my - fh/2 + 1, num, strlen(num)); - scr->wmscreen->drawStringGC = saveGC; - color->color.pixel = pixel; - - XSetForeground(dpy, gc, scr->line_pixel); /* horizontal geometry */ if (y1 < 15) { y = y2; @@ -359,7 +344,7 @@ showGeometry(WWindow *wwin, int x1, int y1, int x2, int y2, int direction) mx = x1 + (x2 - x1)/2; snprintf(num, sizeof(num), "%i", (x2 - x1 - wwin->normal_hints->base_width) / wwin->normal_hints->width_inc); - fw = WMWidthOfString(scr->tech_draw_font, num, strlen(num)); + fw = XTextWidth(scr->tech_draw_font, num, strlen(num)); /* left arrow & end bar */ segment[0].x1 = x1; segment[0].y1 = y - (s + 6); @@ -395,17 +380,8 @@ showGeometry(WWindow *wwin, int x1, int y1, int x2, int y2, int direction) XDrawSegments(dpy, root, gc, segment, 4); - /* XSetForeground(dpy, gc, WMColorPixel(scr->window_title_color[WS_UNFOCUSED])); */ - /* Display the width. */ - /* // ugly hack */ - color->color.pixel = scr->line_pixel; - scr->wmscreen->drawStringGC = gc; - WMDrawString(scr->wmscreen, root, color, scr->tech_draw_font, - mx - fw/2 + 1, y - s - fh/2 + 1, num, strlen(num)); - scr->wmscreen->drawStringGC = saveGC; - color->color.pixel = pixel; - WMReleaseColor(color); + XDrawString(dpy, root, gc, mx - fw/2 + 1, y - s + scr->tech_draw_font->ascent - fh/2 + 1, num, strlen(num)); } else { WSetGeometryViewShownSize(scr->gview, (x2 - x1 - wwin->normal_hints->base_width) diff --git a/src/screen.c b/src/screen.c index 95a6b84b..8e619f4a 100644 --- a/src/screen.c +++ b/src/screen.c @@ -821,11 +821,7 @@ wScreenInit(int screen_number) scr->info_text_font = WMBoldSystemFontOfSize(scr->wmscreen, 12); - // fix this too -Dan - //scr->tech_draw_font = WMCreateFontWithFlags(scr->wmscreen, - // "BoldSystemFont-12", - // WFNotAntialiased); - scr->tech_draw_font = WMBoldSystemFontOfSize(scr->wmscreen, 12); + scr->tech_draw_font= XLoadQueryFont(dpy, "-adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-*-*"); scr->gview = WCreateGeometryView(scr->wmscreen); WMRealizeWidget(scr->gview); diff --git a/src/screen.h b/src/screen.h index f6141614..1ae1971a 100644 --- a/src/screen.h +++ b/src/screen.h @@ -162,7 +162,10 @@ typedef struct _WScreen { WMFont *clip_title_font; /* for clip titles */ WMFont *info_text_font; /* text on things like geometry * hint boxes */ - WMFont *tech_draw_font; + + XFontStruct *tech_draw_font; /* font for tech draw style geom view + needs to be a core font so we can + use it with a XORing GC */ WMFont *workspace_name_font; -- 2.11.4.GIT