Merge "Address comments from API council"
diff --git a/api/current.txt b/api/current.txt
index 90a0f65..1b09710 100755
--- a/api/current.txt
+++ b/api/current.txt
@@ -15334,7 +15334,7 @@
method public static java.lang.String toFontVariationSettings(android.graphics.fonts.FontVariationAxis[]);
}
- public class SystemFonts {
+ public final class SystemFonts {
method public static java.util.Set<android.graphics.fonts.Font> getAvailableFonts();
}
diff --git a/graphics/java/android/graphics/fonts/Font.java b/graphics/java/android/graphics/fonts/Font.java
index 1458c66..bd1ac25 100644
--- a/graphics/java/android/graphics/fonts/Font.java
+++ b/graphics/java/android/graphics/fonts/Font.java
@@ -422,9 +422,10 @@
nAddAxis(builderPtr, axis.getOpenTypeTagValue(), axis.getStyleValue());
}
}
- final long ptr = nBuild(builderPtr, mBuffer, mWeight, italic, mTtcIndex);
- final Font font = new Font(ptr, mBuffer, mFile, mWeight, italic, mTtcIndex, mAxes,
- mLocaleList);
+ final ByteBuffer readonlyBuffer = mBuffer.asReadOnlyBuffer();
+ final long ptr = nBuild(builderPtr, readonlyBuffer, mWeight, italic, mTtcIndex);
+ final Font font = new Font(ptr, readonlyBuffer, mFile, mWeight, italic, mTtcIndex,
+ mAxes, mLocaleList);
sFontRegistory.registerNativeAllocation(font, ptr);
return font;
}
@@ -477,7 +478,7 @@
}
/**
- * Retuns a font file buffer.
+ * Returns a font file buffer.
*
* @return a font buffer
*/
diff --git a/graphics/java/android/graphics/fonts/SystemFonts.java b/graphics/java/android/graphics/fonts/SystemFonts.java
index f4a2199..5e80749 100644
--- a/graphics/java/android/graphics/fonts/SystemFonts.java
+++ b/graphics/java/android/graphics/fonts/SystemFonts.java
@@ -45,7 +45,7 @@
/**
* Provides the system font configurations.
*/
-public class SystemFonts {
+public final class SystemFonts {
private static final String TAG = "SystemFonts";
private static final String DEFAULT_FAMILY = "sans-serif";
@@ -58,8 +58,7 @@
/**
* Returns all available font files in the system.
*
- * Note: The order of this font doesn't indicates anything.
- * @return an array of system fonts
+ * @return a set of system fonts
*/
public static @NonNull Set<Font> getAvailableFonts() {
HashSet<Font> set = new HashSet<>();