diff options
Diffstat (limited to 'macros/luatex/generic/luaotfload/fontloader-font-ttf.lua')
-rw-r--r-- | macros/luatex/generic/luaotfload/fontloader-font-ttf.lua | 52 |
1 files changed, 30 insertions, 22 deletions
diff --git a/macros/luatex/generic/luaotfload/fontloader-font-ttf.lua b/macros/luatex/generic/luaotfload/fontloader-font-ttf.lua index d1a3972b2c..1fee9fa88d 100644 --- a/macros/luatex/generic/luaotfload/fontloader-font-ttf.lua +++ b/macros/luatex/generic/luaotfload/fontloader-font-ttf.lua @@ -230,20 +230,7 @@ local function applyaxis(glyph,shape,deltas,dowidth) if dowidth then cnt = cnt - 4 end - if cnt == 1 then - local d = dpoints[1] - local x = xvalues[d] * factor - local y = yvalues[d] * factor - for i=1,nofpoints do - local p = points[i] - if x ~= 0 then - p[1] = p[1] + x - end - if y ~= 0 then - p[2] = p[2] + y - end - end - elseif cnt > 0 then + if cnt > 0 then -- Not the most efficient solution but we seldom do this. We -- actually need to avoid the extra points here but I'll deal -- with that when needed. @@ -263,20 +250,27 @@ local function applyaxis(glyph,shape,deltas,dowidth) end if found == last then lastindex = currentindex - break; + break elseif found > last then + -- \definefontfeature[book][default][axis={weight=800}] + -- \definefont[testfont][file:Commissioner-vf-test.ttf*book] + -- \testfont EΘÄΞ + while lastindex > 1 and dpoints[lastindex] > last do + lastindex = lastindex - 1 + end + -- break end end end - -- print("unicode: ",glyph.unicode or "?") - -- print("contour: ",first,contour,last) - -- print("index : ",firstindex,lastindex,cnt) - -- print("points : ",dpoints[firstindex],dpoints[lastindex]) + -- print("unicode: ",glyph.unicode or "?") + -- print("contour: ",first,contour,last) + -- print("index : ",firstindex,lastindex,cnt) + -- print("points : ",dpoints[firstindex],dpoints[lastindex]) local function find(i) local prv = lastindex for j=firstindex,lastindex do - local nxt = dpoints[j] + local nxt = dpoints[j] -- we could save this lookup when we return it if nxt == i then return false, j, false elseif nxt > i then @@ -343,6 +337,7 @@ local function applyaxis(glyph,shape,deltas,dowidth) end else fx = (p2x - p1x)/(p3x - p1x) +-- fx = round(fx) fx = (1 - fx) * x1 + fx * x3 end -- @@ -366,6 +361,7 @@ local function applyaxis(glyph,shape,deltas,dowidth) end else fy = (p2y - p1y)/(p3y - p1y) +-- fy = round(fy) fy = (1 - fy) * y1 + fy * y3 end -- -- maybe: @@ -769,6 +765,18 @@ local function contours2outlines_shaped(glyphs,shapes,keepcurve) end first = last + 1 end + -- See readers.hvar where we set the delta lsb as well as the adapted + -- width. At this point we do know the boundingbox's llx. The xmax is + -- not that relevant. It needs more testing! + -- + xmin = glyph.boundingbox[1] + -- + local dlsb = glyph.dlsb + if dlsb then + xmin = xmin + dlsb + glyph.dlsb = nil -- save space + end + -- glyph.boundingbox = { round(xmin), round(ymin), round(xmax), round(ymax) } end end @@ -980,8 +988,8 @@ local function readglyph(f,nofcontours) -- read deltas here, saves space local x = 0 for i=1,nofpoints do local flag = flags[i] - -- local short = band(flag,0x04) ~= 0 - -- local same = band(flag,0x20) ~= 0 + -- local short = band(flag,0x02) ~= 0 + -- local same = band(flag,0x10) ~= 0 if band(flag,0x02) ~= 0 then if band(flag,0x10) ~= 0 then x = x + readbyte(f) |