Home
last modified time | relevance | path

Searched refs:Typeface (Results 1 – 25 of 163) sorted by relevance

1234567

/frameworks/base/libs/hwui/tests/unit/
DTypefaceTests.cpp69 std::unique_ptr<Typeface> regular(Typeface::createFromFamilies( in TEST()
71 EXPECT_EQ(regular.get(), Typeface::resolveDefault(regular.get())); in TEST()
74 const Typeface* old = Typeface::resolveDefault(nullptr); in TEST()
77 Typeface::setDefault(regular.get()); in TEST()
78 EXPECT_EQ(regular.get(), Typeface::resolveDefault(nullptr)); in TEST()
80 Typeface::setDefault(old); // Restore to the original. in TEST()
84 std::unique_ptr<Typeface> bold(Typeface::createWithDifferentBaseWeight(nullptr, 700)); in TEST()
87 EXPECT_EQ(Typeface::kNormal, bold->fAPIStyle); in TEST()
89 std::unique_ptr<Typeface> light(Typeface::createWithDifferentBaseWeight(nullptr, 300)); in TEST()
92 EXPECT_EQ(Typeface::kNormal, light->fAPIStyle); in TEST()
[all …]
/frameworks/base/libs/hwui/hwui/
DTypeface.cpp37 static Typeface::Style computeAPIStyle(int weight, bool italic) { in computeAPIStyle()
40 return italic ? Typeface::kBoldItalic : Typeface::kBold; in computeAPIStyle()
42 return italic ? Typeface::kItalic : Typeface::kNormal; in computeAPIStyle()
52 static minikin::FontStyle computeRelativeStyle(int baseWeight, Typeface::Style relativeStyle) { in computeRelativeStyle()
54 if ((relativeStyle & Typeface::kBold) != 0) { in computeRelativeStyle()
57 bool italic = (relativeStyle & Typeface::kItalic) != 0; in computeRelativeStyle()
61 const Typeface* gDefaultTypeface = NULL;
63 const Typeface* Typeface::resolveDefault(const Typeface* src) { in resolveDefault()
68 Typeface* Typeface::createRelative(Typeface* src, Typeface::Style style) { in createRelative()
69 const Typeface* resolvedFace = Typeface::resolveDefault(src); in createRelative()
[all …]
DTypeface.h33 struct ANDROID_API Typeface { struct
44 static const Typeface* resolveDefault(const Typeface* src); argument
70 static Typeface* createWithDifferentBaseWeight(Typeface* src, int baseweight);
71 static Typeface* createRelative(Typeface* src, Style desiredStyle);
72 static Typeface* createAbsolute(Typeface* base, int weight, bool italic);
74 static Typeface* createFromTypefaceWithVariation(
75 Typeface* src, const std::vector<minikin::FontVariation>& variations);
77 static Typeface* createFromFamilies(
80 static void setDefault(const Typeface* face);
DMinikinUtils.cpp31 const Typeface* typeface) { in prepareMinikinPaint()
32 const Typeface* resolvedFace = Typeface::resolveDefault(typeface); in prepareMinikinPaint()
51 const Typeface* typeface, const uint16_t* buf, size_t start, in doLayout()
71 const Typeface* typeface, const uint16_t* buf, size_t start, in measureText()
85 bool MinikinUtils::hasVariationSelector(const Typeface* typeface, uint32_t codepoint, uint32_t vs) { in hasVariationSelector()
86 const Typeface* resolvedFace = Typeface::resolveDefault(typeface); in hasVariationSelector()
/frameworks/base/core/tests/coretests/src/android/graphics/
DTypefaceTest.java26 import android.graphics.Typeface;
44 private final Typeface[] mFaces = new Typeface[] {
45 Typeface.create(Typeface.SANS_SERIF, 0),
46 Typeface.create(Typeface.SANS_SERIF, 1),
47 Typeface.create(Typeface.SERIF, 0),
48 Typeface.create(Typeface.SERIF, 1),
49 Typeface.create(Typeface.SERIF, 2),
50 Typeface.create(Typeface.SERIF, 3),
51 Typeface.create(Typeface.MONOSPACE, 0)
57 assertTrue("basic", Typeface.DEFAULT != null); in testBasic()
[all …]
DTypefaceSystemFallbackTest.java77 paint.setTypeface(new Typeface.Builder(am, "fonts/a3em.ttf").build()); in paint.setTypeface()
81 paint.setTypeface(new Typeface.Builder(am, "fonts/all2em.ttf").build()); in paint.setTypeface()
109 ArrayMap<String, Typeface> fontMap, ArrayMap<String, FontFamily[]> fallbackMap) { in buildSystemFallback()
115 Typeface.buildSystemFallback(TEST_FONTS_XML, TEST_FONT_DIR, fontMap, fallbackMap); in buildSystemFallback()
120 final ArrayMap<String, Typeface> fontMap = new ArrayMap<>(); in testBuildSystemFallback()
123 Typeface.buildSystemFallback(SYSTEM_FONTS_XML, SYSTEM_FONT_DIR, fontMap, fallbackMap); in testBuildSystemFallback()
144 final ArrayMap<String, Typeface> fontMap = new ArrayMap<>(); in testBuildSystemFallback_NonExistentFontShouldBeIgnored()
172 final ArrayMap<String, Typeface> fontMap = new ArrayMap<>(); in testBuildSystemFallback_NamedFamily()
179 final Typeface sansSerifTypeface = fontMap.get("sans-serif"); in testBuildSystemFallback_NamedFamily()
186 final Typeface testTypeface = fontMap.get("test"); in testBuildSystemFallback_NamedFamily()
[all …]
/frameworks/support/compat/src/androidTest/java/androidx/core/graphics/
DTypefaceCompatTest.java33 import android.graphics.Typeface;
104 private static int getSelectedFontResourceId(Typeface typeface) { in getSelectedFontResourceId()
147 Typeface mTypeface;
154 public void onFontRetrieved(@NonNull Typeface typeface) { in onFontRetrieved()
176 R.font.styletest_async_providerfont, Typeface.NORMAL, callback, in testCreateFromResourcesFamilyXml_resourceFont_asyncloading()
191 R.font.styletest_async_providerfont, Typeface.ITALIC, callback2, in testCreateFromResourcesFamilyXml_resourceFont_asyncloading()
205 R.font.styletest_async_providerfont, Typeface.BOLD, callback3, in testCreateFromResourcesFamilyXml_resourceFont_asyncloading()
219 R.font.styletest_async_providerfont, Typeface.BOLD_ITALIC, callback4, in testCreateFromResourcesFamilyXml_resourceFont_asyncloading()
229 Typeface typeface = TypefaceCompat.createFromResourcesFamilyXml(mContext, in testProviderFont_xmlRequest()
231 R.font.samplexmldownloadedfontblocking, Typeface.NORMAL, null, in testProviderFont_xmlRequest()
[all …]
/frameworks/base/core/jni/android/graphics/
DTypeface.cpp31 static inline Typeface* toTypeface(jlong ptr) { in toTypeface()
32 return reinterpret_cast<Typeface*>(ptr); in toTypeface()
40 Typeface* family = toTypeface(familyHandle); in Typeface_createFromTypeface()
41 Typeface* face = Typeface::createRelative(family, (Typeface::Style)style); in Typeface_createFromTypeface()
45 face = Typeface::createRelative(family, (Typeface::Style)(style ^ Typeface::kItalic)); in Typeface_createFromTypeface()
48 face = Typeface::createRelative(family, (Typeface::Style)i); in Typeface_createFromTypeface()
55 return toJLong(Typeface::createAbsolute(toTypeface(nativeInstance), weight, italic)); in Typeface_createFromTypefaceWithExactStyle()
70 return toJLong(Typeface::createFromTypefaceWithVariation(toTypeface(familyHandle), variations)); in Typeface_createFromTypefaceWithVariation()
74 return toJLong(Typeface::createWithDifferentBaseWeight(toTypeface(familyHandle), weight)); in Typeface_createWeightAlias()
105 return toJLong(Typeface::createFromFamilies(std::move(familyVec), weight, italic)); in Typeface_createFromArray()
[all …]
/frameworks/base/graphics/java/android/graphics/
DTypeface.java74 public class Typeface { class
79 Typeface.class.getClassLoader(), nativeGetReleaseFunc(), 64);
82 public static final Typeface DEFAULT;
88 public static final Typeface DEFAULT_BOLD;
90 public static final Typeface SANS_SERIF;
92 public static final Typeface SERIF;
94 public static final Typeface MONOSPACE;
96 static Typeface[] sDefaults;
102 private static final LongSparseArray<SparseArray<Typeface>> sStyledTypefaceCache =
110 private static final LongSparseArray<SparseArray<Typeface>> sWeightTypefaceCache =
[all …]
DLeakyTypefaceStorage.java39 private static final ArrayList<Typeface> sStorage = new ArrayList<>();
41 private static final ArrayMap<Typeface, Integer> sTypefaceMap = new ArrayMap<>();
52 public static void writeTypefaceToParcel(@Nullable Typeface typeface, @NonNull Parcel parcel) { in writeTypefaceToParcel()
76 public static @Nullable Typeface readTypefaceFromParcel(@NonNull Parcel parcel) { in readTypefaceFromParcel()
/frameworks/base/apct-tests/perftests/core/src/android/graphics/perftests/
DTypefaceCreatePerfTest.java21 import android.graphics.Typeface;
52 Typeface face = Typeface.create(Typeface.SANS_SERIF, Typeface.NORMAL); in testCreate_fromFamily()
61 Typeface face = Typeface.create("monospace", Typeface.NORMAL); in testCreate_fromFamilyName()
72 Typeface face = Typeface.createFromAsset(am, TEST_FONT_NAME); in testCreate_fromAsset()
101 Typeface face = Typeface.createFromFile(outFile); in testCreate_fromFile()
/frameworks/base/core/java/android/text/style/
DTypefaceSpan.java23 import android.graphics.Typeface;
59 private final Typeface mTypeface;
78 public TypefaceSpan(@NonNull Typeface typeface) { in TypefaceSpan()
90 private TypefaceSpan(@Nullable String family, @Nullable Typeface typeface) { in TypefaceSpan()
141 public Typeface getTypeface() { in getTypeface()
165 Typeface old = paint.getTypeface(); in applyFontFamily()
167 style = Typeface.NORMAL; in applyFontFamily()
171 final Typeface styledTypeface = Typeface.create(family, style); in applyFontFamily()
174 if ((fake & Typeface.BOLD) != 0) { in applyFontFamily()
178 if ((fake & Typeface.ITALIC) != 0) { in applyFontFamily()
DStyleSpan.java21 import android.graphics.Typeface;
116 Typeface old = paint.getTypeface(); in apply()
125 Typeface tf; in apply()
127 tf = Typeface.defaultFromStyle(want); in apply()
129 tf = Typeface.create(old, want); in apply()
134 if ((fake & Typeface.BOLD) != 0) { in apply()
138 if ((fake & Typeface.ITALIC) != 0) { in apply()
DTextAppearanceSpan.java23 import android.graphics.Typeface;
39 private final Typeface mTypeface;
243 final Typeface styledTypeface; in updateMeasureState()
248 styledTypeface = Typeface.create(mTypeface, style); in updateMeasureState()
250 Typeface tf = ds.getTypeface(); in updateMeasureState()
259 styledTypeface = Typeface.create(mFamilyName, style); in updateMeasureState()
261 styledTypeface = Typeface.defaultFromStyle(style); in updateMeasureState()
263 styledTypeface = Typeface.create(tf, style); in updateMeasureState()
272 if ((fake & Typeface.BOLD) != 0) { in updateMeasureState()
276 if ((fake & Typeface.ITALIC) != 0) { in updateMeasureState()
/frameworks/layoutlib/bridge/src/android/graphics/
DTypeface_Delegate.java109 Typeface.sDefaults = null; in resetDefaults()
141 int style = weight >= 600 ? (italic ? Typeface.BOLD_ITALIC : Typeface.BOLD) : in nativeCreateFromTypefaceWithExactStyle()
142 (italic ? Typeface.ITALIC : Typeface.NORMAL); in nativeCreateFromTypefaceWithExactStyle()
186 if (weight == Typeface.RESOLVE_BY_FONT_TABLE) { in nativeCreateFromArray()
189 if (italic == Typeface.RESOLVE_BY_FONT_TABLE) { in nativeCreateFromArray()
192 int style = weight >= 600 ? (italic == 1 ? Typeface.BOLD_ITALIC : Typeface.BOLD) : in nativeCreateFromArray()
193 (italic == 1 ? Typeface.ITALIC : Typeface.NORMAL); in nativeCreateFromArray()
229 ArrayMap<String, Typeface> fontMap, ArrayMap<String, FontFamily[]> fallbackMap) { in buildSystemFallback()
230 Typeface.buildSystemFallback_Original(getFontLocation() + "/fonts.xml", fontDir, fontMap, in buildSystemFallback()
251 public static Typeface createFromDisk(@NonNull BridgeContext context, @NonNull String path, in createFromDisk()
[all …]
/frameworks/support/v7/appcompat/src/androidTest/java/androidx/appcompat/widget/
DAppCompatTextViewTest.java34 import android.graphics.Typeface;
201 assertEquals(Typeface.SANS_SERIF, textView.getTypeface()); in testFontResources_setInStringFamilyName()
206 assertEquals(Typeface.SANS_SERIF, textView.getTypeface()); in testFontResources_setInStringFamilyName()
213 Typeface expected = ResourcesCompat.getFont(mActivity, R.font.samplefont); in testFontResources_setInXmlFamilyName()
221 Typeface expected = ResourcesCompat.getFont(mActivity, R.font.samplexmlfont); in testFontResourcesXml_setInXmlFamilyName()
231 assertNotEquals(Typeface.DEFAULT, textView.getTypeface()); in testFontResourcesXml_setInXmlFamilyNameWithTextStyle()
239 assertNotEquals(Typeface.DEFAULT, textView.getTypeface()); in testFontResourcesXml_setInXmlFamilyNameWithTextStyle2()
245 Typeface expected = ResourcesCompat.getFont(mActivity, R.font.samplefont); in testFontResources_setInXmlStyle()
253 Typeface expected = ResourcesCompat.getFont(mActivity, R.font.samplexmlfont); in testFontResourcesXml_setInXmlStyle()
261 Typeface expected = ResourcesCompat.getFont(mActivity, R.font.samplefont); in testFontResources_setInXmlTextAppearance()
[all …]
/frameworks/support/compat/src/main/java/androidx/core/graphics/
DTypefaceCompatBaseImpl.java23 import android.graphics.Typeface;
52 final int targetWeight = (style & Typeface.BOLD) == 0 ? 400 : 700; in findBestFont()
53 final boolean isTargetItalic = (style & Typeface.ITALIC) != 0; in findBestFont()
85 protected Typeface createFromInputStream(Context context, InputStream is) {
94 return Typeface.createFromFile(tmpFile.getPath());
105 public Typeface createFromFontInfo(Context context,
138 public Typeface createFromFontFamilyFilesResourceEntry(Context context,
152 public Typeface createFromResourcesFontFile(
162 return Typeface.createFromFile(tmpFile.getPath());
DTypefaceCompat.java23 import android.graphics.Typeface;
67 private static final LruCache<String, Typeface> sTypefaceCache = new LruCache<>(16);
77 public static Typeface findFromCache(@NonNull Resources resources, int id, int style) { in findFromCache()
99 public static Typeface createFromResourcesFamilyXml( in createFromResourcesFamilyXml()
104 Typeface typeface; in createFromResourcesFamilyXml()
138 public static Typeface createFromResourcesFontFile( in createFromResourcesFontFile()
141 Typeface typeface = sTypefaceCompatImpl.createFromResourcesFontFile( in createFromResourcesFontFile()
154 public static Typeface createFromFontInfo(@NonNull Context context, in createFromFontInfo()
DTypefaceCompatApi24Impl.java23 import android.graphics.Typeface;
75 Typeface.class.getMethod(CREATE_FROM_FAMILIES_WITH_DEFAULT_METHOD,
120 private static Typeface createFromFamiliesWithDefault(Object family) { in createFromFamiliesWithDefault()
124 return (Typeface) sCreateFromFamiliesWithDefault.invoke( in createFromFamiliesWithDefault()
132 public Typeface createFromFontInfo(Context context, in createFromFontInfo()
149 final Typeface typeface = createFromFamiliesWithDefault(family); in createFromFontInfo()
150 return Typeface.create(typeface, style); in createFromFontInfo()
154 public Typeface createFromFontFamilyFilesResourceEntry(Context context, in createFromFontFamilyFilesResourceEntry()
DTypefaceCompatApi28Impl.java21 import android.graphics.Typeface;
49 protected Typeface createFromFamiliesWithDefault(Object family) { in createFromFamiliesWithDefault()
53 return (Typeface) mCreateFromFamiliesWithDefault.invoke(null /* static method */, in createFromFamiliesWithDefault()
64 Method m = Typeface.class.getDeclaredMethod(CREATE_FROM_FAMILIES_WITH_DEFAULT_METHOD, in obtainCreateFromFamiliesWithDefaultMethod()
/frameworks/support/emoji/core/src/main/java/androidx/emoji/text/
DMetadataRepo.java21 import android.graphics.Typeface;
66 private final Typeface mTypeface;
87 private MetadataRepo(@NonNull final Typeface typeface, in MetadataRepo()
103 public static MetadataRepo create(@NonNull final Typeface typeface, in create()
115 public static MetadataRepo create(@NonNull final Typeface typeface, in create()
129 final Typeface typeface = Typeface.createFromAsset(assetManager, assetPath); in create()
152 Typeface getTypeface() { in getTypeface()
/frameworks/base/packages/SystemUI/src/com/android/systemui/volume/
DSegmentedButtons.java20 import android.graphics.Typeface;
34 private static final Typeface REGULAR = Typeface.create("sans-serif", Typeface.NORMAL);
35 private static final Typeface MEDIUM = Typeface.create("sans-serif-medium", Typeface.NORMAL);
/frameworks/support/compat/src/androidTest/java/androidx/core/content/res/
DResourcesCompatTest.java28 import android.graphics.Typeface;
306 Typeface font = ResourcesCompat.getFont(mContext, R.font.samplefont); in testGetFont_fontFile_sync()
309 assertNotSame(Typeface.DEFAULT, font); in testGetFont_fontFile_sync()
314 Typeface mTypeface;
321 public void onFontRetrieved(@NonNull Typeface typeface) { in onFontRetrieved()
343 assertNotSame(Typeface.DEFAULT, callback.mTypeface); in testGetFont_fontFile_async()
348 Typeface font = ResourcesCompat.getFont(mContext, R.font.samplexmlfont); in testGetFont_xmlFile_sync()
351 assertNotSame(Typeface.DEFAULT, font); in testGetFont_xmlFile_sync()
364 assertNotSame(Typeface.DEFAULT, callback.mTypeface); in testGetFont_xmlFile_async()
369 Typeface font = ResourcesCompat.getFont(mContext, R.font.samplexmldownloadedfont); in testGetFont_xmlProviderFile_sync()
[all …]
/frameworks/support/compat/src/main/java/androidx/core/content/res/
DResourcesCompat.java29 import android.graphics.Typeface;
202 public static Typeface getFont(@NonNull Context context, @FontRes int id) in getFont()
207 return loadFont(context, id, new TypedValue(), Typeface.NORMAL, null /* callback */, in getFont()
221 public abstract void onFontRetrieved(@NonNull Typeface typeface); in onFontRetrieved()
243 public final void callbackSuccessAsync(final Typeface typeface, @Nullable Handler handler) { in callbackSuccessAsync()
301 loadFont(context, id, new TypedValue(), Typeface.NORMAL, fontCallback, handler, in getFont()
311 public static Typeface getFont(@NonNull Context context, @FontRes int id, TypedValue value, in getFont()
333 private static Typeface loadFont(@NonNull Context context, int id, TypedValue value, in loadFont()
338 Typeface typeface = loadFont(context, resources, value, id, style, fontCallback, handler, in loadFont()
352 private static Typeface loadFont( in loadFont()
[all …]
/frameworks/base/apct-tests/perftests/core/src/android/text/
DTextPerfUtils.java29 import android.graphics.Typeface;
55 Typeface.NORMAL, Typeface.BOLD, Typeface.ITALIC, Typeface.BOLD_ITALIC

1234567