()
| 107 | } |
| 108 | |
| 109 | public void testCombining() { |
| 110 | // u U+0075 LATIN SMALL LETTER U |
| 111 | // ̈ U+0308 COMBINING DIAERESIS |
| 112 | // a U+0061 LATIN SMALL LETTER A |
| 113 | // ̧ U+0327 COMBINING CEDILLA |
| 114 | try (TextLine line = TextLine.make("üa̧", inter36);) { |
| 115 | assertArrayEquals(new short[] {898 /* ü */, 503 /* a */, 1664 /* ̧ */}, line.getGlyphs()); |
| 116 | assertArrayEquals(new int[] {0, 2, 4}, TextLine._nGetBreakOffsets(line._ptr)); |
| 117 | assertArrayEquals(new float[] {0, 21, 41}, TextLine._nGetBreakPositions(line._ptr)); |
| 118 | |
| 119 | pushStack("getOffsetAtCoord"); |
| 120 | assertEquals(0, line.getOffsetAtCoord(0f)); |
| 121 | assertEquals(0, line.getOffsetAtCoord(10f)); |
| 122 | assertEquals(2, line.getOffsetAtCoord(12f)); |
| 123 | assertEquals(2, line.getOffsetAtCoord(21f)); |
| 124 | assertEquals(2, line.getOffsetAtCoord(30f)); |
| 125 | assertEquals(4, line.getOffsetAtCoord(32f)); |
| 126 | assertEquals(4, line.getOffsetAtCoord(41f)); |
| 127 | popStack(); |
| 128 | |
| 129 | pushStack("getCoordAtOffset"); |
| 130 | assertClose(0, line.getCoordAtOffset(0)); |
| 131 | assertClose(0, line.getCoordAtOffset(1)); |
| 132 | assertClose(21, line.getCoordAtOffset(2)); |
| 133 | assertClose(41, line.getCoordAtOffset(3)); |
| 134 | assertClose(41, line.getCoordAtOffset(4)); |
| 135 | popStack(); |
| 136 | } |
| 137 | |
| 138 | // a U+0061 LATIN SMALL LETTER A |
| 139 | // ̆ U+0306 COMBINING BREVE |
| 140 | try (TextLine line = TextLine.make("ă", jbMono36);) { |
| 141 | // JetBrains Mono supports “a” and “ă” but not “ ̆ ” separately |
| 142 | // assertArrayEquals(new short[] {226 /* ă */}, line.getGlyphs()); // FIXME #106 |
| 143 | } |
| 144 | |
| 145 | // a U+0061 LATIN SMALL LETTER A |
| 146 | // a U+0061 LATIN SMALL LETTER A |
| 147 | // ̧ U+0327 COMBINING CEDILLA |
| 148 | try (TextLine line = TextLine.make("aa̧", jbMono36);) { |
| 149 | // JetBrains Mono supports “a” but not “ ̧ ” |
| 150 | // Second grapheme cluster should fall back together, second “a” should resolve to different glyph |
| 151 | assertNotEquals(line.getGlyphs()[0], line.getGlyphs()[1]); |
| 152 | } |
| 153 | } |
| 154 | |
| 155 | public void testEmoji() { |
| 156 | try (TextLine misc = TextLine.make("☺", firaCode36); // U+263A, in Fira Code |
no test coverage detected