huangcm
2025-08-25 f350412dc55c15118d0a7925d1071877498e5e24
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
local canvas
 
function sk_scrape_startcanvas(c, fileName)
    canvas = c
end
 
function sk_scrape_endcanvas(c, fileName)
    canvas = nil
end
 
local glyph_calls = 0
local unichar_calls = 0
 
local isTextVerbs = {
    drawPosText = true,
    drawPosTextH = true,
    drawText = true,
    drawTextOnPath = true,
}
 
function sk_scrape_accumulate(t)
    if isTextVerbs[t.verb] then
        if t.glyphs then
            glyph_calls = glyph_calls + 1
        else
            unichar_calls = unichar_calls + 1
        end
    end
end
 
function sk_scrape_summarize()
    io.write("glyph calls = ", glyph_calls,
             ", unichar calls = ", unichar_calls, "\n");
end