~reviczky/context/mirror

« back to all changes in this revision

Viewing changes to tex/context/base/mkxl/typo-krn.lmt

  • Committer: Context Git Mirror Bot
  • Author(s): Hans Hagen
  • Date: 2022-05-02 15:02:40 UTC
  • Revision ID: git-v1:d2e1112ef8921f361ac7cf1b49e30923cce6d5f0
2022-05-02 15:50:00

Show diffs side-by-side

added added

removed removed

Lines of Context:
220
220
 
221
221
local function inject_begin(boundary,prev,keeptogether,krn,ok) -- prev is a glyph
222
222
    local char, id = isglyph(boundary)
223
 
    if id == kern_code then
224
 
        if getsubtype(boundary) == fontkern_code then
225
 
            local inject = true
226
 
            if keeptogether then
227
 
                local next = getnext(boundary)
228
 
                if not next or (getid(next) == glyph_code and keeptogether(prev,next)) then
229
 
                    inject = false
230
 
                end
231
 
            end
232
 
            if inject then
233
 
                -- not yet ok, as injected kerns can be overlays (from node-inj.lua)
234
 
                setkern(boundary,getkern(boundary) + quaddata[getfont(prev)]*krn,userkern_code)
235
 
                return boundary, true
236
 
            end
237
 
        end
238
 
    elseif char then
 
223
    if char then
239
224
        if keeptogether and keeptogether(boundary,prev) then
240
225
            -- keep 'm
241
226
        else
249
234
                return kern, true
250
235
            end
251
236
        end
 
237
    elseif id == kern_code then
 
238
        if getsubtype(boundary) == fontkern_code then
 
239
            local inject = true
 
240
            if keeptogether then
 
241
                local next = getnext(boundary)
 
242
                if not next or (getid(next) == glyph_code and keeptogether(prev,next)) then
 
243
                    inject = false
 
244
                end
 
245
            end
 
246
            if inject then
 
247
                -- not yet ok, as injected kerns can be overlays (from node-inj.lua)
 
248
                setkern(boundary,getkern(boundary) + quaddata[getfont(prev)]*krn,userkern_code)
 
249
                return boundary, true
 
250
            end
 
251
        end
252
252
    end
253
253
    return boundary, ok
254
254
end
256
256
local function inject_end(boundary,next,keeptogether,krn,ok)
257
257
    local tail = find_node_tail(boundary)
258
258
    local char, id = isglyph(tail)
259
 
    if id == kern_code then
260
 
        if getsubtype(tail) == fontkern_code then
261
 
            local inject = true
262
 
            if keeptogether then
263
 
                local prev = getprev(tail)
264
 
                if getid(prev) == glyph_code and keeptogether(prev,two) then
265
 
                    inject = false
266
 
                end
267
 
            end
268
 
            if inject then
269
 
                -- not yet ok, as injected kerns can be overlays (from node-inj.lua)
270
 
                setkern(tail,getkern(tail) + quaddata[getfont(next)]*krn,userkern_code)
271
 
                return boundary, true
272
 
            end
273
 
        end
274
 
    elseif char then
 
259
    if char then
275
260
        if keeptogether and keeptogether(tail,two) then
276
261
            -- keep 'm
277
262
        else
285
270
                return boundary, true
286
271
            end
287
272
        end
 
273
    elseif id == kern_code then
 
274
        if getsubtype(tail) == fontkern_code then
 
275
            local inject = true
 
276
            if keeptogether then
 
277
                local prev = getprev(tail)
 
278
                if getid(prev) == glyph_code and keeptogether(prev,two) then
 
279
                    inject = false
 
280
                end
 
281
            end
 
282
            if inject then
 
283
                -- not yet ok, as injected kerns can be overlays (from node-inj.lua)
 
284
                setkern(tail,getkern(tail) + quaddata[getfont(next)]*krn,userkern_code)
 
285
                return boundary, true
 
286
            end
 
287
        end
288
288
    end
289
289
    return boundary, ok
290
290
end