mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 12:28:22 +01:00
added fontmanager.c
This commit is contained in:
81
WINGs/fontmanager.c
Normal file
81
WINGs/fontmanager.c
Normal file
@@ -0,0 +1,81 @@
|
||||
|
||||
#include "WINGsP.h"
|
||||
|
||||
|
||||
static void
|
||||
changeFontProp(char *fname, char *newprop, int which)
|
||||
{
|
||||
char before[128], prop[128], after[128];
|
||||
char *ptr, *bptr;
|
||||
int part=0;
|
||||
|
||||
if(!fname || !prop)
|
||||
return;
|
||||
|
||||
ptr = fname;
|
||||
bptr = before;
|
||||
while (*ptr) {
|
||||
if(*ptr == '-') {
|
||||
*bptr = 0;
|
||||
if(part==which) bptr = prop;
|
||||
else if(part==which+1) bptr = after;
|
||||
*bptr++ = *ptr;
|
||||
part++;
|
||||
} else {
|
||||
*bptr++ = *ptr;
|
||||
} ptr++;
|
||||
}*bptr = 0;
|
||||
snprintf(fname, 255, "%s-%s%s", before, newprop, after);
|
||||
}
|
||||
|
||||
|
||||
WMFont *
|
||||
WMGetFontPlain(WMScreen *scrPtr, WMFont *font)
|
||||
{
|
||||
WMFont *nfont=NULL;
|
||||
if(!scrPtr|| !font)
|
||||
return NULL;
|
||||
return font;
|
||||
|
||||
}
|
||||
|
||||
WMFont *
|
||||
WMGetFontBold(WMScreen *scrPtr, WMFont *font)
|
||||
{
|
||||
WMFont *newfont=NULL;
|
||||
char fname[256];
|
||||
if(!scrPtr || !font)
|
||||
return NULL;
|
||||
snprintf(fname, 255, font->name);
|
||||
changeFontProp(fname, "bold", 2);
|
||||
newfont = WMCreateNormalFont(scrPtr, fname);
|
||||
if(!newfont)
|
||||
newfont = font;
|
||||
return newfont;
|
||||
}
|
||||
|
||||
WMFont *
|
||||
WMGetFontItalic(WMScreen *scrPtr, WMFont *font)
|
||||
{
|
||||
WMFont *newfont=NULL;
|
||||
char fname[256];
|
||||
if(!scrPtr || !font)
|
||||
return NULL;
|
||||
snprintf(fname, 255, font->name);
|
||||
changeFontProp(fname, "o", 3);
|
||||
newfont = WMCreateNormalFont(scrPtr, fname);
|
||||
if(!newfont)
|
||||
newfont = font;
|
||||
return newfont;
|
||||
}
|
||||
|
||||
WMFont *
|
||||
WMGetFontOfSize(WMScreen *scrPtr, WMFont *font, int size)
|
||||
{
|
||||
WMFont *nfont=NULL;
|
||||
if(!scrPtr || !font || size<1)
|
||||
return NULL;
|
||||
return font;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,22 @@
|
||||
/* WMRuler: nifty ruler widget for WINGs (OK, for WMText ;-) */
|
||||
/* Copyleft (>) 1999, 2000 Nwanua Elumeze <nwanua@colorado.edu> */
|
||||
/*
|
||||
* WINGs WMRuler nifty ruler widget for WINGs (OK, for WMText ;-)
|
||||
*
|
||||
* Copyright (c) 1999-2000 Nwanua Elumeze
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
|
||||
#include "WINGsP.h"
|
||||
@@ -26,8 +43,9 @@ typedef struct W_Ruler {
|
||||
|
||||
struct {
|
||||
unsigned int buttonPressed:1;
|
||||
/* 0, 1, 2, 3, 4, 5, 6 */
|
||||
unsigned int whichMarker:3; /* none, left, right, first, body, tabstop, both */
|
||||
unsigned int whichMarker:3;
|
||||
/* 0, 1, 2, 3, 4, 5, 6 */
|
||||
/* none, left, right, first, body, tabstop, first & body */
|
||||
unsigned int RESERVED:28;
|
||||
} flags;
|
||||
} Ruler;
|
||||
@@ -43,7 +61,8 @@ typedef struct W_Ruler {
|
||||
|
|
||||
|
||||
*/
|
||||
static void drawLeftMarker(Ruler * rPtr)
|
||||
static void
|
||||
drawLeftMarker(Ruler * rPtr)
|
||||
{
|
||||
XPoint points[4];
|
||||
int xpos = (rPtr->flags.whichMarker == 1 ?
|
||||
@@ -66,9 +85,9 @@ static void drawLeftMarker(Ruler * rPtr)
|
||||
|
||||
/* Marker for right margin
|
||||
|
||||
/|
|
||||
/ |
|
||||
/__|
|
||||
/|
|
||||
/ |
|
||||
/__|
|
||||
|
|
||||
|
|
||||
|
||||
|
||||
@@ -1075,7 +1075,9 @@ int main(int argc, char **argv)
|
||||
*
|
||||
* Put the testSomething() function you want to test here.
|
||||
*/
|
||||
testTabView(scr);
|
||||
|
||||
#if 0
|
||||
|
||||
testDragAndDrop(scr);
|
||||
testDragAndDrop(scr);
|
||||
@@ -1084,13 +1086,11 @@ int main(int argc, char **argv)
|
||||
|
||||
testButton(scr);
|
||||
|
||||
#if 0
|
||||
testFrame(scr);
|
||||
|
||||
|
||||
testColorWell(scr);
|
||||
|
||||
testTabView(scr);
|
||||
|
||||
testFontPanel(scr);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user