1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 12:28:22 +01:00

- Removed obsoleted options from WMGLOBAL and from the WINGs internal

structures (no longer needed with xft)
- Fixed default system font names (converted from xlfd to fontconfig names)
- A bit of code cleanups related to xft
- Replaced harcoded xlfd font names in wmaker and WPrefs with fontconfig
  names.
This commit is contained in:
dan
2004-10-17 06:27:51 +00:00
parent 19c7a99197
commit 6cfad0b10f
12 changed files with 51 additions and 110 deletions

11
TODO
View File

@@ -5,12 +5,19 @@ To do before next release:
and give a warning if font is not converted, but let user manually convert and give a warning if font is not converted, but let user manually convert
it with convertfonts as the process may need manual tweaking for best it with convertfonts as the process may need manual tweaking for best
results) results)
- Append .UTF-8 to locale
- figure out a better gnustep path for wprefs.app installation - figure out a better gnustep path for wprefs.app installation
- figure a better fullscreen level
- check whether window states are being saved/restored properly via netwm - check whether window states are being saved/restored properly via netwm
on restart/crash-restart (grep for XXX/TODO) on restart/crash-restart (grep for XXX/TODO)
1. make AntialiasedText in WMGLOBAL work
2. make wmaker read old xlfd, but warn about them so people use convert
(I think it reads them, but the warning needs to be added)
3. Set the default font
4. Change all xlfd fonts we still use hardcoded in wmaker/wprefs
5. Update NEWS/Changelog (remove old info that only applies to xft1)
=====================================================================
remake wrlib rule to not compile with -fomit-frame-pointer and stuff remake wrlib rule to not compile with -fomit-frame-pointer and stuff
if its added to CFLAGS if its added to CFLAGS

View File

@@ -236,10 +236,6 @@ typedef struct W_Screen {
WMHashTable *fontCache; WMHashTable *fontCache;
Bool useMultiByte;
Bool useWideChar;
Bool antialiasedText; Bool antialiasedText;
unsigned int ignoredModifierMask; /* modifiers to ignore when typing txt */ unsigned int ignoredModifierMask; /* modifiers to ignore when typing txt */
@@ -453,7 +449,6 @@ typedef struct _WINGsConfiguration {
char *boldSystemFont; char *boldSystemFont;
int defaultFontSize; int defaultFontSize;
Bool antialiasedText; Bool antialiasedText;
Bool useMultiByte;
char *floppyPath; char *floppyPath;
unsigned doubleClickDelay; unsigned doubleClickDelay;
unsigned mouseWheelUp; unsigned mouseWheelUp;

View File

@@ -10,9 +10,9 @@ _WINGsConfiguration WINGsConfiguration;
#define SYSTEM_FONT "-*-helvetica-medium-r-normal-*-%d-*-*-*-*-*-*-*,-*-*-medium-r-*-*-%d-*-*-*-*-*-*-*" #define SYSTEM_FONT "sans:pixelsize=12"
#define BOLD_SYSTEM_FONT "-*-helvetica-bold-r-normal-*-%d-*-*-*-*-*-*-*,-*-*-bold-r-*-*-%d-*-*-*-*-*-*-*" #define BOLD_SYSTEM_FONT "sans:bold:pixelsize=12"
#define FLOPPY_PATH "/floppy" #define FLOPPY_PATH "/floppy"
@@ -106,28 +106,6 @@ W_ReadConfigurations(void)
WINGsConfiguration.antialiasedText = WINGsConfiguration.antialiasedText =
WMGetUDBoolForKey(defaults, "AntialiasedText"); WMGetUDBoolForKey(defaults, "AntialiasedText");
WINGsConfiguration.useMultiByte = False;
str = WMGetUDStringForKey(defaults, "MultiByteText");
if (str) {
if (strcasecmp(str, "YES") == 0) {
WINGsConfiguration.useMultiByte = True;
} else if (strcasecmp(str, "AUTO") == 0) {
char *locale;
/* if it's a multibyte language (japanese, chinese or korean)
* then set it to True */
locale = setlocale(LC_CTYPE, NULL);
if (locale != NULL
&& (strncmp(locale, "ja", 2) == 0
|| strncmp(locale, "zh", 2) == 0
|| strncmp(locale, "ru", 2) == 0
|| strncmp(locale, "ko", 2) == 0)) {
WINGsConfiguration.useMultiByte = True;
}
}
}
WINGsConfiguration.doubleClickDelay = WINGsConfiguration.doubleClickDelay =
WMGetUDIntegerForKey(defaults, "DoubleClickTime"); WMGetUDIntegerForKey(defaults, "DoubleClickTime");

View File

@@ -442,28 +442,9 @@ arrangeLowerFrame(FontPanel *panel)
#define ALL_FONTS_MASK "-*-*-*-*-*-*-*-*-*-*-*-*-*-*"
#define FOUNDRY 0
#define FAMILY 1
#define WEIGHT 2
#define SLANT 3
#define SETWIDTH 4
#define ADD_STYLE 5
#define PIXEL_SIZE 6
#define POINT_SIZE 7
#define RES_X 8
#define RES_Y 9
#define SPACING 10
#define AV_WIDTH 11
#define REGISTRY 12
#define ENCODING 13
#define NUM_FIELDS 14 #define NUM_FIELDS 14
static int static int
isXLFD(char *font, int *length_ret) isXLFD(char *font, int *length_ret)
{ {
@@ -483,12 +464,12 @@ isXLFD(char *font, int *length_ret)
typedef struct { typedef struct {
char *typeface; char *typeface;
WMArray *sizes; WMArray *sizes;
} Xft_Typeface; } Typeface;
typedef struct { typedef struct {
char *name; /* gotta love simplicity */ char *name; /* gotta love simplicity */
WMArray *typefaces; WMArray *typefaces;
} Xft_Family; } Family;
static int static int
@@ -507,7 +488,7 @@ compare_int(const void *a, const void *b)
static void static void
addSizeToTypeface(Xft_Typeface *face, int size) addSizeToTypeface(Typeface *face, int size)
{ {
if (size == 0) { if (size == 0) {
int j; int j;
@@ -529,9 +510,9 @@ addSizeToTypeface(Xft_Typeface *face, int size)
} }
static void static void
addTypefaceToXftFamily(Xft_Family *fam, char *style) addTypefaceToXftFamily(Family *fam, char *style)
{ {
Xft_Typeface *face; Typeface *face;
WMArrayIterator i; WMArrayIterator i;
if(fam->typefaces) { if(fam->typefaces) {
@@ -545,8 +526,8 @@ addTypefaceToXftFamily(Xft_Family *fam, char *style)
fam->typefaces = WMCreateArray(4); fam->typefaces = WMCreateArray(4);
} }
face = wmalloc(sizeof(Xft_Typeface)); face = wmalloc(sizeof(Typeface));
memset(face, 0 , sizeof(Xft_Typeface)); memset(face, 0 , sizeof(Typeface));
face->typeface = wstrdup(style); face->typeface = wstrdup(style);
face->sizes = WMCreateArray(4); face->sizes = WMCreateArray(4);
@@ -565,7 +546,7 @@ addFontToXftFamily(WMHashTable *families, char *name, char *style)
{ {
WMArrayIterator i; WMArrayIterator i;
WMArray *array; WMArray *array;
Xft_Family *fam; Family *fam;
array = WMHashGet(families, name); array = WMHashGet(families, name);
if(array) { if(array) {
@@ -578,8 +559,8 @@ addFontToXftFamily(WMHashTable *families, char *name, char *style)
array = WMCreateArray(8); array = WMCreateArray(8);
fam = wmalloc(sizeof(Xft_Family)); fam = wmalloc(sizeof(Family));
memset(fam, 0, sizeof(Xft_Family)); memset(fam, 0, sizeof(Family));
fam->name = wstrdup(name); fam->name = wstrdup(name);
@@ -631,7 +612,7 @@ listFamilies(WMScreen *scr, WMFontPanel *panel)
while ((array = WMNextHashEnumeratorItem(&enumer))) { while ((array = WMNextHashEnumeratorItem(&enumer))) {
WMArrayIterator i; WMArrayIterator i;
Xft_Family *fam; Family *fam;
char buffer[256]; char buffer[256];
WMListItem *item; WMListItem *item;
@@ -655,20 +636,20 @@ static void
getSelectedFont(FontPanel *panel, char buffer[], int bufsize) getSelectedFont(FontPanel *panel, char buffer[], int bufsize)
{ {
WMListItem *item; WMListItem *item;
Xft_Family *family; Family *family;
Xft_Typeface *face; Typeface *face;
char *size; char *size;
item = WMGetListSelectedItem(panel->famLs); item = WMGetListSelectedItem(panel->famLs);
if (!item) if (!item)
return; return;
family = (Xft_Family*)item->clientData; family = (Family*)item->clientData;
item = WMGetListSelectedItem(panel->typLs); item = WMGetListSelectedItem(panel->typLs);
if (!item) if (!item)
return; return;
face = (Xft_Typeface*)item->clientData; face = (Typeface*)item->clientData;
size = WMGetTextFieldText(panel->sizT); size = WMGetTextFieldText(panel->sizT);
@@ -703,8 +684,8 @@ familyClick(WMWidget *w, void *data)
{ {
WMList *lPtr = (WMList*)w; WMList *lPtr = (WMList*)w;
WMListItem *item; WMListItem *item;
Xft_Family *family; Family *family;
Xft_Typeface *face; Typeface *face;
FontPanel *panel = (FontPanel*)data; FontPanel *panel = (FontPanel*)data;
WMArrayIterator i; WMArrayIterator i;
/* current typeface and size */ /* current typeface and size */
@@ -722,7 +703,7 @@ familyClick(WMWidget *w, void *data)
item = WMGetListSelectedItem(lPtr); item = WMGetListSelectedItem(lPtr);
family = (Xft_Family*)item->clientData; family = (Family*)item->clientData;
WMClearList(panel->typLs); WMClearList(panel->typLs);
@@ -775,7 +756,7 @@ typefaceClick(WMWidget *w, void *data)
{ {
FontPanel *panel = (FontPanel*)data; FontPanel *panel = (FontPanel*)data;
WMListItem *item; WMListItem *item;
Xft_Typeface *face; Typeface *face;
WMArrayIterator i; WMArrayIterator i;
char buffer[32]; char buffer[32];
@@ -787,7 +768,7 @@ typefaceClick(WMWidget *w, void *data)
item = WMGetListSelectedItem(panel->typLs); item = WMGetListSelectedItem(panel->typLs);
face = (Xft_Typeface*)item->clientData; face = (Typeface*)item->clientData;
WMClearList(panel->sizLs); WMClearList(panel->sizLs);
@@ -842,8 +823,8 @@ setFontPanelFontName(FontPanel *panel, FcChar8 *family, FcChar8 *style, double s
char asize[64]; char asize[64];
void *vsize; void *vsize;
WMListItem *item; WMListItem *item;
Xft_Family *fam; Family *fam;
Xft_Typeface *face; Typeface *face;
WMArrayIterator i; WMArrayIterator i;
famrow = WMFindRowOfListItemWithTitle(panel->famLs, family); famrow = WMFindRowOfListItemWithTitle(panel->famLs, family);
@@ -858,7 +839,7 @@ setFontPanelFontName(FontPanel *panel, FcChar8 *family, FcChar8 *style, double s
item = WMGetListSelectedItem(panel->famLs); item = WMGetListSelectedItem(panel->famLs);
fam = (Xft_Family*)item->clientData; fam = (Family*)item->clientData;
WM_ITERATE_ARRAY(fam->typefaces, face, i) { WM_ITERATE_ARRAY(fam->typefaces, face, i) {
char buffer[256]; char buffer[256];
int top=0; int top=0;
@@ -886,7 +867,7 @@ setFontPanelFontName(FontPanel *panel, FcChar8 *family, FcChar8 *style, double s
item = WMGetListSelectedItem(panel->typLs); item = WMGetListSelectedItem(panel->typLs);
face = (Xft_Typeface*)item->clientData; face = (Typeface*)item->clientData;
WMClearList(panel->sizLs); WMClearList(panel->sizLs);

View File

@@ -591,7 +591,6 @@ WMCreateScreenWithRContext(Display *display, int screen, RContext *context)
"WM_STATE" "WM_STATE"
}; };
Atom atoms[sizeof(atomNames)/sizeof(char*)]; Atom atoms[sizeof(atomNames)/sizeof(char*)];
char *locale;
int i; int i;
if (!initialized) { if (!initialized) {
@@ -754,16 +753,6 @@ WMCreateScreenWithRContext(Display *display, int screen, RContext *context)
scrPtr->stipple = stipple; scrPtr->stipple = stipple;
scrPtr->useMultiByte = WINGsConfiguration.useMultiByte;
scrPtr->useMultiByte = 0;
locale = setlocale(LC_CTYPE, NULL);
//printf("LC_CTYPE=%s\n", locale);
if (!locale || strcmp(locale, "C")==0 || strcmp(locale, "POSIX")==0)
scrPtr->useWideChar = 0;
else
scrPtr->useWideChar = 1;
scrPtr->antialiasedText = WINGsConfiguration.antialiasedText; scrPtr->antialiasedText = WINGsConfiguration.antialiasedText;
scrPtr->normalFont = WMSystemFontOfSize(scrPtr, 0); scrPtr->normalFont = WMSystemFontOfSize(scrPtr, 0);

View File

@@ -20,7 +20,6 @@ WPrefs_SOURCES = \
Configurations.c \ Configurations.c \
Expert.c \ Expert.c \
Focus.c \ Focus.c \
Font.c \
FontSimple.c \ FontSimple.c \
Icons.c \ Icons.c \
KeyboardSettings.c \ KeyboardSettings.c \

View File

@@ -323,8 +323,7 @@ createMainWindow(WMScreen *scr)
WMMoveWidget(WPrefs.banner, FRAME_LEFT, FRAME_TOP); WMMoveWidget(WPrefs.banner, FRAME_LEFT, FRAME_TOP);
WMSetFrameRelief(WPrefs.banner, WRFlat); WMSetFrameRelief(WPrefs.banner, WRFlat);
font = WMCreateFont(scr, "-*-times-bold-r-*-*-24-*-*-*-*-*-*-*," font = WMCreateFont(scr, "Lucida Sans,Comic Sans MS,Times New Roman,serif:bold:pixelsize=24");
"-*-fixed-medium-r-normal-*-24-*");
if (!font) if (!font)
font = WMBoldSystemFontOfSize(scr, 24); font = WMBoldSystemFontOfSize(scr, 24);
WPrefs.nameL = WMCreateLabel(WPrefs.banner); WPrefs.nameL = WMCreateLabel(WPrefs.banner);

View File

@@ -1169,7 +1169,8 @@ handleLogoPush(XEvent *event, void *data)
/* Alternatively we can draw text in a pixmap and scroll it smoothly */ /* Alternatively we can draw text in a pixmap and scroll it smoothly */
if ((panel->oldFont = WMGetLabelFont(panel->versionL))!=NULL) if ((panel->oldFont = WMGetLabelFont(panel->versionL))!=NULL)
WMRetainFont(panel->oldFont); WMRetainFont(panel->oldFont);
font = WMCreateFont(WMWidgetScreen(panel->versionL), "-*-fixed-medium-r-*-*-13-*-*-*-*-*-*-*"); font = WMCreateFont(WMWidgetScreen(panel->versionL),
"Lucida Console,Courier New,monospace:pixelsize=12");
if (font) { if (font) {
WMSetLabelFont(panel->versionL, font); WMSetLabelFont(panel->versionL, font);
WMReleaseFont(font); WMReleaseFont(font);
@@ -1215,10 +1216,11 @@ wShowInfoPanel(WScreen *scr)
WMFont *font; WMFont *font;
char *strbuf = NULL; char *strbuf = NULL;
char buffer[256]; char buffer[256];
char *name;
Window parent; Window parent;
WWindow *wwin; WWindow *wwin;
char **strl; char **strl;
int i, width, sepWidth; int i, width=50, sepWidth;
char *visuals[] = { char *visuals[] = {
"StaticGray", "StaticGray",
"GrayScale", "GrayScale",
@@ -1268,12 +1270,8 @@ wShowInfoPanel(WScreen *scr)
WMResizeWidget(panel->name1L, 240, 30 - sepWidth); WMResizeWidget(panel->name1L, 240, 30 - sepWidth);
WMMoveWidget(panel->name1L, 100, 30); WMMoveWidget(panel->name1L, 100, 30);
if (WMIsAntialiasingEnabled(scr->wmscreen)) { name = "Lucida Sans,Comic Sans MS,URW Gothic L,Trebuchet MS,sans:bold:pixelsize=26";
font = WMBoldSystemFontOfSize(scr->wmscreen, 24); font = WMCreateFont(scr->wmscreen, name);
} else {
font = WMCreateFont(scr->wmscreen, "-*-utopia-*-r-*-*-25-*");
font = font ? font : WMBoldSystemFontOfSize(scr->wmscreen, 24);
}
strbuf = "Window Maker"; strbuf = "Window Maker";
if (font) { if (font) {
width = WMWidthOfString(font, strbuf, strlen(strbuf)); width = WMWidthOfString(font, strbuf, strlen(strbuf));
@@ -1292,7 +1290,8 @@ wShowInfoPanel(WScreen *scr)
panel->name2L = WMCreateLabel(panel->win); panel->name2L = WMCreateLabel(panel->win);
WMResizeWidget(panel->name2L, 240, 24); WMResizeWidget(panel->name2L, 240, 24);
WMMoveWidget(panel->name2L, 100, 60); WMMoveWidget(panel->name2L, 100, 60);
font = WMBoldSystemFontOfSize(scr->wmscreen, 18); name = "URW Gothic L,Nimbus Sans L,sans:pixelsize=16";
font = WMCreateFont(scr->wmscreen, name);
if (font) { if (font) {
WMSetLabelFont(panel->name2L, font); WMSetLabelFont(panel->name2L, font);
WMReleaseFont(font); WMReleaseFont(font);

View File

@@ -65,10 +65,6 @@ print_help()
puts(" about what the original font was to allow hand tuning the"); puts(" about what the original font was to allow hand tuning the");
puts(" result or restoring the xlfd. The default is to not add it"); puts(" result or restoring the xlfd. The default is to not add it");
puts(" as it results in long, unreadable and confusing names."); puts(" as it results in long, unreadable and confusing names.");
puts(" --sets-too try to approximate fontsets by using their first complete xlfd.");
puts(" This only works for singlebyte languages. The default is to");
puts(" replace the fontset with the default: 'sans-serif:pixelsize=12'");
puts(" which should display properly for any language.");
puts(""); puts("");
} }

View File

@@ -6,7 +6,7 @@
#include "../src/wconfig.h" #include "../src/wconfig.h"
#define DEFAULT_FONT "sans-serif:pixelsize=12" #define DEFAULT_FONT "sans:pixelsize=12"
static int static int
countChar(char *str, char c) countChar(char *str, char c)
@@ -161,7 +161,8 @@ xlfdToFc(char *xlfd, char *useFamily, Bool keepXLFD)
/* return converted font (if conversion is needed) else the original font */ /* return converted font (if conversion is needed) else the original font */
char* convertFont(char *font, Bool keepXLFD) char*
convertFont(char *font, Bool keepXLFD)
{ {
if (font[0]=='-') { if (font[0]=='-') {
char *res; char *res;
@@ -181,3 +182,4 @@ char* convertFont(char *font, Bool keepXLFD)
return font; return font;
} }
} }

View File

@@ -115,8 +115,6 @@ static char *font_options[] = {
NULL NULL
}; };
#define DEFAULT_FONT "sans-serif:pixelsize=12"
char *ProgName; char *ProgName;
WMPropList *PixmapPath = NULL; WMPropList *PixmapPath = NULL;

View File

@@ -37,8 +37,6 @@
#define MAX_OPTIONS 128 #define MAX_OPTIONS 128
#define DEFAULT_FONT "sans:pixelsize=12"
char *FontOptions[] = { char *FontOptions[] = {
"IconTitleFont", "IconTitleFont",
"ClipTitleFont", "ClipTitleFont",