File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
tehreer-android/src/main/java/com/mta/tehreer/graphics Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 3939import java .util .Collections ;
4040import java .util .List ;
4141
42+ import static com .mta .tehreer .internal .util .Preconditions .checkArgument ;
4243import static com .mta .tehreer .internal .util .Preconditions .checkNotNull ;
4344
4445/**
@@ -222,8 +223,14 @@ private void setupNames() {
222223 }
223224 }
224225
225- public Typeface getVariationInstance (float [] coordinates ) {
226- return new Typeface (nDeriveVariation (nativeTypeface , coordinates ));
226+ public @ NonNull Typeface getVariationInstance (@ NonNull float [] coordinates ) {
227+ if (variationAxes == null ) {
228+ throw new IllegalStateException ("This typeface does not support variations." );
229+ }
230+ checkNotNull (coordinates , "coordinates" );
231+ checkArgument (coordinates .length == variationAxes .size (), "The number of coordinates does not match with variation axes." );
232+
233+ return new Typeface (nGetVariationInstance (nativeTypeface , coordinates ));
227234 }
228235
229236 public @ Nullable List <VariationAxis > getVariationAxes () {
You can’t perform that action at this time.
0 commit comments