當前位置: 首頁>>代碼示例>>Java>>正文


Java Typeface.DEFAULT屬性代碼示例

本文整理匯總了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;
}
 
開發者ID:WorldBank-Transport,項目名稱:RoadLab-Pro,代碼行數:18,代碼來源:FontsStorage.java

示例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);
  }
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:21,代碼來源:ReactTextInputManager.java

示例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;
}
 
開發者ID:MCMrARM,項目名稱:revolution-irc,代碼行數:19,代碼來源:SettingsHelper.java

示例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;
}
 
開發者ID:AndroidLiba,項目名稱:asset-font-views,代碼行數:16,代碼來源:AssetFontHelper.java

示例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);
    }
}
 
開發者ID:ccrama,項目名稱:Slide-RSS,代碼行數:13,代碼來源:TitleTextView.java

示例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;
    }
}
 
開發者ID:rkkr,項目名稱:simple-keyboard,代碼行數:14,代碼來源:TypefaceUtils.java

示例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
}
 
開發者ID:LDLN,項目名稱:Responder-Android,代碼行數:33,代碼來源:LDLNVectorSimpleStyleGenerator.java

示例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;
    }
}
 
開發者ID:iPanelkegy,項目名稱:MobileMedia,代碼行數:9,代碼來源:Icon.java

示例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);


}
 
開發者ID:monolifed,項目名稱:mininoteview,代碼行數:33,代碼來源:TextEdit.java

示例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);
    }};
}
 
開發者ID:PacktPublishing,項目名稱:Android-Wear-Projects,代碼行數:11,代碼來源:PacktWatchFace.java

示例11: getTypeface

public Typeface getTypeface() {
    return builder.font == null ? Typeface.DEFAULT : Typeface.createFromAsset(getContext().getAssets(), "fonts/" + builder.font);
}
 
開發者ID:Mindjet,項目名稱:LiteReader,代碼行數:3,代碼來源:DrawerHeaderViewModel.java

示例12: getTypeFace

public Typeface getTypeFace() {
    return font == null ? Typeface.DEFAULT : Typeface.createFromAsset(getContext().getAssets(), "fonts/" + this.font);
}
 
開發者ID:Mindjet,項目名稱:LiteReader,代碼行數:3,代碼來源:HeaderItemViewModel.java

示例13: getTextTypeface

private static Typeface getTextTypeface(@Nullable final CharSequence text) {
    return hasStyleSpan(text, BOLD_SPAN) ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT;
}
 
開發者ID:sergeychilingaryan,項目名稱:AOSP-Kayboard-7.1.2,代碼行數:3,代碼來源:SuggestionStripLayoutHelper.java

示例14: getCollapsedTypeface

public Typeface getCollapsedTypeface() {
    return mCollapsedTypeface != null ? mCollapsedTypeface : Typeface.DEFAULT;
}
 
開發者ID:QMUI,項目名稱:QMUI_Android,代碼行數:3,代碼來源:QMUICollapsingTextHelper.java

示例15: getCollapsedTypeface

Typeface getCollapsedTypeface() {
  return mCollapsedTypeface != null ? mCollapsedTypeface : Typeface.DEFAULT;
}
 
開發者ID:commonsguy,項目名稱:cwac-crossport,代碼行數:3,代碼來源:CollapsingTextHelper.java


注:本文中的android.graphics.Typeface.DEFAULT屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。