当前位置: 首页>>代码示例>>Java>>正文


Java Paint.setFakeBoldText方法代码示例

本文整理汇总了Java中android.graphics.Paint.setFakeBoldText方法的典型用法代码示例。如果您正苦于以下问题:Java Paint.setFakeBoldText方法的具体用法?Java Paint.setFakeBoldText怎么用?Java Paint.setFakeBoldText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.graphics.Paint的用法示例。


在下文中一共展示了Paint.setFakeBoldText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: apply

import android.graphics.Paint; //导入方法依赖的package包/类
private void apply(Paint paint, Typeface tf) {
    int oldStyle;
    Typeface old = paint.getTypeface();
    if (old == null) {
        oldStyle = 0;
    } else {
        oldStyle = old.getStyle();
    }

    int fake = oldStyle & ~tf.getStyle();
    if ((fake & Typeface.BOLD) != 0) {
        paint.setFakeBoldText(true);
    }

    if ((fake & Typeface.ITALIC) != 0) {
        paint.setTextSkewX(-0.25f);
    }

    paint.getShader();

    paint.setTypeface(tf);
}
 
开发者ID:pan2yong22,项目名称:AndroidUtilCode-master,代码行数:23,代码来源:SpanUtils.java

示例2: init

import android.graphics.Paint; //导入方法依赖的package包/类
private void init() {
    ateKey = Helper.getATEKey(getContext());
    accentColor = Config.accentColor(getContext(), ateKey);
    textPaint = new Paint();
    textPaint.setColor(labelColor);
    textPaint.setStyle(Paint.Style.FILL);
    textPaint.setTextSize(labelSize);
    textPaint.setFakeBoldText(true);
    textPaint.setTextAlign(Paint.Align.CENTER);
    circlePaint = new Paint();
    circlePaint.setColor(progressSecondaryColor);
    circlePaint.setStrokeWidth(progressSecondaryStrokeWidth);
    circlePaint.setStyle(Paint.Style.FILL);
    circlePaint2 = new Paint();
    circlePaint2.setColor(accentColor);
    circlePaint2.setTextAlign(Paint.Align.CENTER);
    circlePaint2.setStrokeWidth(progressPrimaryStrokeWidth);
    circlePaint2.setStyle(Paint.Style.FILL);
    linePaint = new Paint();
    linePaint.setColor(indicatorColor);
    linePaint.setStrokeWidth(indicatorWidth);

    oval = new RectF();

}
 
开发者ID:RajneeshSingh007,项目名称:MusicX-music-player,代码行数:26,代码来源:EqView.java

示例3: applyCustomTypeFace

import android.graphics.Paint; //导入方法依赖的package包/类
private void applyCustomTypeFace(Paint paint, FontFamily tf) {

		paint.setAntiAlias(true);
		
		paint.setTypeface(tf.getDefaultTypeface());

		if (bold) {
			if (tf.isFakeBold()) {
				paint.setFakeBoldText(true);
			} else {
				paint.setTypeface(tf.getBoldTypeface());
			}
		}

		if (italic) {
			if (tf.isFakeItalic()) {
				paint.setTextSkewX(-0.25f);
			} else {
				paint.setTypeface(tf.getItalicTypeface());
			}
		}

		if (bold && italic && tf.getBoldItalicTypeface() != null) {
			paint.setTypeface(tf.getBoldItalicTypeface());
		}
	}
 
开发者ID:SysdataSpA,项目名称:SDHtmlTextView,代码行数:27,代码来源:FontFamilySpan.java

示例4: applyCustomTypeFace

import android.graphics.Paint; //导入方法依赖的package包/类
private static void applyCustomTypeFace(Paint paint, Typeface tf) {
    int oldStyle;
    Typeface old = paint.getTypeface();
    if (old == null) {
        oldStyle = 0;
    } else {
        oldStyle = old.getStyle();
    }

    int fake = oldStyle & ~tf.getStyle();
    if ((fake & Typeface.BOLD) != 0) {
        paint.setFakeBoldText(true);
    }

    if ((fake & Typeface.ITALIC) != 0) {
        paint.setTextSkewX(-0.25f);
    }

    paint.setTypeface(tf);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:21,代码来源:CustomTypefaceSpan.java

示例5: apply

import android.graphics.Paint; //导入方法依赖的package包/类
private void apply(final Paint paint)
{
    final Typeface oldTypeface = paint.getTypeface();
    final int oldStyle = oldTypeface != null ? oldTypeface.getStyle() : 0;
    final int fakeStyle = oldStyle & ~typeface.getStyle();

    if ((fakeStyle & Typeface.BOLD) != 0)
    {
        paint.setFakeBoldText(true);
    }

    if ((fakeStyle & Typeface.ITALIC) != 0)
    {
        paint.setTextSkewX(-0.25f);
    }

    paint.setTypeface(typeface);
}
 
开发者ID:cdjalel,项目名称:QuranKeyboard,代码行数:19,代码来源:CustomTypefaceSpan.java

示例6: initPaintTools

import android.graphics.Paint; //导入方法依赖的package包/类
private void initPaintTools() {

    satValPaint = new Paint();
    satValTrackerPaint = new Paint();
    hueAlphaTrackerPaint = new Paint();
    alphaPaint = new Paint();
    alphaTextPaint = new Paint();
    borderPaint = new Paint();

    satValTrackerPaint.setStyle(Style.STROKE);
    satValTrackerPaint.setStrokeWidth(DrawingUtils.dpToPx(getContext(), 2));
    satValTrackerPaint.setAntiAlias(true);

    hueAlphaTrackerPaint.setColor(sliderTrackerColor);
    hueAlphaTrackerPaint.setStyle(Style.STROKE);
    hueAlphaTrackerPaint.setStrokeWidth(DrawingUtils.dpToPx(getContext(), 2));
    hueAlphaTrackerPaint.setAntiAlias(true);

    alphaTextPaint.setColor(0xff1c1c1c);
    alphaTextPaint.setTextSize(DrawingUtils.dpToPx(getContext(), 14));
    alphaTextPaint.setAntiAlias(true);
    alphaTextPaint.setTextAlign(Align.CENTER);
    alphaTextPaint.setFakeBoldText(true);

  }
 
开发者ID:Blankeer,项目名称:MDWechat,代码行数:26,代码来源:ColorPickerView.java

示例7: updatePaintTypeface

import android.graphics.Paint; //导入方法依赖的package包/类
/**
 * Updates typeface setting for the given <var>paint</var> to the specified one.
 *
 * @param paint    The paint to be updated.
 * @param typeface The desired typeface. May be {@code null} to resolve instance of typeface
 *                 from the specified style.
 * @param style    The desired text style used to resolve proper instance of typeface.
 * @return {@code True} if paint's typeface setting has changed, {@code false} otherwise.
 * @see Paint#setTypeface(Typeface)
 */
public static boolean updatePaintTypeface(@NonNull Paint paint, @Nullable Typeface typeface, @TextStyle int style) {
	if (style > 0) {
		if (typeface == null) {
			typeface = Typeface.defaultFromStyle(style);
		} else {
			typeface = Typeface.create(typeface, style);
		}
		final int typefaceStyle = typeface != null ? typeface.getStyle() : 0;
		final int need = style & ~typefaceStyle;
		paint.setFakeBoldText((need & Typeface.BOLD) != 0);
		paint.setTextSkewX((need & Typeface.ITALIC) != 0 ? -0.25f : 0);
		paint.setTypeface(typeface);
	} else {
		paint.setFakeBoldText(false);
		paint.setTextSkewX(0);
		paint.setTypeface(typeface);
	}
	return true;
}
 
开发者ID:universum-studios,项目名称:android_ui,代码行数:30,代码来源:TextAppearance.java

示例8: drawNumbers

import android.graphics.Paint; //导入方法依赖的package包/类
/**
 * Function to draw number in the bitmap
 *
 * @param number Number to draw
 * @return the new bitmap after draw
 */
public Bitmap drawNumbers(String number) {
    float fontAndPadding = getResources().getDimension(R.dimen.draw_number);
    Paint paint = new Paint();
    paint.setTextSize(fontAndPadding);
    paint.setColor(Color.WHITE);
    paint.setAntiAlias(true);
    paint.setFilterBitmap(true);
    paint.setDither(true);
    paint.setFakeBoldText(true);
    Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.ic_repeat);
    Bitmap mutableBitmap = bitmap.copy(Bitmap.Config.ARGB_8888, true);
    Canvas canvas = new Canvas(mutableBitmap);
    canvas.drawText(number, bitmap.getWidth() - fontAndPadding, fontAndPadding, paint);
    return mutableBitmap;
}
 
开发者ID:fekracomputers,项目名称:QuranAndroid,代码行数:22,代码来源:QuranPageReadActivity.java

示例9: applyTypeface

import android.graphics.Paint; //导入方法依赖的package包/类
public static void applyTypeface(Context context, Paint v) {
    if (v.getTypeface() == null) {
        v.setTypeface(getNormal(context));
        return;
    }
    switch (v.getTypeface().getStyle()) {
        case Typeface.BOLD:
            v.setTypeface(getNormal(context));
            v.setFakeBoldText(true);
            break;
        default:
            v.setTypeface(getNormal(context));
            break;
        case Typeface.ITALIC:
            v.setTypeface(getNormal(context));
            v.setTextSkewX(-0.25f);
            break;
        case Typeface.BOLD_ITALIC:
            v.setTypeface(getNormal(context));
            v.setFakeBoldText(true);
            v.setTextSkewX(-0.25f);
            break;
    }
}
 
开发者ID:iPanelkegy,项目名称:MobileMedia,代码行数:25,代码来源:Icon.java

示例10: addWaterMark

import android.graphics.Paint; //导入方法依赖的package包/类
/**
 * @param src Original image
 * @param context needed to fetch resources
 * @return new bitmap resource containing the watermark
 */
public static Bitmap addWaterMark(Bitmap src, Context context) {

    int height = src.getHeight() + UiUtils.dpToPx(32 + 8);
    int width = src.getWidth();

    Bitmap result = Bitmap.createBitmap(width, height, src.getConfig());
    Canvas canvas = new Canvas(result);
    canvas.drawBitmap(src, 0, 0, null);

    int darkGrey = context.getResources().getColor(R.color.grey_900);
    Bitmap appIcon = BitmapFactory.decodeResource(context.getResources(), R.mipmap.ic_launcher);
    appIcon = Bitmap.createScaledBitmap(appIcon, UiUtils.dpToPx(32), UiUtils.dpToPx(32), false);

    Paint backgroundPaint = new Paint();
    backgroundPaint.setColor(Color.WHITE);
    backgroundPaint.setAntiAlias(true);
    backgroundPaint.setShadowLayer(6, 2, 2, darkGrey);

    Paint textPaint = new Paint();
    textPaint.setColor(darkGrey);
    textPaint.setAntiAlias(true);
    textPaint.setTextSize(UiUtils.dpToPx(16));
    textPaint.setFakeBoldText(true);

    Paint appIconPaint = new Paint();
    appIconPaint.setAntiAlias(true);
    appIconPaint.setFilterBitmap(true);
    appIconPaint.setDither(true);

    float srcHeight = src.getHeight();
    int _4dp = UiUtils.dpToPx(4);

    String watermarkText = context.getString(R.string.app_name);
    Paint.FontMetrics fontMetrics = textPaint.getFontMetrics();
    float watermarkTextY = srcHeight + (height - srcHeight) / 2f + (fontMetrics.descent - fontMetrics.ascent) / 2f;

    canvas.drawRect(0, srcHeight, width, height, backgroundPaint);
    canvas.drawText(watermarkText, (_4dp) * 2 + appIcon.getWidth(), watermarkTextY, textPaint);
    canvas.drawBitmap(appIcon, _4dp, _4dp + srcHeight, appIconPaint);

    appIcon.recycle();
    src.recycle();
    return result;
}
 
开发者ID:Protino,项目名称:CodeWatch,代码行数:50,代码来源:UiUtils.java

示例11: flagDate

import android.graphics.Paint; //导入方法依赖的package包/类
private void flagDate(Canvas canvas, String flag, @ColorInt int clr, int y, int x) {
    Paint flagP = new Paint();
    flagP.setAntiAlias(true);
    float flagTS = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 12, getResources().getDisplayMetrics());
    flagP.setTextSize(flagTS);
    flagP.setStyle(Style.FILL);
    flagP.setColor(clr);
    flagP.setTextAlign(Align.CENTER);
    flagP.setFakeBoldText(false);
    canvas.drawText(flag, x, y - DAY_ROW_MARGIN - DAY_NUM_HALF_WIDTH, flagP);
}
 
开发者ID:sieml,项目名称:CalendarCheck,代码行数:12,代码来源:SimpleMonthView.java

示例12: initSetting

import android.graphics.Paint; //导入方法依赖的package包/类
/******************
 * common
 ******************/

private void initSetting(Context context, AttributeSet attrs) {
    mOnTouchingLetterChangeListener = getDummyListener();
    mNavigators = new ArrayList<>(0);
    mFocusIndex = -1;

    TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.IndexBar);
    float textSize = typedArray.getDimension(R.styleable.IndexBar_letterSize, 8);
    int letterColor = typedArray.getColor(R.styleable.IndexBar_letterColor,
            ContextCompat.getColor(getContext(), android.R.color.white));
    mLetterSpacingExtra = typedArray.getFloat(R.styleable.IndexBar_letterSpacingExtra, 1.4f);
    int focusLetterColor = typedArray.getColor(R.styleable.IndexBar_focusLetterColor,
            ContextCompat.getColor(getContext(), android.R.color.white));
    typedArray.recycle();

    mPaint = new Paint();
    mPaint.setTypeface(Typeface.DEFAULT_BOLD);
    mPaint.setAntiAlias(true);
    mPaint.setColor(letterColor);
    mPaint.setTextSize(textSize);

    mFocusPaint = new Paint();
    mFocusPaint.setTypeface(Typeface.DEFAULT_BOLD);
    mFocusPaint.setAntiAlias(true);
    mFocusPaint.setFakeBoldText(true);
    mFocusPaint.setTextSize(textSize);
    mFocusPaint.setColor(focusLetterColor);

}
 
开发者ID:hgDendi,项目名称:ContactsList,代码行数:33,代码来源:IndexBar.java

示例13: TextDrawable

import android.graphics.Paint; //导入方法依赖的package包/类
private TextDrawable(Builder builder) {
    super(builder.shape);

    // shape properties
    shape = builder.shape;
    height = builder.height;
    width = builder.width;
    radius = builder.radius;

    // text and color
    text = builder.toUpperCase ? builder.text.toUpperCase() : builder.text;
    color = builder.color;

    // text paint settings
    fontSize = builder.fontSize;
    textPaint = new Paint();
    textPaint.setColor(builder.textColor);
    textPaint.setAntiAlias(true);
    textPaint.setFakeBoldText(builder.isBold);
    textPaint.setStyle(Paint.Style.FILL);
    textPaint.setTypeface(builder.font);
    textPaint.setTextAlign(Paint.Align.CENTER);
    textPaint.setStrokeWidth(builder.borderThickness);

    // border paint settings
    borderThickness = builder.borderThickness;
    borderPaint = new Paint();
    borderPaint.setColor(getDarkerShade(color));
    borderPaint.setStyle(Paint.Style.STROKE);
    borderPaint.setStrokeWidth(borderThickness);

    // drawable paint color
    Paint paint = getPaint();
    paint.setColor(color);

}
 
开发者ID:RajneeshSingh007,项目名称:MusicX-music-player,代码行数:37,代码来源:TextDrawable.java

示例14: apply

import android.graphics.Paint; //导入方法依赖的package包/类
private void apply(final Paint paint) {
    final Typeface oldTypeface = paint.getTypeface();
    final int oldStyle = oldTypeface != null ? oldTypeface.getStyle() : 0;
    final int fakeStyle = oldStyle & ~typeface.getStyle();

    if ((fakeStyle & Typeface.BOLD) != 0) {
        paint.setFakeBoldText(true);
    }

    if ((fakeStyle & Typeface.ITALIC) != 0) {
        paint.setTextSkewX(-0.25f);
    }

    paint.setTypeface(typeface);
}
 
开发者ID:takahirom,项目名称:DownloadableCalligraphy,代码行数:16,代码来源:CalligraphyTypefaceSpan.java

示例15: initPaintTools

import android.graphics.Paint; //导入方法依赖的package包/类
private void initPaintTools(){

		mSatValPaint = new Paint();
		mSatValTrackerPaint = new Paint();
		mHuePaint = new Paint();
		mHueTrackerPaint = new Paint();
		mAlphaPaint = new Paint();
		mAlphaTextPaint = new Paint();
		mBorderPaint = new Paint();


		mSatValTrackerPaint.setStyle(Style.STROKE);
		mSatValTrackerPaint.setStrokeWidth(2f * mDensity);
		mSatValTrackerPaint.setAntiAlias(true);

		mHueTrackerPaint.setColor(mSliderTrackerColor);
		mHueTrackerPaint.setStyle(Style.STROKE);
		mHueTrackerPaint.setStrokeWidth(2f * mDensity);
		mHueTrackerPaint.setAntiAlias(true);

		mAlphaTextPaint.setColor(0xff1c1c1c);
		mAlphaTextPaint.setTextSize(14f * mDensity);
		mAlphaTextPaint.setAntiAlias(true);
		mAlphaTextPaint.setTextAlign(Align.CENTER);
		mAlphaTextPaint.setFakeBoldText(true);


	}
 
开发者ID:Bregnet,项目名称:TextView_CustomEdit_CustomColor,代码行数:29,代码来源:ColorPickerView.java


注:本文中的android.graphics.Paint.setFakeBoldText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。