Skip to content

Commit 698257b

Browse files
committed
[lib] Added public method for caret edges in shaping result
1 parent 563f83f commit 698257b

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

tehreer-android/src/main/java/com/mta/tehreer/sfnt/ShapingResult.java

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2016-2018 Muhammad Tayyab Akram
2+
* Copyright (C) 2016-2019 Muhammad Tayyab Akram
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -138,6 +138,10 @@ public int getCharEnd() {
138138
return nGetCharEnd(nativeResult);
139139
}
140140

141+
private int getCharCount() {
142+
return nGetCharCount(nativeResult);
143+
}
144+
141145
/**
142146
* Returns the number of glyphs in this <code>ShapingResult</code> object.
143147
*
@@ -219,6 +223,19 @@ public int getGlyphCount() {
219223
return new UIntPtrBufferIntList(this, pointer, size);
220224
}
221225

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+
222239
@Override
223240
public void dispose() {
224241
nDispose(nativeResult);
@@ -251,4 +268,6 @@ public String toString() {
251268
private static native long nGetGlyphOffsetsPtr(long nativeResult);
252269
private static native long nGetGlyphAdvancesPtr(long nativeResult);
253270
private static native long nGetClusterMapPtr(long nativeResult);
271+
272+
private static native void nGetCaretEdges(long nativeResult, boolean[] caretStops, float[] caretEdges);
254273
}

0 commit comments

Comments
 (0)