def _load_variant_data():
    """Parse StandardizedVariants.txt and initialize all non-emoji variant
    data.  The data is a mapping from codepoint to a list of tuples of:
    - variant selector
    - compatibility character (-1 if there is none)
    - shaping context (bitmask, 1 2 4 8 for isolate initial medial final)
    The compatibility character is for cjk mappings that map to 'the same'
    glyph as another CJK character."""

    global _variant_data, _variant_data_cps
    if _variant_data:
        return

    compatibility_re = re.compile(r"\s*CJK COMPATIBILITY IDEOGRAPH-([0-9A-Fa-f]+)")
    variants = collections.defaultdict(list)
    with open_unicode_data_file("StandardizedVariants.txt") as f:
        for line in f:
            x = line.find("#")
            if x >= 0:
                line = line[:x]
            line = line.strip()
            if not line:
                continue

            tokens = line.split(";")
            cp, var = tokens[0].split(" ")
            cp = int(cp, 16)
            varval = int(var, 16)
            if varval in [0xFE0E, 0xFE0F]:
                continue  # ignore emoji variants
            m = compatibility_re.match(tokens[1].strip())
            compat = int(m.group(1), 16) if m else -1
            context = 0
            if tokens[2]:
                ctx = tokens[2]
                if ctx.find("isolate") != -1:
                    context += 1
                if ctx.find("initial") != -1:
                    context += 2
                if ctx.find("medial") != -1:
                    context += 4
                if ctx.find("final") != -1:
                    context += 8
            variants[cp].append((varval, compat, context))

    _variant_data_cps = frozenset(variants.keys())
    _variant_data = variants