File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
tehreer-android/src/main/java/com/mta/tehreer/internal/sfnt/tables/fvar Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change 1717package com .mta .tehreer .internal .sfnt .tables .fvar ;
1818
1919import androidx .annotation .NonNull ;
20+ import androidx .annotation .Nullable ;
2021
22+ import com .mta .tehreer .graphics .Typeface ;
23+ import com .mta .tehreer .internal .sfnt .DataTable ;
2124import com .mta .tehreer .internal .sfnt .SfntTable ;
25+ import com .mta .tehreer .sfnt .SfntTag ;
26+
27+ import static com .mta .tehreer .internal .util .Preconditions .checkNotNull ;
2228
2329public final class FontVariationsTable {
2430 private static final int MAJOR_VERSION = 0 ;
@@ -31,7 +37,18 @@ public final class FontVariationsTable {
3137
3238 private final @ NonNull SfntTable data ;
3339
34- public FontVariationsTable (@ NonNull SfntTable data ) {
40+ public static @ Nullable FontVariationsTable from (@ NonNull Typeface typeface ) {
41+ checkNotNull (typeface );
42+
43+ final byte [] fvarData = typeface .getTableData (SfntTag .make ("fvar" ));
44+ if (fvarData != null ) {
45+ return new FontVariationsTable (new DataTable (fvarData ));
46+ }
47+
48+ return null ;
49+ }
50+
51+ FontVariationsTable (@ NonNull SfntTable data ) {
3552 this .data = data ;
3653 }
3754
You can’t perform that action at this time.
0 commit comments