本文整理汇总了Java中android.graphics.Paint.getTypeface方法的典型用法代码示例。如果您正苦于以下问题:Java Paint.getTypeface方法的具体用法?Java Paint.getTypeface怎么用?Java Paint.getTypeface使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.graphics.Paint
的用法示例。
在下文中一共展示了Paint.getTypeface方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例2: 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);
}
示例3: 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);
}
示例4: apply
import android.graphics.Paint; //导入方法依赖的package包/类
private static 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.setTypeface(tf);
}
示例5: applyCustomTypeFace
import android.graphics.Paint; //导入方法依赖的package包/类
private static void applyCustomTypeFace(Paint paint, @Nullable Typeface tf) {
if (tf == null) {
return;
}
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);
}
示例6: draw
import android.graphics.Paint; //导入方法依赖的package包/类
public void draw(Canvas g2, float x, float y) {
drawDebug(g2, x, y);
// Paint st=AjLatexMath.getPaint();
// st.setTextSize(AjLatexMath.getTextSize());
Paint st =new Paint();
float w = st.getStrokeWidth();
Style s = st.getStyle();
Typeface f = st.getTypeface();
st.setStrokeWidth(0);//
st.setStyle(Style.FILL_AND_STROKE);
st.setTypeface(font);
g2.save();
g2.translate(x, y);
g2.scale(0.5f * size, 0.5f * size);
// g2.drawText(str, x, y, st);
g2.drawText(str, 0, 0, st);
g2.restore();
st.setStyle(s);
st.setStrokeWidth(w);
st.setTypeface(f);
}
示例7: apply
import android.graphics.Paint; //导入方法依赖的package包/类
private void apply(final Paint paint, final 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);
}
示例8: applyFontStyle
import android.graphics.Paint; //导入方法依赖的package包/类
public static void applyFontStyle(Paint paint, int style, int weight, String family) {
int oldStyle;
Typeface typeface = paint.getTypeface();
if (typeface == null) {
oldStyle = 0;
} else {
oldStyle = typeface.getStyle();
}
int want = 0;
if ((weight == Typeface.BOLD)
|| ((oldStyle & Typeface.BOLD) != 0 && weight == WXStyle.UNSET)) {
want |= Typeface.BOLD;
}
if ((style == Typeface.ITALIC)
|| ((oldStyle & Typeface.ITALIC) != 0 && style == WXStyle.UNSET)) {
want |= Typeface.ITALIC;
}
if (family != null) {
typeface = getOrCreateTypeface(family, want);
}
if (typeface != null) {
paint.setTypeface(Typeface.create(typeface, want));
} else {
paint.setTypeface(Typeface.defaultFromStyle(want));
}
}
示例9: 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);
}
示例10: getCharGeometryCacheKey
import android.graphics.Paint; //导入方法依赖的package包/类
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;
}
}
示例11: apply
import android.graphics.Paint; //导入方法依赖的package包/类
private static void apply(
Paint paint,
int style,
int weight,
@Nullable String family,
AssetManager assetManager) {
int oldStyle;
Typeface typeface = paint.getTypeface();
if (typeface == null) {
oldStyle = 0;
} else {
oldStyle = typeface.getStyle();
}
int want = 0;
if ((weight == Typeface.BOLD) ||
((oldStyle & Typeface.BOLD) != 0 && weight == ReactTextShadowNode.UNSET)) {
want |= Typeface.BOLD;
}
if ((style == Typeface.ITALIC) ||
((oldStyle & Typeface.ITALIC) != 0 && style == ReactTextShadowNode.UNSET)) {
want |= Typeface.ITALIC;
}
if (family != null) {
typeface = ReactFontManager.getInstance().getTypeface(family, want, assetManager);
} else if (typeface != null) {
// TODO(t9055065): Fix custom fonts getting applied to text children with different style
typeface = Typeface.create(typeface, want);
}
if (typeface != null) {
paint.setTypeface(typeface);
} else {
paint.setTypeface(Typeface.defaultFromStyle(want));
}
}
示例12: d
import android.graphics.Paint; //导入方法依赖的package包/类
protected Typeface d(Paint paint) {
Object obj;
Typeface typeface;
Paint paint2;
if (this.useHanyiColorFont || !(paint instanceof ETPaint)) {
obj = null;
typeface = null;
paint2 = paint;
} else {
paint = ((ETPaint) paint).a();
Typeface typeface2 = paint.getTypeface();
paint.setTypeface(null);
typeface = typeface2;
obj = 1;
paint2 = paint;
}
if (!this.useDefaultFont) {
return typeface;
}
if (paint2 instanceof ETPaint) {
paint2 = ((ETPaint) paint2).a();
}
if (obj != null) {
return typeface;
}
typeface = paint2.getTypeface();
paint2.setTypeface(null);
return typeface;
}