mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
draft commit, test implementation
This commit is contained in:
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user