mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Merge remote branch 'hwhw/master'
* hwhw/master: (183 commits) show infomessage on document open use InfoMessage for empty TOC, jump history and highlights copy resources dir on customupdate add resource: info icon display document open error message added infomessage dialog implementation bugfix, removed old test constant Added widget abstraction framework added interface to get blitbuffers from JPEG/PNG files fix typo added reading of pan_margin settings fix full screen refresh command, close #99 add: sleep and usleep in util module fix: add back KEY_FW{LEFT,RIGHT} commands to NumInputBox reverted removal of last-doc shortcut, introduced framework restart kill our own child process. not quite finished. added line spacing setting for crereader remove page:getPageText debug dump to improve performance on device remove page:getPageText debug dump to improve performance on device display crash.log on error ... Conflicts: ft.c helppage.lua inputbox.lua rendertext.lua rendertext_example.lua unireader.lua
This commit is contained in:
@@ -13,6 +13,7 @@ function glyphCacheClaim(size)
|
||||
glyphcache[k].age = glyphcache[k].age - 1
|
||||
else
|
||||
glyphcache_current_memsize = glyphcache_current_memsize - glyphcache[k].size
|
||||
glyphcache[k].glyph.bb:free()
|
||||
glyphcache[k] = nil
|
||||
end
|
||||
end
|
||||
@@ -20,10 +21,10 @@ function glyphCacheClaim(size)
|
||||
glyphcache_current_memsize = glyphcache_current_memsize + size
|
||||
return true
|
||||
end
|
||||
function getGlyph(face, facehash, charcode)
|
||||
local hash = glyphCacheHash(facehash, charcode)
|
||||
function getGlyph(face, charcode)
|
||||
local hash = glyphCacheHash(face.hash, charcode)
|
||||
if glyphcache[hash] == nil then
|
||||
local glyph = face:renderGlyph(charcode)
|
||||
local glyph = face.ftface:renderGlyph(charcode)
|
||||
local size = glyph.bb:getWidth() * glyph.bb:getHeight() / 2 + 32
|
||||
glyphCacheClaim(size);
|
||||
glyphcache[hash] = {
|
||||
@@ -88,9 +89,9 @@ function renderUtf8Text(buffer, x, y, face, facehash, text, kerning, backgroundC
|
||||
for uchar in string.gfind(text, "([%z\1-\127\194-\244][\128-\191]*)") do
|
||||
if pen_x < buffer:getWidth() then
|
||||
local charcode = util.utf8charcode(uchar)
|
||||
local glyph = getGlyph(face, facehash, charcode)
|
||||
local glyph = getGlyph(face, charcode)
|
||||
if kerning and prevcharcode then
|
||||
local kern = face:getKerning(prevcharcode, charcode)
|
||||
local kern = face.ftface:getKerning(prevcharcode, charcode)
|
||||
pen_x = pen_x + kern
|
||||
--print("prev:"..string.char(prevcharcode).." curr:"..string.char(charcode).." pen_x:"..pen_x.." kern:"..kern)
|
||||
buffer:addblitFrom(glyph.bb, x + pen_x + glyph.l, y - glyph.t, 0, 0, glyph.bb:getWidth(), glyph.bb:getHeight())
|
||||
|
||||
Reference in New Issue
Block a user