package fontface

// bundledNotoColorEmojiCmap is generated from the authenticated decoded
// Noto Color Emoji 2.051 font. Keeping its compact cmap ranges outside the
// compressed payload lets fallback resolution reject unsupported symbols
// without decoding and parsing the multi-megabyte font.
var bundledNotoColorEmojiCmap = [...]struct {
	first rune
	last  rune
}{
	{first: 0x0020, last: 0x0020},
	{first: 0x0023, last: 0x0023},
	{first: 0x002a, last: 0x002a},
	{first: 0x0030, last: 0x0039},
	{first: 0x00a9, last: 0x00a9},
	{first: 0x00ae, last: 0x00ae},
	{first: 0x200d, last: 0x200d},
	{first: 0x203c, last: 0x203c},
	{first: 0x2049, last: 0x2049},
	{first: 0x20e3, last: 0x20e3},
	{first: 0x2122, last: 0x2122},
	{first: 0x2139, last: 0x2139},
	{first: 0x2194, last: 0x2199},
	{first: 0x21a9, last: 0x21aa},
	{first: 0x231a, last: 0x231b},
	{first: 0x2328, last: 0x2328},
	{first: 0x23cf, last: 0x23cf},
	{first: 0x23e9, last: 0x23f3},
	{first: 0x23f8, last: 0x23fa},
	{first: 0x24c2, last: 0x24c2},
	{first: 0x25aa, last: 0x25ab},
	{first: 0x25b6, last: 0x25b6},
	{first: 0x25c0, last: 0x25c0},
	{first: 0x25fb, last: 0x25fe},
	{first: 0x2600, last: 0x2604},
	{first: 0x260e, last: 0x260e},
	{first: 0x2611, last: 0x2611},
	{first: 0x2614, last: 0x2615},
	{first: 0x2618, last: 0x2618},
	{first: 0x261d, last: 0x261d},
	{first: 0x2620, last: 0x2620},
	{first: 0x2622, last: 0x2623},
	{first: 0x2626, last: 0x2626},
	{first: 0x262a, last: 0x262a},
	{first: 0x262e, last: 0x262f},
	{first: 0x2638, last: 0x263a},
	{first: 0x2640, last: 0x2640},
	{first: 0x2642, last: 0x2642},
	{first: 0x2648, last: 0x2653},
	{first: 0x265f, last: 0x2660},
	{first: 0x2663, last: 0x2663},
	{first: 0x2665, last: 0x2666},
	{first: 0x2668, last: 0x2668},
	{first: 0x267b, last: 0x267b},
	{first: 0x267e, last: 0x267f},
	{first: 0x2692, last: 0x2697},
	{first: 0x2699, last: 0x2699},
	{first: 0x269b, last: 0x269c},
	{first: 0x26a0, last: 0x26a1},
	{first: 0x26a7, last: 0x26a7},
	{first: 0x26aa, last: 0x26ab},
	{first: 0x26b0, last: 0x26b1},
	{first: 0x26bd, last: 0x26be},
	{first: 0x26c4, last: 0x26c5},
	{first: 0x26c8, last: 0x26c8},
	{first: 0x26ce, last: 0x26cf},
	{first: 0x26d1, last: 0x26d1},
	{first: 0x26d3, last: 0x26d4},
	{first: 0x26e9, last: 0x26ea},
	{first: 0x26f0, last: 0x26f5},
	{first: 0x26f7, last: 0x26fa},
	{first: 0x26fd, last: 0x26fd},
	{first: 0x2702, last: 0x2702},
	{first: 0x2705, last: 0x2705},
	{first: 0x2708, last: 0x270d},
	{first: 0x270f, last: 0x270f},
	{first: 0x2712, last: 0x2712},
	{first: 0x2714, last: 0x2714},
	{first: 0x2716, last: 0x2716},
	{first: 0x271d, last: 0x271d},
	{first: 0x2721, last: 0x2721},
	{first: 0x2728, last: 0x2728},
	{first: 0x2733, last: 0x2734},
	{first: 0x2744, last: 0x2744},
	{first: 0x2747, last: 0x2747},
	{first: 0x274c, last: 0x274c},
	{first: 0x274e, last: 0x274e},
	{first: 0x2753, last: 0x2755},
	{first: 0x2757, last: 0x2757},
	{first: 0x2763, last: 0x2764},
	{first: 0x2795, last: 0x2797},
	{first: 0x27a1, last: 0x27a1},
	{first: 0x27b0, last: 0x27b0},
	{first: 0x27bf, last: 0x27bf},
	{first: 0x2934, last: 0x2935},
	{first: 0x2b05, last: 0x2b07},
	{first: 0x2b1b, last: 0x2b1c},
	{first: 0x2b50, last: 0x2b50},
	{first: 0x2b55, last: 0x2b55},
	{first: 0x3030, last: 0x3030},
	{first: 0x303d, last: 0x303d},
	{first: 0x3297, last: 0x3297},
	{first: 0x3299, last: 0x3299},
	{first: 0x1f004, last: 0x1f004},
	{first: 0x1f0cf, last: 0x1f0cf},
	{first: 0x1f170, last: 0x1f171},
	{first: 0x1f17e, last: 0x1f17f},
	{first: 0x1f18e, last: 0x1f18e},
	{first: 0x1f191, last: 0x1f19a},
	{first: 0x1f1e6, last: 0x1f1ff},
	{first: 0x1f201, last: 0x1f202},
	{first: 0x1f21a, last: 0x1f21a},
	{first: 0x1f22f, last: 0x1f22f},
	{first: 0x1f232, last: 0x1f23a},
	{first: 0x1f250, last: 0x1f251},
	{first: 0x1f300, last: 0x1f321},
	{first: 0x1f324, last: 0x1f393},
	{first: 0x1f396, last: 0x1f397},
	{first: 0x1f399, last: 0x1f39b},
	{first: 0x1f39e, last: 0x1f3f0},
	{first: 0x1f3f3, last: 0x1f3f5},
	{first: 0x1f3f7, last: 0x1f4fd},
	{first: 0x1f4ff, last: 0x1f53d},
	{first: 0x1f549, last: 0x1f54e},
	{first: 0x1f550, last: 0x1f567},
	{first: 0x1f56f, last: 0x1f570},
	{first: 0x1f573, last: 0x1f57a},
	{first: 0x1f587, last: 0x1f587},
	{first: 0x1f58a, last: 0x1f58d},
	{first: 0x1f590, last: 0x1f590},
	{first: 0x1f595, last: 0x1f596},
	{first: 0x1f5a4, last: 0x1f5a5},
	{first: 0x1f5a8, last: 0x1f5a8},
	{first: 0x1f5b1, last: 0x1f5b2},
	{first: 0x1f5bc, last: 0x1f5bc},
	{first: 0x1f5c2, last: 0x1f5c4},
	{first: 0x1f5d1, last: 0x1f5d3},
	{first: 0x1f5dc, last: 0x1f5de},
	{first: 0x1f5e1, last: 0x1f5e1},
	{first: 0x1f5e3, last: 0x1f5e3},
	{first: 0x1f5e8, last: 0x1f5e8},
	{first: 0x1f5ef, last: 0x1f5ef},
	{first: 0x1f5f3, last: 0x1f5f3},
	{first: 0x1f5fa, last: 0x1f64f},
	{first: 0x1f680, last: 0x1f6c5},
	{first: 0x1f6cb, last: 0x1f6d2},
	{first: 0x1f6d5, last: 0x1f6d8},
	{first: 0x1f6dc, last: 0x1f6e5},
	{first: 0x1f6e9, last: 0x1f6e9},
	{first: 0x1f6eb, last: 0x1f6ec},
	{first: 0x1f6f0, last: 0x1f6f0},
	{first: 0x1f6f3, last: 0x1f6fc},
	{first: 0x1f7e0, last: 0x1f7eb},
	{first: 0x1f7f0, last: 0x1f7f0},
	{first: 0x1f90c, last: 0x1f93a},
	{first: 0x1f93c, last: 0x1f945},
	{first: 0x1f947, last: 0x1f9ff},
	{first: 0x1fa70, last: 0x1fa7c},
	{first: 0x1fa80, last: 0x1fa8a},
	{first: 0x1fa8e, last: 0x1fac6},
	{first: 0x1fac8, last: 0x1fac8},
	{first: 0x1facd, last: 0x1fadc},
	{first: 0x1fadf, last: 0x1faea},
	{first: 0x1faef, last: 0x1faf8},
	{first: 0xe0030, last: 0xe0039},
	{first: 0xe0061, last: 0xe007a},
	{first: 0xe007f, last: 0xe007f},
	{first: 0xfe4e5, last: 0xfe4ee},
	{first: 0xfe82c, last: 0xfe82c},
	{first: 0xfe82e, last: 0xfe837},
}

// BundledNotoColorEmojiCoversRune reports whether the pinned font's ordinary
// cmap maps value to a non-zero glyph. Variation selectors are handled by the
// shaper after fallback selects the base character's face.
func BundledNotoColorEmojiCoversRune(value rune) bool {
	left, right := 0, len(bundledNotoColorEmojiCmap)
	for left < right {
		middle := int(uint(left+right) >> 1)
		span := bundledNotoColorEmojiCmap[middle]
		switch {
		case value < span.first:
			right = middle
		case value > span.last:
			left = middle + 1
		default:
			return true
		}
	}
	return false
}
