mirror of
https://github.com/gryf/wmaker.git
synced 2026-01-10 07:44:14 +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:
@@ -236,10 +236,6 @@ typedef struct W_Screen {
|
||||
|
||||
WMHashTable *fontCache;
|
||||
|
||||
Bool useMultiByte;
|
||||
|
||||
Bool useWideChar;
|
||||
|
||||
Bool antialiasedText;
|
||||
|
||||
unsigned int ignoredModifierMask; /* modifiers to ignore when typing txt */
|
||||
@@ -453,7 +449,6 @@ typedef struct _WINGsConfiguration {
|
||||
char *boldSystemFont;
|
||||
int defaultFontSize;
|
||||
Bool antialiasedText;
|
||||
Bool useMultiByte;
|
||||
char *floppyPath;
|
||||
unsigned doubleClickDelay;
|
||||
unsigned mouseWheelUp;
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -106,28 +106,6 @@ W_ReadConfigurations(void)
|
||||
WINGsConfiguration.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 =
|
||||
WMGetUDIntegerForKey(defaults, "DoubleClickTime");
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
static int
|
||||
isXLFD(char *font, int *length_ret)
|
||||
{
|
||||
@@ -483,12 +464,12 @@ isXLFD(char *font, int *length_ret)
|
||||
typedef struct {
|
||||
char *typeface;
|
||||
WMArray *sizes;
|
||||
} Xft_Typeface;
|
||||
} Typeface;
|
||||
|
||||
typedef struct {
|
||||
char *name; /* gotta love simplicity */
|
||||
WMArray *typefaces;
|
||||
} Xft_Family;
|
||||
} Family;
|
||||
|
||||
|
||||
static int
|
||||
@@ -507,7 +488,7 @@ compare_int(const void *a, const void *b)
|
||||
|
||||
|
||||
static void
|
||||
addSizeToTypeface(Xft_Typeface *face, int size)
|
||||
addSizeToTypeface(Typeface *face, int size)
|
||||
{
|
||||
if (size == 0) {
|
||||
int j;
|
||||
@@ -529,9 +510,9 @@ addSizeToTypeface(Xft_Typeface *face, int size)
|
||||
}
|
||||
|
||||
static void
|
||||
addTypefaceToXftFamily(Xft_Family *fam, char *style)
|
||||
addTypefaceToXftFamily(Family *fam, char *style)
|
||||
{
|
||||
Xft_Typeface *face;
|
||||
Typeface *face;
|
||||
WMArrayIterator i;
|
||||
|
||||
if(fam->typefaces) {
|
||||
@@ -545,8 +526,8 @@ addTypefaceToXftFamily(Xft_Family *fam, char *style)
|
||||
fam->typefaces = WMCreateArray(4);
|
||||
}
|
||||
|
||||
face = wmalloc(sizeof(Xft_Typeface));
|
||||
memset(face, 0 , sizeof(Xft_Typeface));
|
||||
face = wmalloc(sizeof(Typeface));
|
||||
memset(face, 0 , sizeof(Typeface));
|
||||
|
||||
face->typeface = wstrdup(style);
|
||||
face->sizes = WMCreateArray(4);
|
||||
@@ -565,7 +546,7 @@ addFontToXftFamily(WMHashTable *families, char *name, char *style)
|
||||
{
|
||||
WMArrayIterator i;
|
||||
WMArray *array;
|
||||
Xft_Family *fam;
|
||||
Family *fam;
|
||||
|
||||
array = WMHashGet(families, name);
|
||||
if(array) {
|
||||
@@ -578,8 +559,8 @@ addFontToXftFamily(WMHashTable *families, char *name, char *style)
|
||||
|
||||
array = WMCreateArray(8);
|
||||
|
||||
fam = wmalloc(sizeof(Xft_Family));
|
||||
memset(fam, 0, sizeof(Xft_Family));
|
||||
fam = wmalloc(sizeof(Family));
|
||||
memset(fam, 0, sizeof(Family));
|
||||
|
||||
fam->name = wstrdup(name);
|
||||
|
||||
@@ -631,7 +612,7 @@ listFamilies(WMScreen *scr, WMFontPanel *panel)
|
||||
|
||||
while ((array = WMNextHashEnumeratorItem(&enumer))) {
|
||||
WMArrayIterator i;
|
||||
Xft_Family *fam;
|
||||
Family *fam;
|
||||
char buffer[256];
|
||||
WMListItem *item;
|
||||
|
||||
@@ -655,20 +636,20 @@ static void
|
||||
getSelectedFont(FontPanel *panel, char buffer[], int bufsize)
|
||||
{
|
||||
WMListItem *item;
|
||||
Xft_Family *family;
|
||||
Xft_Typeface *face;
|
||||
Family *family;
|
||||
Typeface *face;
|
||||
char *size;
|
||||
|
||||
|
||||
item = WMGetListSelectedItem(panel->famLs);
|
||||
if (!item)
|
||||
return;
|
||||
family = (Xft_Family*)item->clientData;
|
||||
family = (Family*)item->clientData;
|
||||
|
||||
item = WMGetListSelectedItem(panel->typLs);
|
||||
if (!item)
|
||||
return;
|
||||
face = (Xft_Typeface*)item->clientData;
|
||||
face = (Typeface*)item->clientData;
|
||||
|
||||
size = WMGetTextFieldText(panel->sizT);
|
||||
|
||||
@@ -703,8 +684,8 @@ familyClick(WMWidget *w, void *data)
|
||||
{
|
||||
WMList *lPtr = (WMList*)w;
|
||||
WMListItem *item;
|
||||
Xft_Family *family;
|
||||
Xft_Typeface *face;
|
||||
Family *family;
|
||||
Typeface *face;
|
||||
FontPanel *panel = (FontPanel*)data;
|
||||
WMArrayIterator i;
|
||||
/* current typeface and size */
|
||||
@@ -722,7 +703,7 @@ familyClick(WMWidget *w, void *data)
|
||||
|
||||
|
||||
item = WMGetListSelectedItem(lPtr);
|
||||
family = (Xft_Family*)item->clientData;
|
||||
family = (Family*)item->clientData;
|
||||
|
||||
WMClearList(panel->typLs);
|
||||
|
||||
@@ -775,7 +756,7 @@ typefaceClick(WMWidget *w, void *data)
|
||||
{
|
||||
FontPanel *panel = (FontPanel*)data;
|
||||
WMListItem *item;
|
||||
Xft_Typeface *face;
|
||||
Typeface *face;
|
||||
WMArrayIterator i;
|
||||
char buffer[32];
|
||||
|
||||
@@ -787,7 +768,7 @@ typefaceClick(WMWidget *w, void *data)
|
||||
|
||||
|
||||
item = WMGetListSelectedItem(panel->typLs);
|
||||
face = (Xft_Typeface*)item->clientData;
|
||||
face = (Typeface*)item->clientData;
|
||||
|
||||
WMClearList(panel->sizLs);
|
||||
|
||||
@@ -842,8 +823,8 @@ setFontPanelFontName(FontPanel *panel, FcChar8 *family, FcChar8 *style, double s
|
||||
char asize[64];
|
||||
void *vsize;
|
||||
WMListItem *item;
|
||||
Xft_Family *fam;
|
||||
Xft_Typeface *face;
|
||||
Family *fam;
|
||||
Typeface *face;
|
||||
WMArrayIterator i;
|
||||
|
||||
famrow = WMFindRowOfListItemWithTitle(panel->famLs, family);
|
||||
@@ -858,7 +839,7 @@ setFontPanelFontName(FontPanel *panel, FcChar8 *family, FcChar8 *style, double s
|
||||
|
||||
item = WMGetListSelectedItem(panel->famLs);
|
||||
|
||||
fam = (Xft_Family*)item->clientData;
|
||||
fam = (Family*)item->clientData;
|
||||
WM_ITERATE_ARRAY(fam->typefaces, face, i) {
|
||||
char buffer[256];
|
||||
int top=0;
|
||||
@@ -886,7 +867,7 @@ setFontPanelFontName(FontPanel *panel, FcChar8 *family, FcChar8 *style, double s
|
||||
|
||||
item = WMGetListSelectedItem(panel->typLs);
|
||||
|
||||
face = (Xft_Typeface*)item->clientData;
|
||||
face = (Typeface*)item->clientData;
|
||||
|
||||
WMClearList(panel->sizLs);
|
||||
|
||||
|
||||
@@ -591,7 +591,6 @@ WMCreateScreenWithRContext(Display *display, int screen, RContext *context)
|
||||
"WM_STATE"
|
||||
};
|
||||
Atom atoms[sizeof(atomNames)/sizeof(char*)];
|
||||
char *locale;
|
||||
int i;
|
||||
|
||||
if (!initialized) {
|
||||
@@ -754,16 +753,6 @@ WMCreateScreenWithRContext(Display *display, int screen, RContext *context)
|
||||
|
||||
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->normalFont = WMSystemFontOfSize(scrPtr, 0);
|
||||
|
||||
Reference in New Issue
Block a user