public void setTypeface(Typeface typeface) { this.PAINT.setTypeface(typeface); }
/** * sets the typeface for the center-text paint * * @param t */ public void setCenterTextTypeface(Typeface t) { ((PieChartRenderer) mRenderer).getPaintCenterText().setTypeface(t); }
@Override public void updateDrawState(@NonNull TextPaint ds) { ds.setTypeface(TypefaceProvider.getTypeface(context, iconSet)); }
@Override public void updateMeasureState(@NonNull TextPaint paint) { paint.setTypeface(TypefaceProvider.getTypeface(context, iconSet)); }
@Override public void setTypeface(Typeface tf) { super.setTypeface(tf); if (mTitlePaint != null) mTitlePaint.setTypeface(tf); }
@Override public void updateMeasureState(@NonNull TextPaint paint) { paint.setTypeface(TypefaceProvider.getTypeface(context, iconSet)); }
@Override public void updateDrawState(@NonNull TextPaint ds) { ds.setTypeface(TypefaceProvider.getTypeface(context, iconSet)); }
/** * Loads and draws given text * * @return The current IconicsDrawable for chaining. */ @NonNull public IconicsDrawable iconText(@NonNull String icon, @Nullable Typeface typeface) { mPlainIcon = icon; mIcon = null; mIconBrush.getPaint().setTypeface(typeface == null ? Typeface.DEFAULT : typeface); invalidateSelf(); return this; }
public void setTypeface(Typeface typeface) { if (typeface == null) { typeface = Typeface.DEFAULT; } if (mTextPaint.getTypeface() != typeface) { mTextPaint.setTypeface(typeface); recalculate(); } }
/** * sets the typeface of the drawable * NOTE THIS WILL OVERWRITE THE ICONFONT! * * @return The current IconicsDrawable for chaining. */ @NonNull public IconicsDrawable typeface(@Nullable Typeface typeface) { mIconBrush.getPaint().setTypeface(typeface); invalidateSelf(); return this; } //endregion
Typeface font = ResourcesCompat.getFont(getContext(), fontResId); if (font != null) { paint.setTypeface(font);
/** * Loads and draws given. * * @return The current IconicsDrawable for chaining. */ @NonNull protected IconicsDrawable icon(@NonNull ITypeface typeface, @NonNull IIcon icon) { mIcon = icon; mIconBrush.getPaint().setTypeface(typeface.getTypeface(mContext)); invalidateSelf(); return this; }
private void prepareAnimate() { mTextSize = mHTextView.getTextSize(); mPaint.setTextSize(mTextSize); mPaint.setColor(mHTextView.getCurrentTextColor()); mPaint.setTypeface(mHTextView.getTypeface()); gapList.clear(); for (int i = 0; i < mText.length(); i++) { gapList.add(mPaint.measureText(String.valueOf(mText.charAt(i)))); } mOldPaint.setTextSize(mTextSize); mOldPaint.setColor(mHTextView.getCurrentTextColor()); mOldPaint.setTypeface(mHTextView.getTypeface()); oldGapList.clear(); for (int i = 0; i < mOldText.length(); i++) { oldGapList.add(mOldPaint.measureText(String.valueOf(mOldText.charAt(i)))); } }
p.setTypeface(mTypeface); tp.setTypeface(mTypeface);
private void initPaint() { mTextPaint = new TextPaint(); mTextPaint.setAntiAlias(true); mTextPaint.setTextSize(getTextSize()); mTextPaint.setColor(mColor); mTextPaint.setStyle(Paint.Style.FILL); mTextPaint.setTypeface(getTypeface()); mTextPaintOutline = new TextPaint(); mTextPaintOutline.setAntiAlias(true); mTextPaintOutline.setTextSize(getTextSize()); mTextPaintOutline.setColor(mBorderColor); mTextPaintOutline.setStyle(Paint.Style.STROKE); mTextPaintOutline.setTypeface(getTypeface()); mTextPaintOutline.setStrokeWidth(mBorderSize); }
/** * Loads and draws given. * * @return The current IconicsDrawable for chaining. */ @NonNull public IconicsDrawable icon(@NonNull IIcon icon) { mIcon = icon; mPlainIcon = null; ITypeface typeface = icon.getTypeface(); mIconBrush.getPaint().setTypeface(typeface.getTypeface(mContext)); invalidateSelf(); return this; }
public boolean testSize(float suggestedSize, RectF availableSpace) { paint.setTextSize(suggestedSize); paint.setTypeface(getTypeface()); String text = getText().toString(); if (maxLines == 1) { textRect.bottom = paint.getFontSpacing(); textRect.right = paint.measureText(text); return availableSpace.width() >= textRect.right && availableSpace.height() >= textRect.bottom; } else { StaticLayout layout = new StaticLayout(text, paint, (int) availableSpace.right, Layout.Alignment.ALIGN_NORMAL, spacingMult, spacingAdd, true); if (maxLines != -1 && layout.getLineCount() > maxLines) return false; return availableSpace.width() >= layout.getWidth() && availableSpace.height() >= layout.getHeight(); } }
public boolean testSize(float suggestedSize, RectF availableSpace) { paint.setTextSize(suggestedSize); paint.setTypeface(getTypeface()); String text = getText().toString(); if (maxLines == 1) { textRect.bottom = paint.getFontSpacing(); textRect.right = paint.measureText(text); return availableSpace.width() >= textRect.right && availableSpace.height() >= textRect.bottom; } else { StaticLayout layout = new StaticLayout(text, paint, (int) availableSpace.right, Layout.Alignment.ALIGN_NORMAL, spacingMult, spacingAdd, true); if (maxLines != -1 && layout.getLineCount() > maxLines) return false; return availableSpace.width() >= layout.getWidth() && availableSpace.height() >= layout.getHeight(); } }
public boolean testSize(float suggestedSize, RectF availableSpace) { paint.setTextSize(suggestedSize); paint.setTypeface(getTypeface()); String text = getText().toString(); if (maxLines == 1) { textRect.bottom = paint.getFontSpacing(); textRect.right = paint.measureText(text); return availableSpace.width() >= textRect.right && availableSpace.height() >= textRect.bottom; } else { StaticLayout layout = new StaticLayout(text, paint, (int) availableSpace.right, Layout.Alignment.ALIGN_NORMAL, spacingMult, spacingAdd, true); if (maxLines != -1 && layout.getLineCount() > maxLines) return false; return availableSpace.width() >= layout.getWidth() && availableSpace.height() >= layout.getHeight(); } }
Typeface font = ResourcesCompat.getFont(context, data.fontResId); if (font != null) { paint.setTypeface(font);