draft commit, test implementation

This commit is contained in:
traycold
2012-03-19 19:41:09 +01:00
parent 496ab3720e
commit c11ecce55a
3 changed files with 68 additions and 7 deletions

View File

@@ -6,19 +6,28 @@ fb = einkfb.open("/dev/fb0")
width, height = fb:getSize()
print("open")
face = freetype.newBuiltinFace("sans", 64)
--face = freetype.newFace("test.ttf", 64)
size = 50
--face = freetype.newBuiltinFace("sans", 64)
face = freetype.newFace("/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf", size)
print("got face")
if face:hasKerning() then
print("has kerning")
end
fb.bb:paintRect(1,1,599,300,7);
width, height = fb:getSize()
fb.bb:paintRect(5,5,width-5,height-5,4);
renderUtf8Text(fb.bb, 100, 100, face, "h", "AV T.T: gxyt!", true)
renderUtf8Text(fb.bb, 100, 200, face, "h", "AV T.T: gxyt!", false)
faceHeight, faceAscender = face:getHeight();
print("face height:"..tostring(faceHeight).." - ascender:"..faceAscender)
faceHeight = math.ceil(faceHeight)
faceAscender = math.ceil(faceAscender)
print("face height:"..tostring(faceHeight).." - ascender:"..faceAscender)
posY = 5 + faceAscender
renderUtf8Text(fb.bb, 5, posY, face, "h", "AV T.T: gxyt!", true)
posY = posY + faceHeight
renderUtf8Text(fb.bb, 5, posY, face, "h2", "AV T.T: gxyt!", false)
fb:refresh()