Commit 7c89244a authored by Diederik van Arkel's avatar Diederik van Arkel

consolidate fixed font handling

parent 20f15543
......@@ -28,3 +28,5 @@ getPenAttributeColour :: ![.PenAttribute] -> Colour;
getPenAttributeBack :: ![.PenAttribute] -> Colour;
seqmap :: (.a -> .(.b -> .b)) ![.a] !.b -> .b;
notEmpty s :== not (isEmpty s)
lisFixedWidth :: !.FontName !*Picture -> (!Bool,!*Picture)
lfilter :: ![.Bool] ![.a] -> [.a]
......@@ -147,3 +147,19 @@ seqmap f [h:t] e
notEmpty s :== not (isEmpty s)
//--
lisFixedWidth :: !.FontName !*Picture -> (!Bool,!*Picture)
lisFixedWidth fontname env
# ((ok,font), env) = openFont {fName=fontname,fSize=12,fStyles=[]} env
| not ok = (ok,env)
// # (wide, env) = getFontCharWidth font 'M' env
// (narrow, env) = getFontCharWidth font 'i' env
# ([wide,narrow:_], env) = getFontCharWidths font ['M','i'] env
= (wide == narrow, env)
lfilter :: ![.Bool] ![.a] -> [.a]
lfilter [True:r] [a:x] = [a:lfilter r x]
lfilter [_:r] [_:x] = lfilter r x
lfilter _ _ = []
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment