当前位置: 首页>>代码示例>>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;未经允许,请勿转载。