* Given a codepoint, return the name of the script or script family * it is from, or null if it is not part of a known block
(codepoint)
| 676 | */ |
| 677 | |
| 678 | function scriptFromCodepoint(codepoint) { |
| 679 | for (var i = 0; i < scriptData.length; i++) { |
| 680 | var script = scriptData[i]; |
| 681 | |
| 682 | for (var _i = 0; _i < script.blocks.length; _i++) { |
| 683 | var block = script.blocks[_i]; |
| 684 | |
| 685 | if (codepoint >= block[0] && codepoint <= block[1]) { |
| 686 | return script.name; |
| 687 | } |
| 688 | } |
| 689 | } |
| 690 | |
| 691 | return null; |
| 692 | } |
| 693 | /** |
| 694 | * A flattened version of all the supported blocks in a single array. |
| 695 | * This is an optimization to make supportedCodepoint() fast. |