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

adding first "proportional" font.

actually just two width: normal and ',.:;
This commit is contained in:
mfrasca
2006-10-31 16:19:27 +00:00
parent d7ea546e66
commit 29d6cfc65c
2 changed files with 44 additions and 7 deletions

32
wmdocklib/6(3)x8-7seg.xpm Normal file
View File

@@ -0,0 +1,32 @@
/* XPM */
static char * wmtz_master_xpm[] = {
"192 24 4 1",
"$ c #FFFFFF",
"& c #9e9e9e",
"% c #5b5b5b",
"+ c #000000",
"+%%%+++%%%+++%%%+++%%%+++%%%+++%%%+++%%%+++%%%+++%%%+++%%%+++%%%+++%%%+++++++++++++++%%%+++++++++$$$+++%%%&+&$$$&+&$$$&+&%%%&+&$$$&+&$$$&+&$$$&+&$$$&+&$$$&++++++++%%%+++%%%+++%%%+++%%%+++%%%++",
"%+++%+%+++%+%+++%+%+++%+%+++%+%+++%+%+++%+%+++%+%+++%+%+++%+%+++%+%+++%+++++++++++++%+++%++++$++$+++$+%+++$+%+++$+%+++$+$+++$+$+++%+$+++%+%+++$+$+++$+$+++$+++++%+%+++%+%+++%+%+++%+%+++%+%+++%+",
"%+++%+%+++%+%+++%+%+++%+%+++%+%+++%+%+++%+%+++%+%+++%+%+++%+%+++%+%+++%++$++++$+++++%+++%++++$++$+++$+%+++$+%+++$+%+++$+$+++$+$+++%+$+++%+%+++$+$+++$+$+++$+$+++%+%+++%+%+++%+%+++%+%+++%+%+++%+",
"+%%%+++%%%+++%%%+++%%%+++%%%+++%%%+++%%%+++%%%+++%%%+++%%%+++%%%+++%%%+++&++++&++++++%%%++++$+++&%%%&++%%%&+&$$$&++$$$&+&$$$&+&$$$&+&$$$&++%%%&+%$$$%+&$$$&+&++++++%%%+++%%%+++%%%+++%%%+++%%%++",
"%+++%+%+++%+%+++%+%+++%+%+++%+%+++%+%+++%+%+++%+%+++%+%+++%+%+++%+%+++%+++++++++++++%+++%+++$+++$+++$+%+++$+$+++%+%+++$+%+++$+%+++$+$+++$+%+++$+$+++$+%+++$+++++%+%+++%+%+++%+%+++%+%+++%+%+++%+",
"%+++%+%+++%+%+++%+%+++%+%+++%+%+++%+%+++%+%+++%+%+++%+%+++%+%+++%+%+++%++$++++$++++&%+++%++$++++$+++$+%+++$+$+++%+%+++$+%+++$+%+++$+$+++$+%+++$+$+++$+%+++$+$+++%+%+++%+%+++%+%+++%+%+++%+%+++%+",
"+%%%+++%%%+++%%%+++%%%+++%%%+++%%%+++%%%+++%%%+++%%%+++%%%+++%%%+++%%%+++&++++&++++$+%%%+++$+++++$$$+++%%%$+&$$$&+&$$$&++%%%&+&$$$&+&$$$&++%%%&+&$$$&+&$$$&+&++++++%%%+++%%%+++%%%+++%%%+++%%%++",
"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++",
"&$$$&+%$$$%+&$$$++&$$$&+&$$$++&$$$&+&$$$&+&$$$&+&%%%&++%%%&++%%%&+&%%%&+&%%%++$%%%$+&$$$++&$$$&+&$$$&+&$$$&+&$$$&+&$$$&+&$$$&+&%%%&+&%%%&+&%%%&+&%%%&+&%%%&+&$$$&++%%%+++%%%+++%%%+++%%%+++%%%++",
"$+++$+$+++$+$+++$+$+++%+$+++$+$+++%+$+++%+$+++%+$+++$+%+++$+%+++$+$+++$+$+++%+$$+$$+$+++$+$+++$+$+++$+$+++$+$+++$+$+++%+%+$+%+$+++$+$+++$+$+++$+$+++$+$+++$+%+++$+%+++%+%+++%+%+++%+%+++%+%+++%+",
"$+$+$+$+++$+$+++$+$+++%+$+++$+$+++%+$+++%+$+++%+$+++$+%+++$+%+++$+$++$%+$+++%+$+$+$+$+++$+$+++$+$+++$+$+++$+$+++$+$+++%+%+$+%+$+++$+$+++$+$+++$+%$+$%+$+++$+%++$%+%+++%+%+++%+%+++%+%+++%+%+++%+",
"&%&$&+&$$$&+&$$$++&%%%++&%%%&+&$$$++&$$$++&%$$&+&$$$&++%%%&++%%%&+&$$%++&%%%++&%%%&+&%%%&+&%%%&+&$$$&+&$%%&+&$$$++&$$$&++%&%++&%%%&+&%%%&+&%%%&++%$%++&$$$&++%$%+++%%%+++%%%+++%%%+++%%%+++%%%++",
"$+++%+$+++$+$+++$+$+++%+$+++$+$+++%+$+++%+$+++$+$+++$+%+++$+%+++$+$++$%+$+++%+$+++$+$+++$+$+++$+$+++%+$+$+$+$+++$+%+++$+%+$+%+$+++$+$+++$+$+$+$+%$+$%+%+++$+%$++%+%+++%+%+++%+%+++%+%+++%+%+++%+",
"$+++%+$+++$+$+++$+$+++%+$+++$+$+++%+$+++%+$+++$+$+++$+%+++$+%+++$+$+++$+$+++%+$+++$+$+++$+$+++$+$+++%+$++$$+$+++$+%+++$+%+$+%+$+++$+$+++$+$$+$$+$+++$+%+++$+$+++%+%+++%+%+++%+%+++%+%+++%+%+++%+",
"&$$$&+&%%%&+&$$$++&$$$&+$$$$++&$$$&+$%%%++&$$$&+&%%%&++%%%$+&$$$&+&%%%&+&$$$%+&%%%&+$%%%$+&$$$&+&%%%++&$$$&+&%%%&+&$$$&++%&%++%$$$$++$$$++$%%%$+&%%%$&&$$$&+&$$$&++%%%+++%%%+++%%%+++%%%+++%%%++",
"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++",
"+%%%++%$$$%+&$$$++&$$$&+&$$$++&$$$&+&$$$&+&$$$&+&%%%&++%%%&++%%%&+&%%%&+&%%%++$%%%$+&$$$++&$$$&+&$$$&+&$$$&+&$$$&+&$$$&+&$$$&+&%%%&+&%%%&+&%%%&+&%%%&+&%%%&+&$$$&++%%%+++%%%+++%%%+++%%%+++%%%++",
"%+++%+$+++$+$+++$+$+++%+$+++$+$+++%+$+++%+$+++%+$+++$+%+++$+%+++$+$+++$+$+++%+$$+$$+$+++$+$+++$+$+++$+$+++$+$+++$+$+++%+%+$+%+$+++$+$+++$+$+++$+$+++$+$+++$+%+++$+%+++%+%+++%+%+++%+%+++%+%+++%+",
"%+++%+$+++$+$+++$+$+++%+$+++$+$+++%+$+++%+$+++%+$+++$+%+++$+%+++$+$++$%+$+++%+$+$+$+$+++$+$+++$+$+++$+$+++$+$+++$+$+++%+%+$+%+$+++$+$+++$+$+++$+%$+$%+$+++$+%++$%+%+++%+%+++%+%+++%+%+++%+%+++%+",
"+%%%++&$$$&+&$$$++&%%%++&%%%&+&$$$++&$$$++&%$$&+&$$$&++%%%&++%%%&+&$$%++&%%%++&%%%&+&%%%&+&%%%&+&$$$&+&$%%&+&$$$++&$$$&++%&%++&%%%&+&%%%&+&%%%&++%$%++&$$$&++%$%+++%%%+++%%%+++%%%+++%%%+++%%%++",
"%+++%+$+++$+$+++$+$+++%+$+++$+$+++%+$+++%+$+++$+$+++$+%+++$+%+++$+$++$%+$+++%+$+++$+$+++$+$+++$+$+++%+$+$+$+$+++$+%+++$+%+$+%+$+++$+$+++$+$+$+$+%$+$%+%+++$+%$++%+%+++%+%+++%+%+++%+%+++%+%+++%+",
"%+++%+$+++$+$+++$+$+++%+$+++$+$+++%+$+++%+$+++$+$+++$+%+++$+%+++$+$+++$+$+++%+$+++$+$+++$+$+++$+$+++%+$++$$+$+++$+%+++$+%+$+%+$+++$+$+++$+$$+$$+$+++$+%+++$+$+++%+%+++%+%+++%+%+++%+%+++%+%+++%+",
"+%%%++&%%%&+&$$$++&$$$&+$$$$++&$$$&+$%%%++&$$$&+&%%%&++%%%$+&$$$&+&%%%&+&$$$%+&%%%&+$%%%$+&$$$&+&%%%++&$$$&+&%%%&+&$$$&++%&%++%$$$$++$$$++$%%%$+&%%%$&&$$$&+&$$$&++%%%+++%%%+++%%%+++%%%+++%%%++",
"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++",
};

View File

@@ -103,8 +103,11 @@ def addChar(ch, x, y, xOffset, yOffset, width, height):
chX = pos % linelength chX = pos % linelength
targX = x + xOffset targX = x + xOffset
targY = y + yOffset targY = y + yOffset
pywmgeneral.copyXPMArea(chX, chY, char_width, char_height, targX, targY) chW = char_width
return (char_width, char_height) if ch in "',.:;":
chW = char_twidth
pywmgeneral.copyXPMArea(chX, chY, chW, char_height, targX, targY)
return (chW, char_height)
def addString(s, x, y, xOffset, yOffset, width, height): def addString(s, x, y, xOffset, yOffset, width, height):
"""Add a string at the given x and y positions. """Add a string at the given x and y positions.
@@ -269,10 +272,12 @@ def initPixmap(background=None,
font_palette, fontdef = readXPM(__file__[:__file__.rfind(os.sep) + 1] + font_name + '.xpm') font_palette, fontdef = readXPM(__file__[:__file__.rfind(os.sep) + 1] + font_name + '.xpm')
import re import re
m = re.match(r'.*([0-9]+)x([0-9]+).*', font_name) m = re.match(r'.*?(?P<w>[0-9]+)(?:\((?P<t>[0-9]+)\))?x(?P<h>[0-9]+).*', font_name)
if not m: if not m:
raise ValueError("can't infer font size from name (does not contain wxh)") raise ValueError("can't infer font size from name (does not contain wxh)")
width, height = [int(item) for item in m.groups()] width = int(m.groupdict().get('w'))
height = int(m.groupdict().get('h'))
thinwidth = int(m.groupdict().get('t') or width)
replace = [] replace = []
for code, value in font_palette.items(): for code, value in font_palette.items():
@@ -287,7 +292,7 @@ def initPixmap(background=None,
fontdef[i] = row.replace(code, newcode) fontdef[i] = row.replace(code, newcode)
font_palette[newcode] = font_palette[code] font_palette[newcode] = font_palette[code]
del font_palette[code] del font_palette[code]
return width, height, fontdef, font_palette return width, height, thinwidth, fontdef, font_palette
def calibrateFontPalette(font_palette, fg, bg): def calibrateFontPalette(font_palette, fg, bg):
"""computes modified font_palette """computes modified font_palette
@@ -316,8 +321,8 @@ def initPixmap(background=None,
return new_font_palette return new_font_palette
global char_width, char_height global char_width, char_height, char_twidth
char_width, char_height, fontdef, font_palette = readFont(font_name) char_width, char_height, char_twidth, fontdef, font_palette = readFont(font_name)
font_palette = calibrateFontPalette(font_palette, palette[fg], palette[bg]) font_palette = calibrateFontPalette(font_palette, palette[fg], palette[bg])
palette.update(font_palette) palette.update(font_palette)