Skip to content

Commit 87c5d1d

Browse files
committed
[lib] Wrote documentation of variation methods
1 parent de8ff76 commit 87c5d1d

File tree

1 file changed

+24
-1
lines changed
  • tehreer-android/src/main/java/com/mta/tehreer/graphics

1 file changed

+24
-1
lines changed

tehreer-android/src/main/java/com/mta/tehreer/graphics/Typeface.java

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,18 @@ private void setupNames() {
223223
}
224224
}
225225

226-
public @NonNull Typeface getVariationInstance(@NonNull float[] coordinates) {
226+
/**
227+
* Returns a variation instance of this typeface with the specified design coordinates.
228+
*
229+
* @param coordinates The variation design coordinates.
230+
* @return A variation instance of this typeface with the specified design coordinates.
231+
*
232+
* @throws IllegalStateException if this typeface does not support OpenType font variations.
233+
* @throws NullPointerException if <code>coordinates</code> parameter is null.
234+
* @throws IllegalArgumentException if the number of specified design coordinates does not match
235+
* the number of variation axes.
236+
*/
237+
public @Nullable Typeface getVariationInstance(@NonNull float[] coordinates) {
227238
if (variationAxes == null) {
228239
throw new IllegalStateException("This typeface does not support variations.");
229240
}
@@ -233,6 +244,11 @@ private void setupNames() {
233244
return new Typeface(nGetVariationInstance(nativeTypeface, coordinates));
234245
}
235246

247+
/**
248+
* Returns the variation axes of this typeface if it supports OpenType font variations.
249+
*
250+
* @return The variation axes of this typeface if it supports OpenType font variations.
251+
*/
236252
public @Nullable List<VariationAxis> getVariationAxes() {
237253
if (variationAxes != null) {
238254
return Collections.unmodifiableList(variationAxes);
@@ -241,6 +257,13 @@ private void setupNames() {
241257
return null;
242258
}
243259

260+
/**
261+
* Returns the design variation coordinates of this typeface if it supports OpenType font
262+
* variations.
263+
*
264+
* @return The design variation coordinates of this typeface if it supports OpenType font
265+
* variations.
266+
*/
244267
public @Nullable float[] getVariationCoordinates() {
245268
if (variationAxes != null) {
246269
float[] coordinates = new float[variationAxes.size()];

0 commit comments

Comments
 (0)