|
|
|
@ -70,7 +70,7 @@ function sizeUtf8Text(x, width, face, text, kerning)
|
|
|
|
|
if pen_x < (width - x) then
|
|
|
|
|
local charcode = util.utf8charcode(uchar)
|
|
|
|
|
local glyph = getGlyph(face, charcode)
|
|
|
|
|
if kerning and prevcharcode then
|
|
|
|
|
if kerning and (prevcharcode ~= 0) then
|
|
|
|
|
pen_x = pen_x + face.ftface:getKerning(prevcharcode, charcode)
|
|
|
|
|
end
|
|
|
|
|
pen_x = pen_x + glyph.ax
|
|
|
|
@ -99,12 +99,10 @@ function renderUtf8Text(buffer, x, y, face, text, kerning)
|
|
|
|
|
if pen_x < buffer_width then
|
|
|
|
|
local charcode = util.utf8charcode(uchar)
|
|
|
|
|
local glyph = getGlyph(face, charcode)
|
|
|
|
|
if kerning and prevcharcode then
|
|
|
|
|
if kerning and (prevcharcode ~= 0) then
|
|
|
|
|
pen_x = pen_x + face.ftface:getKerning(prevcharcode, charcode)
|
|
|
|
|
buffer:addblitFrom(glyph.bb, x + pen_x + glyph.l, y - glyph.t, 0, 0, glyph.bb:getWidth(), glyph.bb:getHeight())
|
|
|
|
|
else
|
|
|
|
|
buffer:blitFrom(glyph.bb, x + pen_x + glyph.l, y - glyph.t, 0, 0, glyph.bb:getWidth(), glyph.bb:getHeight())
|
|
|
|
|
end
|
|
|
|
|
buffer:addblitFrom(glyph.bb, x + pen_x + glyph.l, y - glyph.t, 0, 0, glyph.bb:getWidth(), glyph.bb:getHeight())
|
|
|
|
|
pen_x = pen_x + glyph.ax
|
|
|
|
|
prevcharcode = charcode
|
|
|
|
|
end -- if pen_x < buffer_width
|
|
|
|
@ -125,12 +123,10 @@ function renderUtf8TextWidth(buffer, x, y, face, text, kerning, w)
|
|
|
|
|
if pen_x < w then
|
|
|
|
|
local charcode = util.utf8charcode(uchar)
|
|
|
|
|
local glyph = getGlyph(face, charcode)
|
|
|
|
|
if kerning and prevcharcode then
|
|
|
|
|
if kerning and (prevcharcode ~= 0) then
|
|
|
|
|
pen_x = pen_x + face.ftface:getKerning(prevcharcode, charcode)
|
|
|
|
|
buffer:addblitFrom(glyph.bb, x + pen_x + glyph.l, y - glyph.t, 0, 0, glyph.bb:getWidth(), glyph.bb:getHeight())
|
|
|
|
|
else
|
|
|
|
|
buffer:blitFrom(glyph.bb, x + pen_x + glyph.l, y - glyph.t, 0, 0, glyph.bb:getWidth(), glyph.bb:getHeight())
|
|
|
|
|
end
|
|
|
|
|
buffer:addblitFrom(glyph.bb, x + pen_x + glyph.l, y - glyph.t, 0, 0, glyph.bb:getWidth(), glyph.bb:getHeight())
|
|
|
|
|
pen_x = pen_x + glyph.ax
|
|
|
|
|
prevcharcode = charcode
|
|
|
|
|
else
|
|
|
|
|