循环解析subset相关的glyf，包括复合字形相关的字形
355845
function travels(subsetMap) {
                            var newSubsetMap = {};
                            Object.keys(subsetMap).forEach(function (i) {
                                var index = +i;
                                parsedGlyfMap[index] = true;
                                // 当前的和下一个一样，或者最后一个无轮廓
                                if (loca[index] === loca[index + 1]) {
                                    glyphs[index] = {
                                        contours: []
                                    };
                                }
                                else {
                                    glyphs[index] = parse(reader, ttf, startOffset + loca[index]);
                                }

                                if (glyphs[index].compound) {
                                    glyphs[index].glyfs.forEach(function (g) {
                                        if (!parsedGlyfMap[g.glyphIndex]) {
                                            newSubsetMap[g.glyphIndex] = true;
                                        }
                                    });
                                }
                            });

                            if (!lang.isEmptyObject(newSubsetMap)) {
                                travels(newSubsetMap);
                            }
                        }
44626
function ttf2symbol(ttfBuffer, options) {

            options = options || {};

            // 读取ttf二进制流
            if (ttfBuffer instanceof ArrayBuffer) {
                var reader = new TTFReader();
                var ttfObject = reader.read(ttfBuffer);
                reader.dispose();

                return ttfobject2symbol(ttfObject, options);
            }
            // 读取ttfObject
            else if (ttfBuffer.version && ttfBuffer.glyf) {

                return ttfobject2symbol(ttfBuffer, options);
            }

            error.raise(10112);
        }
393067
def get_intersectionsbysubsets(df,cols_fracby2vals,cols_subset,col_ids):
    
    for col_fracby in cols_fracby2vals:
        val=cols_fracby2vals[col_fracby]
        ids=df.loc[(df[col_fracby]==val),col_ids].dropna().unique()
        for col_subset in cols_subset:
            for subset in dropna(df[col_subset].unique()):
                ids_subset=df.loc[(df[col_subset]==subset),col_ids].dropna().unique()
                df.loc[(df[col_subset]==subset),f'P {col_fracby} {col_subset}']=len(set(ids_subset).intersection(ids))/len(ids_subset)
    return df
542934
function resolveGlyf(font) {

            var codes = font.cmap;
            var glyf = font.CFF.glyf;
            var subsetMap = font.readOptions.subset ? font.subsetMap : null; // 当前ttf的子集列表
            // unicode
            Object.keys(codes).forEach(function (c) {
                var i = codes[c];
                if (subsetMap && !subsetMap[i]) {
                    return;
                }
                if (!glyf[i].unicode) {
                    glyf[i].unicode = [];
                }
                glyf[i].unicode.push(+c);
            });

            // leftSideBearing
            font.hmtx.forEach(function (item, i) {
                if (subsetMap && !subsetMap[i]) {
                    return;
                }
                glyf[i].advanceWidth = glyf[i].advanceWidth || item.advanceWidth || 0;
                glyf[i].leftSideBearing = item.leftSideBearing;
            });

            // 设置了subsetMap之后需要选取subset中的字形
            if (subsetMap) {
                var subGlyf = [];
                Object.keys(subsetMap).forEach(function (i) {
                    subGlyf.push(glyf[+i]);
                });
                glyf = subGlyf;
            }

            font.glyf = glyf;
        }
815651
def _assemble_gef(self, stmt):
        """"""
        gef = deepcopy(stmt.gef)
        gef.activity = ActivityCondition('gef', True)
        ras = deepcopy(stmt.ras)
        ras.activity = ActivityCondition('gtpbound', True)
        self._add_nodes_edges(gef, ras, pc.DIRECTLY_INCREASES, stmt.evidence)
1069640
private int dfs(int[][] merge, int index, int[] order, int i) {
        int n = merge.length + 1;

        if (merge[index][0] > merge.length) {
            i = dfs(merge, merge[index][0] - n, order, i);
        } else {
            order[i++] = merge[index][0];
        }

        if (merge[index][1] > merge.length) {
            i = dfs(merge, merge[index][1] - n, order, i);
        } else {
            order[i++] = merge[index][1];
        }

        return i;
    }
890454
function vecSub(a, b) {

  return [
  new Fraction(a[0]).sub(b[0]),
  new Fraction(a[1]).sub(b[1])
  ];
}
720037
function merge(ttf, imported, options) {
    options = options || {};

    var list = imported.glyf.filter(function (g, index) {
        // 简单轮廓
        return g.contours && g.contours.length
            // 非预定义字形
            && g.name !== '.notdef' && g.name !== '.null' && g.name !== 'nonmarkingreturn';
    });

    // 调整字形以适应边界
    if (options.adjustGlyf) {
        var ascent = ttf.hhea.ascent;
        var descent = ttf.hhea.descent;
        var ajdustToEmPadding = 16;
        adjustPos(list, 16, 16);
        adjustToEmBox(list, ascent, descent, ajdustToEmPadding);

        list.forEach(function (g) {
            ttf.glyf.push(g);
        });
    }
    // 根据unitsPerEm 进行缩放
    else if (options.scale) {

        var scale = 1;

        // 调整glyf对导入的轮廓进行缩放处理
        if (imported.head.unitsPerEm && imported.head.unitsPerEm !== ttf.head.unitsPerEm) {
            scale = ttf.head.unitsPerEm / imported.head.unitsPerEm;
        }

        list.forEach(function (g) {
            glyfAdjust(g, scale, scale);
            ttf.glyf.push(g);
        });
    }

    return list;
}
805465
function (m, u) {
        return [
            m[0][0] * u[0] + m[0][1] * u[1] + m[0][2] * u[2],
            m[1][0] * u[0] + m[1][1] * u[1] + m[1][2] * u[2],
            m[2][0] * u[0] + m[2][1] * u[1] + m[2][2] * u[2]
        ];
    }
581463
function ttfobject2symbol(ttf, options) {

            var xmlObject = {};
            var unitsPerEm = ttf.head.unitsPerEm;
            var descent = ttf.hhea.descent;
            // glyf 信息
            var symbolList = '';
            for (var i = 1, l = ttf.glyf.length; i < l; i++) {
                var glyf = ttf.glyf[i];
                // 筛选简单字形，并且有轮廓，有编码
                if (!glyf.compound && glyf.contours) {
                    var contours = pathsUtil.flip(glyf.contours);
                    var glyfObject = {
                        descent: descent,
                        unitsPerEm: unitsPerEm,
                        id: getSymbolId(glyf, i),
                        d: contours2svg(contours)
                    };
                    symbolList += string.format(SYMBOL_TPL, glyfObject);
                }
            }
            xmlObject.symbolList = symbolList;

            return string.format(XML_TPL, xmlObject);
        }
595164
function modf (float) {
  const i = Math.trunc(float)
  const f = Math.abs(float - i)
  return [i, f]
}
738921
function resolveGlyf(font) {

    var codes = font.cmap;
    var glyf = font.CFF.glyf;

    // unicode
    Object.keys(codes).forEach(function (c) {
        var i = codes[c];
        if (!glyf[i].unicode) {
            glyf[i].unicode = [];
        }
        glyf[i].unicode.push(+c);
    });

    // leftSideBearing
    font.hmtx.forEach(function (item, i) {
        glyf[i].advanceWidth = glyf[i].advanceWidth || item.advanceWidth || 0;
        glyf[i].leftSideBearing = item.leftSideBearing;
    });

    font.glyf = glyf;
}
1015833
def hyp_2F1(a, b, c, z):
    
    return mp.hyp2f1(a, b, c, z)
571382
private void bfs(int v, int[] cc, int id) {
        cc[v] = id;
        Queue<Integer> queue = new LinkedList<>();
        queue.offer(v);
        while (!queue.isEmpty()) {
            int t = queue.poll();
            for (Edge edge : graph[t]) {
                int i = edge.v2;
                if (!digraph && i == t) {
                    i = edge.v1;
                }

                if (cc[i] == -1) {
                    queue.offer(i);
                    cc[i] = id;
                }
            }
        }
    }
1022664
def available_parameters_subset(self, mx_params):
        
        from copy import copy
        from collections import OrderedDict
        subset_params = copy(mx_params)
        subset_params._params = OrderedDict([
            (k, v) for k, v in mx_params.items() if k in self.weight_names
        ])
        return subset_params
228633
function sizeof(ttf) {
            ttf.support.cmap = {};
            var glyfUnicodes = [];
            ttf.glyf.forEach(function (glyph, index) {

                var unicodes = glyph.unicode;

                if (typeof glyph.unicode === 'number') {
                    unicodes = [glyph.unicode];
                }

                if (unicodes && unicodes.length) {
                    unicodes.forEach(function (unicode) {
                        glyfUnicodes.push({
                            unicode: unicode,
                            id: unicode !== 0xFFFF ? index : 0
                        });
                    });
                }

            });

            glyfUnicodes = glyfUnicodes.sort(function (a, b) {
                return a.unicode - b.unicode;
            });

            ttf.support.cmap.unicodes = glyfUnicodes;

            var unicodes2Bytes = glyfUnicodes;

            ttf.support.cmap.format4Segments = getSegments(unicodes2Bytes, 0xFFFF);
            ttf.support.cmap.format4Size = 24
                + ttf.support.cmap.format4Segments.length * 8;

            ttf.support.cmap.format0Segments = getFormat0Segment(glyfUnicodes);
            ttf.support.cmap.format0Size = 262;

            // we need subtable 12 only if found unicodes with > 2 bytes.
            var hasGLyphsOver2Bytes = unicodes2Bytes.some(function (glyph) {
                return glyph.unicode > 0xFFFF;
            });

            if (hasGLyphsOver2Bytes) {
                ttf.support.cmap.hasGLyphsOver2Bytes = hasGLyphsOver2Bytes;

                var unicodes4Bytes = glyfUnicodes;

                ttf.support.cmap.format12Segments = getSegments(unicodes4Bytes);
                ttf.support.cmap.format12Size = 16
                    + ttf.support.cmap.format12Segments.length * 12;
            }

            var size = 4 + (hasGLyphsOver2Bytes ? 32 : 24) // cmap header
                + ttf.support.cmap.format0Size // format 0
                + ttf.support.cmap.format4Size // format 4
                + (hasGLyphsOver2Bytes ? ttf.support.cmap.format12Size : 0); // format 12

            return size;
        }
746468
def euler_tour_dfs(G, source=None):
    
    if source is None:
        # produce edges for all components
        nodes = G
    else:
        # produce edges for components with source
        nodes = [source]
    yielder = []
    visited = set()
    for start in nodes:
        if start in visited:
            continue
        visited.add(start)
        stack = [(start, iter(G[start]))]
        while stack:
            parent, children = stack[-1]
            try:
                child = next(children)
                if child not in visited:
                    # yielder += [[parent, child]]
                    yielder += [parent]
                    visited.add(child)
                    stack.append((child, iter(G[child])))
            except StopIteration:
                if stack:
                    last = stack[-1]
                    yielder += [last[0]]
                stack.pop()
    return yielder