|
1 | 1 | /* |
2 | | - * Copyright (C) 2016-2018 Muhammad Tayyab Akram |
| 2 | + * Copyright (C) 2016-2019 Muhammad Tayyab Akram |
3 | 3 | * |
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | * you may not use this file except in compliance with the License. |
@@ -138,6 +138,10 @@ public int getCharEnd() { |
138 | 138 | return nGetCharEnd(nativeResult); |
139 | 139 | } |
140 | 140 |
|
| 141 | + private int getCharCount() { |
| 142 | + return nGetCharCount(nativeResult); |
| 143 | + } |
| 144 | + |
141 | 145 | /** |
142 | 146 | * Returns the number of glyphs in this <code>ShapingResult</code> object. |
143 | 147 | * |
@@ -219,6 +223,19 @@ public int getGlyphCount() { |
219 | 223 | return new UIntPtrBufferIntList(this, pointer, size); |
220 | 224 | } |
221 | 225 |
|
| 226 | + public @NonNull FloatList getCaretEdges() { |
| 227 | + return getCaretEdges(null); |
| 228 | + } |
| 229 | + |
| 230 | + public @NonNull FloatList getCaretEdges(boolean[] caretStops) { |
| 231 | + int charCount = getCharCount(); |
| 232 | + float[] caretEdges = new float[charCount + 1]; |
| 233 | + |
| 234 | + nGetCaretEdges(nativeResult, caretStops, caretEdges); |
| 235 | + |
| 236 | + return FloatList.of(caretEdges); |
| 237 | + } |
| 238 | + |
222 | 239 | @Override |
223 | 240 | public void dispose() { |
224 | 241 | nDispose(nativeResult); |
@@ -251,4 +268,6 @@ public String toString() { |
251 | 268 | private static native long nGetGlyphOffsetsPtr(long nativeResult); |
252 | 269 | private static native long nGetGlyphAdvancesPtr(long nativeResult); |
253 | 270 | private static native long nGetClusterMapPtr(long nativeResult); |
| 271 | + |
| 272 | + private static native void nGetCaretEdges(long nativeResult, boolean[] caretStops, float[] caretEdges); |
254 | 273 | } |
0 commit comments