本文整理汇总了Java中android.graphics.Typeface.DEFAULT属性的典型用法代码示例。如果您正苦于以下问题:Java Typeface.DEFAULT属性的具体用法?Java Typeface.DEFAULT怎么用?Java Typeface.DEFAULT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.graphics.Typeface
的用法示例。
在下文中一共展示了Typeface.DEFAULT属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFont
public static Typeface getFont(Context context, String fullName) {
if (storage == null) {
storage = new HashMap<String, Typeface>();
}
synchronized (storage) {
Typeface font = storage.get(fullName);
if (font == null) {
font = Typeface.createFromAsset(context.getAssets(), fullName);
if (font != null) {
storage.put(fullName, font);
return font;
}
} else {
return font;
}
}
return Typeface.DEFAULT;
}
示例2: setFontStyle
/**
/* This code was taken from the method setFontStyle of the class ReactTextShadowNode
/* TODO: Factor into a common place they can both use
*/
@ReactProp(name = ViewProps.FONT_STYLE)
public void setFontStyle(ReactEditText view, @Nullable String fontStyleString) {
int fontStyle = UNSET;
if ("italic".equals(fontStyleString)) {
fontStyle = Typeface.ITALIC;
} else if ("normal".equals(fontStyleString)) {
fontStyle = Typeface.NORMAL;
}
Typeface currentTypeface = view.getTypeface();
if (currentTypeface == null) {
currentTypeface = Typeface.DEFAULT;
}
if (fontStyle != currentTypeface.getStyle()) {
view.setTypeface(currentTypeface, fontStyle);
}
}
示例3: getChatFont
public Typeface getChatFont() {
if (mCachedFont != null)
return mCachedFont;
String font = mPreferences.getString(PREF_CHAT_FONT, "default");
if (ListWithCustomSetting.isPrefCustomValue(font)) {
File file = ListWithCustomSetting.getCustomFile(mContext, PREF_CHAT_FONT, font);
try {
mCachedFont = Typeface.createFromFile(file);
return mCachedFont;
} catch (Exception ignored) {
}
}
if (font.equals("monospace"))
return Typeface.MONOSPACE;
else if (font.equals("serif"))
return Typeface.SERIF;
else
return Typeface.DEFAULT;
}
示例4: getTypeface
public Typeface getTypeface(Context context, String name) {
Typeface typeface = mFontCache.get(name);
if(typeface == null) {
try {
typeface = Typeface.createFromAsset(context.getAssets(), FONT_FOLDER_NAME + name);
}
catch (Exception e) {
Log.e(TAG, "Error load font", e);
typeface = Typeface.DEFAULT;
}
mFontCache.put(name, typeface);
}
return typeface;
}
示例5: TitleTextView
public TitleTextView(Context c, AttributeSet attrs, int defStyle) {
super(c, attrs, defStyle);
if (!isInEditMode()) {
int type = new FontPreferences(getContext()).getFontTypeTitle().getTypeface();
Typeface typeface;
if (type >= 0) {
typeface = RobotoTypefaceManager.obtainTypeface(c, type);
} else {
typeface = Typeface.DEFAULT;
}
setTypeface(typeface);
}
}
示例6: getCharGeometryCacheKey
private static int getCharGeometryCacheKey(final char referenceChar, final Paint paint) {
final int labelSize = (int)paint.getTextSize();
final Typeface face = paint.getTypeface();
final int codePointOffset = referenceChar << 15;
if (face == Typeface.DEFAULT) {
return codePointOffset + labelSize;
} else if (face == Typeface.DEFAULT_BOLD) {
return codePointOffset + labelSize + 0x1000;
} else if (face == Typeface.MONOSPACE) {
return codePointOffset + labelSize + 0x2000;
} else {
return codePointOffset + labelSize;
}
}
示例7: VectorStyleSimplePoint
VectorStyleSimplePoint(int inPriority, String layerName) {
super();
// Default Colors
float r = 0.0F / 255.0F; // Default
float g = 0.0F / 255.0F; // to
float b = 0.0F / 255.0F; // black
float a = 1.0F;
float fontSize = 20.0F;
Typeface typeface = Typeface.DEFAULT;
// Overridden colors from properties file
String layerRgb = LDLNProperties.getProperty(context, "map.colors.point." + layerName);
if (layerRgb != null && layerRgb.replaceAll("[^,]","").length() + 1 == 5) {
String[] layerRgbBits = layerRgb.split(",");
r = Float.valueOf(layerRgbBits[0]) / 255.0F;
g = Float.valueOf(layerRgbBits[1]) / 255.0F;
b = Float.valueOf(layerRgbBits[2]) / 255.0F;
a = Float.valueOf(layerRgbBits[3]);
fontSize = Float.valueOf(layerRgbBits[4]);
} else {
Log.e("Map Style", layerName + " POINT style not defined!");
}
this.drawPriority = inPriority;
this.labelInfo = new LabelInfo();
this.labelInfo.setFontSize(fontSize);
this.labelInfo.setTextColor(r, g, b, a);
this.labelInfo.setTypeface(typeface);
this.labelInfo.setDrawPriority(this.drawPriority);
this.labelInfo.setEnable(false);
// Could also set background color and outline color of labelInfo
}
示例8: loadFont
private static Typeface loadFont(AssetManager am, String path) {
try {
Typeface tf = Typeface.createFromAsset(am, path);
return tf;
} catch (Exception e) {
e.printStackTrace();
return Typeface.DEFAULT;
}
}
示例9: initConfig
private void initConfig()
{
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
showBottomBarFlag = sharedPreferences.getBoolean(getString(R.string.prefShowButtonsKey), true);
fontSize = sharedPreferences.getFloat(getString(R.string.prefFontSizeKey), fontSize);
filepath = Environment.getExternalStorageDirectory().getAbsolutePath();
String typefaceString = sharedPreferences.getString(getString(R.string.prefTypefaceKey), "DEFAULT");
if(typefaceString.equalsIgnoreCase("DEFAULT"))
{
mTypeface = Typeface.DEFAULT;
}
else if(typefaceString.equalsIgnoreCase("MONOSPACE"))
{
mTypeface = Typeface.MONOSPACE;
}
else if(typefaceString.equalsIgnoreCase("SANS_SERIF"))
{
mTypeface = Typeface.SANS_SERIF;
}
else if(typefaceString.equalsIgnoreCase("SERIF"))
{
mTypeface = Typeface.SERIF;
}
boolean noTitleBarFlag = sharedPreferences.getBoolean(getString(R.string.prefNoTitleBarKey), false);
if(noTitleBarFlag) requestWindowFeature(Window.FEATURE_NO_TITLE);
}
示例10: createPaint
private Paint createPaint(final boolean bold, final int fontSize) {
final Typeface typeface = (bold) ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT;
return new Paint()
{{
setARGB(255, 255, 255, 255);
setTextSize(fontSize);
setTypeface(typeface);
setAntiAlias(true);
}};
}
示例11: getTypeface
public Typeface getTypeface() {
return builder.font == null ? Typeface.DEFAULT : Typeface.createFromAsset(getContext().getAssets(), "fonts/" + builder.font);
}
示例12: getTypeFace
public Typeface getTypeFace() {
return font == null ? Typeface.DEFAULT : Typeface.createFromAsset(getContext().getAssets(), "fonts/" + this.font);
}
示例13: getTextTypeface
private static Typeface getTextTypeface(@Nullable final CharSequence text) {
return hasStyleSpan(text, BOLD_SPAN) ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT;
}
示例14: getCollapsedTypeface
public Typeface getCollapsedTypeface() {
return mCollapsedTypeface != null ? mCollapsedTypeface : Typeface.DEFAULT;
}
示例15: getCollapsedTypeface
Typeface getCollapsedTypeface() {
return mCollapsedTypeface != null ? mCollapsedTypeface : Typeface.DEFAULT;
}